diff --git a/agt/ballotagent/new_ballot.go b/agt/ballotagent/new_ballot.go index c2325d6da888b0c225abe86d56811a143b38101e..c28f4382977ecc8091fe00f48b5f560681a4ce54 100644 --- a/agt/ballotagent/new_ballot.go +++ b/agt/ballotagent/new_ballot.go @@ -96,10 +96,8 @@ func (rsa *BallotServerAgent) handleBallot( orderedTBAlts []cs.Alternative, deadline time.Time, ) { - targetBallot := rsa.ballots[ballot] - fmt.Println(targetBallot) time.Sleep(time.Until(deadline)) - targetBallot.isOpen = false + targetBallot := rsa.ballots[ballot] profile := targetBallot.profile // If profile is empty, set winner as 0 and ranking as empty list @@ -122,7 +120,15 @@ func (rsa *BallotServerAgent) handleBallot( for _, alt := range ranking { intRanking = append(intRanking, int(alt)) } - targetBallot.results = rad.ResultResponse{Winner: int(winner), Ranking: intRanking} + + rsa.ballots[ballot] = BallotInfo{ + profile: profile, + options: targetBallot.options, + votersId: targetBallot.votersId, + nbAlts: targetBallot.nbAlts, + isOpen: false, + results: rad.ResultResponse{Winner: int(winner), Ranking: intRanking}, + } fmt.Println(targetBallot) } @@ -133,9 +139,8 @@ func (rsa *BallotServerAgent) handleBallotWithSingleOption( orderedTBAlts []cs.Alternative, deadline time.Time, ) { - targetBallot := rsa.ballots[ballot] - fmt.Println(targetBallot) time.Sleep(time.Until(deadline)) + targetBallot := rsa.ballots[ballot] targetBallot.isOpen = false profile := targetBallot.profile options := targetBallot.options