From 1f7a30688b8f5c572fc1ef7ba8314feda0f2493a Mon Sep 17 00:00:00 2001 From: Garemat <9209350+Garemat@users.noreply.github.com> Date: Tue, 14 Jul 2026 15:15:54 +0100 Subject: [PATCH] fix: scope host previousRoundMachinations to a single round Backend PR #15 changed the host-only previousRoundMachinations query to return every past round's submissions tagged with a roundNumber field, instead of just the previous round. The app never picked up the new field, so PreviousRoundMachinationsSection flattened all past rounds together, showing inflated/duplicated "Supported by" lists for hosts only (members' responses are still correctly scoped server-side and were unaffected). --- .../main/java/io/github/garemat/lunachron/CharacterState.kt | 3 +++ .../garemat/lunachron/ui/OnlineCampaignDetailScreen.kt | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/github/garemat/lunachron/CharacterState.kt b/app/src/main/java/io/github/garemat/lunachron/CharacterState.kt index cb33171..154a8a7 100644 --- a/app/src/main/java/io/github/garemat/lunachron/CharacterState.kt +++ b/app/src/main/java/io/github/garemat/lunachron/CharacterState.kt @@ -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 = emptyList(), val attack: OnlineMachinationAttack? = null diff --git a/app/src/main/java/io/github/garemat/lunachron/ui/OnlineCampaignDetailScreen.kt b/app/src/main/java/io/github/garemat/lunachron/ui/OnlineCampaignDetailScreen.kt index 7a91968..3ac46d1 100644 --- a/app/src/main/java/io/github/garemat/lunachron/ui/OnlineCampaignDetailScreen.kt +++ b/app/src/main/java/io/github/garemat/lunachron/ui/OnlineCampaignDetailScreen.kt @@ -1281,10 +1281,13 @@ private fun PreviousRoundMachinationsSection( val drawCount: Int ) - val results = remember(machinations, members) { + val results = remember(machinations, members, previousRound) { val supportersOf = mutableMapOf>() val sabotageCountOf = mutableMapOf() + // 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)