Skip to content

Conversation

@stadust
Copy link
Owner

@stadust stadust commented May 24, 2025

Use a materialized view to cache the ranking, refresh it when appropriate, and use that to return a player's rank as part of GET /players/ responses (both pagination and normal). Will help with implementing #241

License Acceptance

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@stadust
Copy link
Owner Author

stadust commented May 24, 2025

still needs some testing

@stadust stadust closed this May 24, 2025
@stadust stadust reopened this May 24, 2025
@stadust stadust linked an issue May 24, 2025 that may be closed by this pull request
@codecov
Copy link

codecov bot commented May 24, 2025

Codecov Report

Attention: Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.

Project coverage is 32.10%. Comparing base (b5b56ce) to head (9183cd7).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
pointercrate-demonlist/src/player/paginate.rs 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #258      +/-   ##
==========================================
+ Coverage   30.17%   32.10%   +1.93%     
==========================================
  Files         118      118              
  Lines        8119     8123       +4     
==========================================
+ Hits         2450     2608     +158     
+ Misses       5669     5515     -154     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

stadust added 4 commits May 25, 2025 13:07
This allow us to add player ranks to the FullPlayer objects, which will
simplify the stats viewer frontend significantly.

Signed-off-by: stadust <43299462+stadust@users.noreply.github.com>
It needs to be refreshed whenever someone's score changes.

Signed-off-by: stadust <43299462+stadust@users.noreply.github.com>
I thought that deletes on the players table might get messed up because
the materialized view has an index, but seems like this is not the case.
Good to have a simple test for the merging functionality anyway though.

Signed-off-by: stadust <43299462+stadust@users.noreply.github.com>
This will include it in all pagination responses (we already join with
the nationalities table, so surely this can't be that bad), but more
importantly, we return it in the GET for individual players, which
allows us to simplify the stats viewer a bit.

Signed-off-by: stadust <43299462+stadust@users.noreply.github.com>
@stadust stadust force-pushed the cached-player-ranks branch from af1695d to 9d8f3fc Compare May 25, 2025 12:08
With both scores and ranks cached these days, the individual stats
viewer can stop parsing them from the html of the selection panel, and
instead just grab them from the API response. This means that now the
individual stats viewer actually supports .selectArbitrary for selecting
players not currently visible in the pagination panel.

Signed-off-by: stadust <43299462+stadust@users.noreply.github.com>
@stadust stadust merged commit 6693192 into master May 25, 2025
4 checks passed
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

Successfully merging this pull request may close these issues.

Rank should be included in full form of player

2 participants