diff --git a/doc/Fixtures/Leaderboards.md b/doc/Fixtures/Leaderboards.md new file mode 100644 index 0000000..f3c7548 --- /dev/null +++ b/doc/Fixtures/Leaderboards.md @@ -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 diff --git a/doc/Fixtures/Transactions.md b/doc/Fixtures/Transactions.md new file mode 100644 index 0000000..444bd30 --- /dev/null +++ b/doc/Fixtures/Transactions.md @@ -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. diff --git a/doc/Leaderboards.md b/doc/Leaderboards.md index 8902337..a01069d 100644 --- a/doc/Leaderboards.md +++ b/doc/Leaderboards.md @@ -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.