Originally From: https://discord.com/channels/310192285306454017/1081973869994320002/threads/1504361895552090182
Describe the bug
When a users last played game is from a system with no unlocked achievements. It can fall back to a different unexpected system.
To Reproduce
- Add a game to a users play history with the following:
- is the last played game
- from a system the user has not yet played
- has an achievement set but no earned achievements
Screenshots
Expected behavior
Last played system should either be N64 or PSP depending on criteria .
Findings
Digging around I believe the problem starts here:
|
$recentlyPlayedSystemId = collect($userMassData['RecentlyPlayed'] ?? []) |
|
->filter(fn ($game) => System::isGameSystem($game['ConsoleID'] ?? 0) && ($game['AchievementsTotal'] ?? 0) > 0) |
|
->sortByDesc('LastPlayed') |
|
->pluck('ConsoleID') |
|
->first(); |
The recentlyPlayedSystemId is collected if the user's last played game (by default looks at last 5 games) is from a valid system + has an achievement set. It doesn't matter if they have earned any achievements on that game.
recentlyPlayedSystemId gets passed to:
|
$topSystemId = ($recentSystemId !== null && isset($systemProgress[$recentSystemId])) |
|
? $recentSystemId |
|
: array_key_first($systemProgress); |
where recentSystemId is checked in systemProgress. But systemProgress only contains the users last played games with earned achievements.
Otherwise it falls back to array_key_first($systemProgress) which can give unexpected results. systemProgress default order is systemId from lowest to greatest. So $topSystemId equals the lowest systemId the user has earned achievements on. Which is often the Genesis/Mega Drive
Solution
I can implement a solution but just needed clarification if the "Most Recent" system should be from a game with earned achievements or no earned achievements.
Originally From: https://discord.com/channels/310192285306454017/1081973869994320002/threads/1504361895552090182
Describe the bug
When a users last played game is from a system with no unlocked achievements. It can fall back to a different unexpected system.
To Reproduce
Screenshots
Expected behavior
Last played system should either be
N64orPSPdepending on criteria .Findings
Digging around I believe the problem starts here:
RAWeb/resources/views/pages-legacy/userInfo.blade.php
Lines 46 to 50 in d40e4a7
The
recentlyPlayedSystemIdis collected if the user's last played game (by default looks at last 5 games) is from a valid system + has an achievement set. It doesn't matter if they have earned any achievements on that game.recentlyPlayedSystemIdgets passed to:RAWeb/app/Platform/Actions/GetUserProgressionStatusCountsAction.php
Lines 129 to 131 in d40e4a7
where
recentSystemIdis checked insystemProgress. ButsystemProgressonly contains the users last played games with earned achievements.Otherwise it falls back to
array_key_first($systemProgress)which can give unexpected results.systemProgressdefault order issystemIdfrom lowest to greatest. So$topSystemIdequals the lowestsystemIdthe user has earned achievements on. Which is often the Genesis/Mega DriveSolution
I can implement a solution but just needed clarification if the "Most Recent" system should be from a game with earned achievements or no earned achievements.