Closed MagicSword89 closed 5 years ago
Or... Accept operators like
$top 6m
would give a leaderboard based on the past 6 months
$top 6d
would give me to work based on the past 6 days of activity
I like that! This enables nothing needing to be reset. Just extract data from given points of time. love it!
To further expand on @fortepc idea, if possible it would be great to have a leaderboard based on raid boss reported.
This way you could grant badges based on most reported T5, Shinx or other raid bosses.
Example:
$top T5 1m
$top Shinx 1m
Leaderboards are relatively simple at the moment, we store a database record for each community leaderboard with a score for each trainer.
I'm inclined to define a "resettable" variant that gets updated each time, with the current leaderboards remaining an "all-time" score. I can implement this quickly to solve the immediate.
As far as the more complicated queries, I think we should separate "leaderboards" from arbitrary database queries. Because a leaderboard is literally just a ledger with trainer scores and its always increasing (could be decreasing too). The tables that store how thats derived are somewhere else and the system is not necessarily designed to query by an arbitrary constraint. For example, raids and trades are designed to be retrieved based on how the bot handles actions around it (example: get me the raids that are expired so I can remove them from discord) -- and not by say, egg tier. Additionally the constraints for leaderboard inclusion are determined then the raid / trade etc finishes -- the database isn't designed to quickly lookup raids by the ones that satisfies the conditions for leaderboard inclusion, but it can make the decision quickly when the raid completes. In general, indexes in a database should be added only if necessary, to avoid excessive penalties when writing (which pokenav does a lot of).
I could expose some more ways for admins to query the pokenav database for their communities, but I'd like to make it flexible enough to handle most things people would want. I also don't think its necessarily a leaderboard thing that accessible to everyone. Let me think on it. For now I'll define the custom leaderboard that can be reset
Our server does a monthly leaderboard and it takes hours to finish from subtracting last months and pulling profiles to get exact numbers. Is there a way to add additional $top commands or split it into 2 parts [all time and one you can reset] such as: $top_reset [does not reset the all-time score] $top_expanded [expands the lists from 10 to 50] $top_reset_username [resets the given user's score, but not their all-time score] This is all I can think of right now that will greatly help. Thanks!