Skip to content

Conversation

@Hipposgrumm
Copy link
Contributor

@Hipposgrumm Hipposgrumm commented Jun 12, 2025

This makes ContentWebService.asmx/GetPeriodicGameDataByGame actually return the top scores associated with Today.
Previous behavior was getting the top score based on the most recent scores submitted in the past 24 hours. This meant that the score shown was the best all-time score, not the best today score.
Additionally, this change associates each score with a date, so yesterday's scores don't overlap with today's. (This is all subjective to the timezone of the server.)

The following SQL commands are required with the update:

ALTER TABLE [GameDataPairs] ADD  [DailyValue] INTEGER NOT NULL DEFAULT 0 ;

@Spirtix
Copy link
Contributor

Spirtix commented Jun 13, 2025

Why do we need two new tables for data that's already in the database?

@Hipposgrumm
Copy link
Contributor Author

The data only contains the latest and highest score. There is no way to get the highest score gotten today with the current way it is set up.

For example, Player1 scores 3000 points on the first day. That score is added to the leaderboard and shown as their score for today. The next day, they score 2000 points.
The database changes the existing entry to use the new datetime, but keeps the highest score among the current and incoming entries (this logic itself is slightly flawed since the date no longer matches when the score was obtained). The data is not appended to the table.
Therefore, when the daily leaderboard is gotten, it shows a user's all-time highscore instead of the highest score the user has gotten today. So instead of Player1's score showing as 2000 points as expected (since that's what they got today), it shows 3000 points, since that's the highest score they've ever gotten, regardless of the day that score was obtained. This makes sense for normal leaderboards, but not for the daily one.

@Hipposgrumm
Copy link
Contributor Author

Actually. I just thought of a way to optimize it to add one column instead of two tables.

@Hipposgrumm Hipposgrumm marked this pull request as draft June 15, 2025 20:45
@Hipposgrumm Hipposgrumm marked this pull request as ready for review June 16, 2025 05:08
@Hipposgrumm
Copy link
Contributor Author

Hipposgrumm commented Jun 16, 2025

I have optimized the code.

@Hipposgrumm
Copy link
Contributor Author

I have fixed any existing merge conflicts and am still waiting for this to be re-reviewed.

@Spirtix
Copy link
Contributor

Spirtix commented Sep 16, 2025

Why can't we use GameDataResponseToList in GetDailyGameData like in the other functions?

@Hipposgrumm
Copy link
Contributor Author

Hipposgrumm commented Sep 16, 2025

Why can't we use GameDataResponseToList in GetDailyGameData like in the other functions?

IIRC (it's been a while since looking at the code) GameDataResponseToList returns highest all-time score, which is what's currently happening anyway. We want the highest score for today.

@Spirtix
Copy link
Contributor

Spirtix commented Sep 16, 2025

It returns e.Value instead of e.DailyValue, but it can be modified to return e.DailyValue for this use case...

@Hipposgrumm
Copy link
Contributor Author

I just realized that's probably not the best name for a commit.

@Hipposgrumm Hipposgrumm requested a review from Spirtix October 19, 2025 18:52
@Hipposgrumm
Copy link
Contributor Author

Just wondering can you look at this again?

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.

2 participants