@@ -20,6 +20,7 @@ import { ensureClassicEvidenceGroup } from "./entities/ClassicEvidenceGroup";
2020import {
2121 createClassicRound ,
2222 updateChoiceFundingFromContributionEvent ,
23+ updateCounts ,
2324} from "./entities/ClassicRound" ;
2425import { createClassicVote } from "./entities/ClassicVote" ;
2526import { ONE , ZERO } from "./utils" ;
@@ -29,7 +30,8 @@ export const DISPUTEKIT_ID = "1";
2930export function handleDisputeCreation ( event : DisputeCreation ) : void {
3031 const disputeID = event . params . _coreDisputeID . toString ( ) ;
3132 createClassicDisputeFromEvent ( event ) ;
32- createClassicRound ( disputeID , ZERO ) ;
33+ const numberOfChoices = event . params . _numberOfChoices ;
34+ createClassicRound ( disputeID , numberOfChoices , ZERO ) ;
3335}
3436
3537export function handleEvidenceEvent ( event : EvidenceEvent ) : void {
@@ -52,9 +54,9 @@ export function handleJustificationEvent(event: JustificationEvent): void {
5254 const classicDisputeID = `${ DISPUTEKIT_ID } -${ coreDisputeID } ` ;
5355 const classicDispute = ClassicDispute . load ( classicDisputeID ) ;
5456 if ( ! classicDispute ) return ;
55- const currentLocalRoundID = ` ${
56- classicDispute . id
57- } - ${ classicDispute . currentLocalRoundIndex . toString ( ) } ` ;
57+ const currentLocalRoundID =
58+ classicDispute . id + "-" + classicDispute . currentLocalRoundIndex . toString ( ) ;
59+ updateCounts ( currentLocalRoundID , event . params . _choice ) ;
5860 createClassicVote ( currentLocalRoundID , event ) ;
5961}
6062
@@ -88,7 +90,8 @@ export function handleChoiceFunded(event: ChoiceFunded): void {
8890 ) ;
8991 if ( ! localDispute ) return ;
9092 const newRoundIndex = localDispute . currentLocalRoundIndex . plus ( ONE ) ;
91- createClassicRound ( coreDisputeID , newRoundIndex ) ;
93+ const numberOfChoices = localDispute . numberOfChoices ;
94+ createClassicRound ( coreDisputeID , numberOfChoices , newRoundIndex ) ;
9295 }
9396
9497 localRound . save ( ) ;
0 commit comments