Created
November 4, 2020 23:27
-
-
Save entzik/b8d4134251253f0b4d8180329ae0e7b3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
do | |
invite <- fetch inviteId | |
... | |
let | |
crtVotes = fromOptional (VotingSlot with count = 0, voted = []) (DA.TextMap.lookup option this.votes) | |
updatedVotes = DA.TextMap.insert option (VotingSlot with count = crtVotes.count + 1, voted = voter :: crtVotes.voted) this.votes | |
assertMsg "each voter is only allowed to cast one vote per option" (notElem voter crtVotes.voted) | |
create this with votes = updatedVotes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment