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

Design generic pointless leaderboard system #42

Closed
hozn opened this issue Jan 19, 2018 · 3 comments
Closed

Design generic pointless leaderboard system #42

hozn opened this issue Jan 19, 2018 · 3 comments

Comments

@hozn
Copy link
Contributor

hozn commented Jan 19, 2018

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:

  • Athlete
  • Rank
  • "Score" (some number and units)

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.

---
key: dirtybiker
title: Dirty Biker Leaderboard
description: (Rules ...)
sql: |
  select athlete_name, rank, ponts from ....  order by rank asc;
@jrenaut
Copy link
Contributor

jrenaut commented Jan 20, 2018

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

@hozn
Copy link
Contributor Author

hozn commented Jan 20, 2018

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.

@hozn
Copy link
Contributor Author

hozn commented Jan 22, 2018

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;

hozn added a commit that referenced this issue Feb 9, 2018
… leaderboards to new generic yaml-based system.
@hozn hozn closed this as completed in 30bdf36 Feb 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants