Added basic docs for leaderboards, and fixtures

This commit is contained in:
Tom Bloor 2017-08-21 15:11:05 +01:00
parent e49d806308
commit 6c35bc36e0
3 changed files with 69 additions and 7 deletions

View File

@ -0,0 +1,32 @@
# Leaderboard Fixtures
* Fixture Name: `leaderboards`
## Users:
* Test User1
* email: test1@example.com
* password: abc123
* Test User2
* email: test2@example.com
* password: abc123
* Test User3
* email: test3@example.com
* password: abc123
* Test User4
* email: test4@example.com
* password: abc123
* Test Org
* email: test5@example.com
* password: abc123
## Transactions
Uses the same transactions as the `Transactions` fixtures set.
## Leaderboards
Pre calculated leaderboards for all normal leaderboard types.
* Daily Total/Count
* Daily from May 3rd 2017 until July 31st 2017

View File

@ -0,0 +1,26 @@
# Leaderboard Fixtures
* Fixture Name: `transactions`
## Users:
* Test User1
* email: test1@example.com
* password: abc123
* Test User2
* email: test2@example.com
* password: abc123
* Test User3
* email: test3@example.com
* password: abc123
* Test User4
* email: test4@example.com
* password: abc123
* Test Org
* email: test5@example.com
* password: abc123
## Transactions:
One transaction every 10 minutes, starting at August 1st 2017 and going back in
time, for each user. All transactions go to Test Org.

View File

@ -1,12 +1,16 @@
# Leaderboards
## Calculation
The leaderboards are calculated for the previous range - so Daily leaderboards
are calculated for the whole of the day before, Weeks from the week before,
etc. - The only exception is all time, which is calculated from 00:00 on the
current day.
## Recalculation
To figure out if a Leaderboard needs recalculation, the easiest way is to get
the transaction set that it corresponds to, and compare either the sum or count
of that result set to the sum of the leaderboard values.
Leaderboard recalculation only affects the latest two leaderboards for any set,
so just need to recalculate the last one and the current one, in that order.
This can be done during the regular leaderboard calculation cronjob, so
verified transactions will show up in the leaderboards the next day.
This can be done at any time, but if recalculation is needed then ALL
leaderboards newer than one that doesnt match (of the same type) will need
recalculating due to possible position changes, and therefore the trend
changing.