You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have to add a !votefor command to the Discord bot, for the client-side functionality of our voting event.
Rules
Each fellow has a single vote to cast. Once cast, their vote is final, i.e. no takebacks.
Votes are weighted so a fellow's received votes are added to their own vote. For example, if a fellow has received five votes, their vote is worth six votes.
Each fellow must cast their vote. If a fellow has not voted by the end of the voting period, they cannot be picked as a winner.
Only fellows can vote and be voted for, that is, MLH staff, mentors, maintainers, sponsors are excluded. In fairness, we three should be excluded as well.
Vote numbers remain secret until the results are announced. We give access to an MLH admin so they can monitor that vote numbers are legit.
Implementation
The Discord bot get a new command !votefor @Discord username and three possible answers.
// command
!votefor kendevops
// happy path
<bot> Your vote has been recorded. Thanks for voting!
// edge case 1
<bot> The records show you already voted!
// edge case 2
<bot> This person is not a fellow. Only fellows can receive votes!
The DB gets two new columns votes_available (one or zero) and votes_received (zero and above) for each fellow.
When a fellow issues the command, the bot makes a GET request to the backend to check for votes available.
Happy path: If voter has a vote to cast, the bot makes a POST requests to update (1) the voter's votes_available to zero, and (2) the votee's votes_received to whatever votes the votee has plus the voter's votes_received + 1. The bot confirms successful vote to the voter.
Edge cases: If the voter has no vote to cast or if the votee is not in the fellows table or if the voter and the votee are the same, the bot reports why the vote cannot be cast.
When the contest ends, we look in the DB for three fellow with the highest number of votes, provided they have zero votes available.
The text was updated successfully, but these errors were encountered:
We have to add a
!votefor
command to the Discord bot, for the client-side functionality of our voting event.Rules
Implementation
The Discord bot get a new command
!votefor @Discord username
and three possible answers.The DB gets two new columns
votes_available
(one or zero) and votes_received (zero and above) for each fellow.When a fellow issues the command, the bot makes a GET request to the backend to check for votes available.
Happy path: If voter has a vote to cast, the bot makes a POST requests to update (1) the voter's
votes_available
to zero, and (2) the votee'svotes_received
to whatever votes the votee has plus the voter'svotes_received
+ 1. The bot confirms successful vote to the voter.Edge cases: If the voter has no vote to cast or if the votee is not in the fellows table or if the voter and the votee are the same, the bot reports why the vote cannot be cast.
When the contest ends, we look in the DB for three fellow with the highest number of votes, provided they have zero votes available.
The text was updated successfully, but these errors were encountered: