Add 7-day trend to overall ranking (placement change + last point gain) - #963
Open
artikcoder wants to merge 1 commit into
Open
Add 7-day trend to overall ranking (placement change + last point gain)#963artikcoder wants to merge 1 commit into
artikcoder wants to merge 1 commit into
Conversation
Shows per pilot in the default overall ranking: - a rank-change arrow (up/down places) since their own last flight event - the point gain from their own last flight event, if any - bold highlight on their most recently submitted top flight, while that trend is still active and self-caused Persists across unrelated changes elsewhere in the ranking, resets on the pilot's own next flight event, and expires automatically after 7 days. Reuses the existing Result model (season/type/result-JSON, new type 'overallSnapshot') as the comparison baseline - no new table/migration. Hooked into the existing flight-mutation points in FlightController (upload, edit, delete, accept/reject violation, admin change). See issue discussion for the full design rationale and test scenarios. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #962
Was ändert sich
Neue Spalte "7-Tage-Trend" in der Standard-Gesamtwertung (aktuelle Saison, ohne Filter):
Details zur Motivation und den einzelnen Fällen (1–5) stehen in #962.
Technischer Ansatz
Result-Model (season/type/result-JSON) wird für die laufende Saison mit einem neuentype("overallSnapshot") als Vergleichs-Baseline wiederverwendet - bisher diente es nur als Archiv für abgeschlossene Saisons.server/service/RankingSnapshotService.ts: Diffing-Logik. Pro Person wird Platz/Punkte zum Zeitpunkt ihres letzten eigenen Ereignisses als Referenz gespeichert. Verdrängungen durch andere aktualisieren nur die Anzeige, nie diese Referenz - dadurch bleibt eine Tendenz über beliebig viele fremde Zwischen-Ereignisse hinweg korrekt bestehen.ResultService.refreshOverallRankingSnapshot(userId)wird an allen bestehenden Stellen inFlightController.tsaufgerufen, an denen sich Flugdaten ändern können (Upload, Bearbeitung, Löschung, Annahme/Ablehnung einer Luftraumverletzung, Admin-Änderung) - kein neuer Cronjob.ResultService.getOverall()reichert die Ergebnisse nur für die ungefilterte Standardansicht um die Trend-Felder an.Getestet
Lokal (Postgres + Server + Client ohne Docker) gegen die mitgelieferten Testdaten (
/testdata/seed) durchgespielt:Offene Fragen / Diskussionspunkte
Falls ihr eine andere Herangehensweise bei der Datenhaltung oder dem Umfang bevorzugt, gerne Bescheid geben - lässt sich noch anpassen, bevor gemergt wird.