Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ data class OnlineMachinationAttack(
data class OnlineMachinationEntry(
val deviceId: String,
val username: String,
// Only sent (as >0) for hosts, whose previousRoundMachinations spans every
// past round rather than just the previous one. Defaults to 0 for member
// responses, which the server already scopes to a single round.
val roundNumber: Int = 0,
val choices: List<OnlineMachinationChoice> = emptyList(),
val attack: OnlineMachinationAttack? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1281,10 +1281,13 @@ private fun PreviousRoundMachinationsSection(
val drawCount: Int
)

val results = remember(machinations, members) {
val results = remember(machinations, members, previousRound) {
val supportersOf = mutableMapOf<String, MutableList<String>>()
val sabotageCountOf = mutableMapOf<String, Int>()
// Hosts receive every past round's submissions (tagged with roundNumber > 0);
// members receive only the previous round, where roundNumber defaults to 0.
for (entry in machinations) {
if (entry.roundNumber > 0 && entry.roundNumber != previousRound) continue
for (choice in entry.choices) {
if (choice.type == "SUPPORT") {
supportersOf.getOrPut(choice.targetDeviceId) { mutableListOf() }.add(entry.username)
Expand Down
Loading