Skip to content

User Progression Status displaying the wrong "Most Recent" System #4900

@angelol-git

Description

@angelol-git

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

  1. 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

Image Image

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions