-
Notifications
You must be signed in to change notification settings - Fork 7
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
Design generic pointless leaderboard system #42
Comments
Theoretically I agree with this, but most of these leaderboards are so low lift that a refactor isn't likely to save us much effort. I don't oppose this, but I'd put it way down on the priority list |
The refactor is less about saving effort and more about making the codebase more reusable for others [that want to run their own competitions with their own pointless prizes, etc.]. But, yeah, it's not high on my list of things to do. Moving the queries into a new model (table) would be easy, but making it easy for someone to edit them is perhaps the harder part. (Maybe editing queries and leaderboard metadata is done through phpMyAdmin initially.) But, yes, low priority. |
I had a bit more thought about this . Rather than store in the database, which is more painful to edit, I'm thinking that a directory full of YAML files would be easy to maintain and version. (And easy for others to customize.) Something like: ---
key: dirtybiker
title: Dirty Biker Leaderboard
description: (Rules ...)
sql: |
select athlete_name, rank, ponts from .... order by rank asc; |
Current copy/paste approach to the pointless prize leaderboards is a bit silly.
Some of the leaderboards are based on different values and numbers, but they can all be distilled down into tables with some common columns:
The backend queries can coerce everything into this basic structure.
Bonus points would be storing the queries themselves into the database so that we wouldn't have to change the application when we add pointless prizes.
Edit (from comment below): rather than store these in the database, I think it would be even better to put these into YAML files. We'd probably want a basic caching mechanism, though, to avoid re-parsing the yaml every time someone hit the leaderboard page.
The text was updated successfully, but these errors were encountered: