Skip to content

Commit e5672e8

Browse files
committed
support excluding by ranked date
1 parent 57214d9 commit e5672e8

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

app/Libraries/Search/BeatmapsetSearch.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -329,16 +329,24 @@ private function addRecommendedFilter()
329329

330330
private function addRankedFilter(): void
331331
{
332+
static $approvedStates = [
333+
Beatmapset::STATES['ranked'],
334+
Beatmapset::STATES['approved'],
335+
Beatmapset::STATES['loved'],
336+
];
337+
332338
if ($this->includes->ranked !== null) {
333339
$this->query
334-
->filter(['terms' => ['approved' => [
335-
Beatmapset::STATES['ranked'],
336-
Beatmapset::STATES['approved'],
337-
Beatmapset::STATES['loved'],
338-
]]])->filter(['range' => ['approved_date' => $this->includes->ranked]]);
340+
->filter(['terms' => ['approved' => $approvedStates]])
341+
->filter(['range' => ['approved_date' => $this->includes->ranked]]);
339342
}
340343

341-
// TODO: add ranked exclusion
344+
// ranked date exclusion assumes we're still looking for ranked maps.
345+
if ($this->excludes->ranked !== null) {
346+
$this->query
347+
->filter(['terms' => ['approved' => $approvedStates]])
348+
->mustNot(['range' => ['approved_date' => $this->excludes->ranked]]);
349+
}
342350
}
343351

344352
private function addSimpleFilters(): void

0 commit comments

Comments
 (0)