Skip to content
Snippets Groups Projects
Commit 56fd5c31 authored by Balthazar Wilson's avatar Balthazar Wilson
Browse files

Merge branch 'baltha_server' of gitlab.utc.fr:gvandevi/ia04binome2a into full_baltha

parents 686017d9 d14dbf22
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment