Skip to content

Voting tool

Alex requested to merge 309-voting into master

Closes #309 (closed)

What does this MR do?

Adds a voting tool. This is still a first draft.

Structure so far:

  • a Poll is always associated with a region or group. It can have a variable number of selectable options, a scope (everyone, only foodsavers, only verified foodsavers, only store managers, only ambassadors) and a type (select one option, select multiple options, give thumbs up or down for each option). Both the type and the scope can easily be extended later.
  • Everything is stored in the database in new tables as suggested in the issue. Listing, creating, and cancelling polls as well as voting is done via REST endpoints.
  • Every member of a region can see a poll and its results. In regions of lower order (cities and districts) and working groups polls can be created by every verified foodsaver. In larger regions (state, country, ...) only ambassadors of that region can do so. Orga can cancel a poll, which means that its end date will be set to the past and the id of the cancelling user is logged.
  • Voters will be notified by a bell if a new poll is created.
  • Results can be seen when a poll has ended. The results table includes the number of votes per possible value for each options and an average value per option (see screenshots). It does not explicitly name a winning option. There is no quorum but the results table shows the number of votes, so that people can decide if enough people voted.

Open questions and problems

  • Should possible voters be determined at creation of the poll or should it be dynamical? Specifically: should a foodsaver who becomes validated or changes the district be allowed to vote in an ongoing poll?

How confident are you it won't break things if deployed?

It doesn't touch any other parts of the page, so I'm sure that nothing else will break.

How to test

Steps a reviewer can take to verify that this MR does what it says it does e.g.

  1. Checkout branch locally
  2. Login as foodsaver
  3. Have a look at a region's poll list
  4. Have a look at ongoing polls and try to vote
  5. Have a look at ended polls which should display the results
  6. Try to create a new poll

Screenshots

Menu entry:

polls_menu

List of polls in a region:

polls_table

Overview page for a poll. The voting form is only visible if the user is allowed to vote:

poll_voting

Results of a poll:

poll_result

Checklist

  • added a test, or explain why one is not needed/possible... added unit tests for the API
  • no unrelated changes
  • asked someone for a code review
  • set a "for:" label to indicate who will be affected by this change
  • use "state:" labels to track this MR's state until it was beta tested
  • added an entry to CHANGELOG.md
  • add a short text that can be used in the release notes
  • Once your MR has been merged, you are responsible to create a testing issue in Beta Testing Repo:
    • Consider writing a detailed description in German.
    • Describe in a few sentences, what should be tested from a user perspective.
    • Also mention different settings (e.g. different browsers, roles, ...). how this change can be tested.
    • Be aware, that also non technical people should understand.
Edited by Alex

Merge request reports