Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Include custom beatmap tags set by own user in response #11951

Merged
merged 6 commits into from
Mar 5, 2025

Conversation

notbakaneko
Copy link
Collaborator

@notbakaneko notbakaneko commented Feb 28, 2025

  • shouldn't query every beatmap separately

@notbakaneko notbakaneko marked this pull request as ready for review February 28, 2025 09:20
@@ -396,6 +398,7 @@ private function showJson($beatmapset)
"{$beatmapRelation}.baseMaxCombo",
"{$beatmapRelation}.failtimes",
"{$beatmapRelation}.beatmapOwners.user",
"{$beatmapRelation}.ownBeatmapTags" => fn ($q) => $user !== null ? $q->where('user_id', $user->getKey()) : $q->none(),
Copy link
Collaborator

@nanaya nanaya Feb 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this kinda works but I don't know if better 🤔 less fake ownBeatmapTags at least, and maybe call it current_user_tag_ids and always use Auth::user() in the scope.

Or maybe JSON_OBJECTAGG($userId, JSON_ARRAYAGG(...)) and pass the current user all the way again.

public function scopeWithUserTagIds($query, $userId)
{
    if ($userId === null) {
        $tagQuery = \DB::query()->selectRaw('null');
    } else {
        $tagQuery = BeatmapTag
            ::where('user_id', $userId)
            ->whereColumn('beatmap_id', $this->qualifyColumn('beatmap_id'));
        $tagQuery->selectRaw("GROUP_CONCAT({$tagQuery->qualifyColumn('tag_id')} SEPARATOR ',')");
    }

    return $query->addSelect(['user_tag_ids' => $tagQuery]);
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can use at least a comment on this...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't gotten around to checking it yet 😔

@@ -12,12 +12,15 @@

class BeatmapCompactTransformer extends TransformerAbstract
{
public ?User $user = null;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not used?

@@ -396,6 +398,7 @@ private function showJson($beatmapset)
"{$beatmapRelation}.baseMaxCombo",
"{$beatmapRelation}.failtimes",
"{$beatmapRelation}.beatmapOwners.user",
"{$beatmapRelation}.ownBeatmapTags" => fn ($q) => $user !== null ? $q->where('user_id', $user->getKey()) : $q->none(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can use at least a comment on this...

bdach added a commit to bdach/osu that referenced this pull request Mar 4, 2025
Visual part for ppy#31913. Opening
separately for appropriate visual UI adjustments.

Also mostly ready to be hooked up to the results screen, pending merge
of ppy/osu-web#11951.
@nanaya nanaya enabled auto-merge March 5, 2025 07:58
@nanaya nanaya merged commit 8568550 into ppy:master Mar 5, 2025
3 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants