Skip to content

Commit 1f8aee2

Browse files
alcercujaybuidl
authored andcommitted
fix(subgraph): correctly derive votes field in classic round
1 parent 49bb4bf commit 1f8aee2

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

subgraph/schema.graphql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ interface DisputeKitDispute {
2424
interface DisputeKitRound {
2525
id: ID!
2626
localDispute: DisputeKitDispute!
27+
votes: [Vote!]! @derivedFrom(field: "localRound")
2728
}
2829

2930
interface Vote {
@@ -185,8 +186,8 @@ type ClassicDispute implements DisputeKitDispute @entity {
185186
type ClassicRound implements DisputeKitRound @entity {
186187
id: ID! # disputeKit.id-coreDispute-dispute.rounds.length
187188
localDispute: DisputeKitDispute!
189+
votes: [Vote!]! @derivedFrom(field: "localRound")
188190

189-
votes: [ClassicVote!]!
190191
winningChoice: BigInt!
191192
counts: [BigInt!]!
192193
tied: Boolean!

subgraph/src/entities/ClassicRound.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export function createClassicRound(
1313
const id = `${localDisputeID}-${roundIndex.toString()}`;
1414
const classicRound = new ClassicRound(id);
1515
classicRound.localDispute = localDisputeID;
16-
classicRound.votes = [];
1716
classicRound.winningChoice = ZERO;
1817
classicRound.counts = new Array<BigInt>(choicesLength.toI32()).fill(ZERO);
1918
classicRound.tied = true;
@@ -42,6 +41,7 @@ export function updateCounts(id: string, choice: BigInt): void {
4241
round.tied = false;
4342
}
4443
}
44+
round.totalVoted = round.totalVoted.plus(ONE);
4545
round.save();
4646
}
4747

0 commit comments

Comments
 (0)