Skip to content

Commit 57cc0f2

Browse files
authored
Merge pull request #11086 from bdach/challenge-pack-check
Exclude scores without pp when displaying pack item pass indicator
2 parents f3d479a + f12e1e1 commit 57cc0f2

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

Diff for: app/Libraries/Search/ScoreSearch.php

+3
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ public function getQuery(): BoolQuery
5656
$query->mustNot(['term' => ['mods' => $excludedMod]]);
5757
}
5858
}
59+
if ($this->params->excludeWithoutPp === true) {
60+
$query->filter(['exists' => ['field' => 'pp']]);
61+
}
5962

6063
$this->addModsFilter($query);
6164

Diff for: app/Libraries/Search/ScoreSearchParams.php

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class ScoreSearchParams extends SearchParams
2424
public bool $excludeConverts = false;
2525
public ?array $excludeMods = null;
2626
public ?bool $isLegacy = null;
27+
public bool $excludeWithoutPp = false;
2728
public ?array $mods = null;
2829
public ?int $rulesetId = null;
2930
public $size = 50;
@@ -39,6 +40,7 @@ public static function fromArray(array $rawParams): static
3940
$params->beatmapIds = $rawParams['beatmap_ids'] ?? null;
4041
$params->excludeConverts = $rawParams['exclude_converts'] ?? $params->excludeConverts;
4142
$params->excludeMods = $rawParams['exclude_mods'] ?? null;
43+
$params->excludeWithoutPp = $rawParams['exclude_without_pp'] ?? $params->excludeWithoutPp;
4244
$params->isLegacy = $rawParams['is_legacy'] ?? null;
4345
$params->mods = $rawParams['mods'] ?? null;
4446
$params->rulesetId = $rawParams['ruleset_id'] ?? null;

Diff for: app/Models/BeatmapPack.php

+7
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,13 @@ public function userCompletionData($user, ?bool $isLegacy)
117117
];
118118
if ($this->no_diff_reduction) {
119119
$params['exclude_mods'] = app('mods')->difficultyReductionIds->toArray();
120+
if ($isLegacy !== true) {
121+
// the intended meaning of this check is that the scores should not include mods
122+
// that disqualify them from granting pp.
123+
// mods are not the only reason why pp might be missing, but it's the best that we have for now.
124+
// see also: https://github.com/ppy/osu-queue-score-statistics/pull/234
125+
$params['exclude_without_pp'] = true;
126+
}
120127
}
121128

122129
static $aggName = 'by_beatmap';

0 commit comments

Comments
 (0)