Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abstain function not working correctly when recasting votes #8

Open
agnauck opened this issue Dec 3, 2020 · 0 comments
Open

Abstain function not working correctly when recasting votes #8

agnauck opened this issue Dec 3, 2020 · 0 comments

Comments

@agnauck
Copy link
Contributor

agnauck commented Dec 3, 2020

Description:
Abstain only exists for board&council ballots. Therefore this bug happens only for board&council ballots.

When a voter is recasting the votes, and voters don't want to use all of their 5 YES votes again and submit the abstain command, Memberbot may still include "yes" votes from the previous voting session. It seems to delete only the previous vote at the position you abstain. Some other previous yes votes remain in the results.

The described issue only when in the previous voting session more YES votes were used then in the recast session.

I think the problem is here in the Abstain function where is deletes only 1 YES vote:

def abstain_vote(self, jid, section, item):
session = self.get_session(jid)
votes = session['votes']
if item in votes[section]:
del votes[section][item]
fulfilled = session['fulfilled']
fulfilled[section] = sum([1 for (name, vote) in votes[section].items() if vote == 'yes'])
self.redis.hset('%s:session:%s:%s' % (self.key_prefix, self.current_ballot, jid.bare), 'votes', votes)
self.redis.hset('%s:session:%s:%s' % (self.key_prefix, self.current_ballot, jid.bare), 'fulfilled', fulfilled)
return self.get_session(jid)

In the context of a board and council election abstain means:
I do not want to elect more applicants into either board or council

So I think we need to delete the current and all subsequent array items. Or change the whole logic and clear the previous votes completely at the right time in the recast session.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant