-
Notifications
You must be signed in to change notification settings - Fork 392
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
Include custom beatmap tags set by own user in response #11951
Conversation
notbakaneko
commented
Feb 28, 2025
•
edited
Loading
edited
- shouldn't query every beatmap separately
@@ -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(), |
There was a problem hiding this comment.
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]);
}
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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(), |
There was a problem hiding this comment.
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...
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.