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

Calculate vote average using weighting by date #131

Merged
merged 1 commit into from
Feb 6, 2020

Conversation

whomwah
Copy link
Member

@whomwah whomwah commented Feb 6, 2020

Currently the average vote for a track is calculated in the standard way, taking all the votes and dividing them by the count.

This change adds weighting to the calculation so the longer ago a vote is cast the less important it is to the average.

Based on todays date (2020-02-06) here's some weighted votes based on the original and the date they were voted:

{ vote: 90, at: '2020-02-05T17:08:27.000Z', weighted: 90 },
{ vote: 80, at: '2019-08-04T17:08:27.000Z', weighted: 70 },
{ vote: 10, at: '2019-02-03T17:08:27.000Z', weighted: 30 },
{ vote: 10, at: '2018-08-02T17:08:27.000Z', weighted: 40 }

Remember the scores are stored as 0-100 but are displayed as -5 to +5 so a score of 40 = -1

@whomwah whomwah self-assigned this Feb 6, 2020
@whomwah whomwah force-pushed the weighted_vote_average branch 2 times, most recently from 5d1dc8b to cf5b9b9 Compare February 6, 2020 14:05
@whomwah whomwah force-pushed the weighted_vote_average branch from cf5b9b9 to d459049 Compare February 6, 2020 14:26
@whomwah whomwah merged commit 19409c0 into master Feb 6, 2020
@whomwah whomwah deleted the weighted_vote_average branch February 6, 2020 14:54
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.

1 participant