Skip to content

Commit

Permalink
Merge pull request #11728 from nanaya/score-index-exclude-restricted
Browse files Browse the repository at this point in the history
Exclude restricted user scores from score listing
  • Loading branch information
notbakaneko authored Dec 10, 2024
2 parents 1ee253f + ee4f07d commit 11e1cba
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/Models/Solo/Score.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,14 @@ public function scopeDefault(Builder $query): Builder
return $query->whereHas('beatmap.beatmapset');
}

/**
* This should only be sorted by primary key(s)
*/
public function scopeForListing(Builder $query): Builder
{
return $query->where('ranked', true)
->whereHas('user', fn ($q) => $q->default())
->from(\DB::raw("{$this->getTable()} FORCE INDEX (PRIMARY)"))
->leftJoinRelation('processHistory')
->select([$query->qualifyColumn('*'), 'processed_version']);
}
Expand Down

0 comments on commit 11e1cba

Please sign in to comment.