Skip to content

Abstain function not working correctly when recasting votes #8

@agnauck

Description

@agnauck

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions