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

[Backport] Use votes score instead of total votes on debates and legislation proposals #3291

Merged
merged 5 commits into from
Feb 13, 2019

Conversation

decabeza
Copy link
Collaborator

@decabeza decabeza commented Feb 12, 2019

References

This is a backport of AyuntamientoMadrid#1835

Objectives

Use votes_score instead of total_votes on debates and legislation proposals.

The main change it's now the votes number is the result of cached_votes_up minus cached_votes_down.

BEFORE

1 cached_votes_up + 0 cached_votes_down = 1 vote
1 cached_votes_up + 1 cached_votes_down = 2 votes
0 cached_votes_up + 1 cached_votes_down = 1 vote

NOW

1 cached_votes_up + 0 cached_votes_down = 1 vote
1 cached_votes_up + 1 cached_votes_down = No votes
0 cached_votes_up + 1 cached_votes_down = -1 vote

So this PR:

  • Replace total votes to cached_votes_score on debates: this show votes_score as result of votes_up minus votes_down.
  • Add cached_votes_score to legislation proposals.
  • Replace total votes to cached_votes_score on legislation proposals: this show votes_score as result of votes_up minus votes_down.
  • Show cached_votes_score on admin legislation proposals.

Visual Changes

Voting debates
debates

Voting legislation proposals
legislation_proposals

Legislation proposals admin show "Total supports" (cached_votes_score)
admin

For release notes ⚠️

In case you have existing legislation proposals in DB run:
bin/rake legislation_proposals:calculate_cached_votes_score RAILS_ENV=production
to calculate cached_votes_score.

@decabeza decabeza self-assigned this Feb 12, 2019
@decabeza decabeza added this to Review in Roadmap Feb 12, 2019
Run this task it's only necessary if already existing legislation proposals in DB.
@decabeza decabeza merged commit fad65b6 into master Feb 13, 2019
@decabeza decabeza moved this from Review to Release 0.19 in Roadmap Feb 13, 2019
@decabeza decabeza deleted the total-votes branch February 13, 2019 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants