-
Notifications
You must be signed in to change notification settings - Fork 381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add played filter to beatmap listing #3051
Add played filter to beatmap listing #3051
Conversation
@@ -111,6 +112,19 @@ private function addModeFilter($query) | |||
} | |||
} | |||
|
|||
private function addPlayedFilter($query) | |||
{ | |||
if ($this->params->user === null || !$this->params->user->isSupporter()) { |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
private function getPlayedBeatmapIds() | ||
{ | ||
$unionQuery = null; | ||
foreach ($this->getSelectedModes() as $mode) { |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
app/Libraries/Search/PlayedState.php
Outdated
|
||
namespace App\Libraries\Search; | ||
|
||
abstract class PlayedState |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -59,6 +59,8 @@ public function __construct(Request $request, ?User $user = null) | |||
explode('.', $request['r'] ?? null), | |||
$validRanks | |||
); | |||
|
|||
$this->playedState = get_int($request['p']) ?? PlayedState::ALL; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
} | ||
|
||
if ($this->params->playedState === PlayedState::PLAYED) { | ||
$query->filter(['terms' => ['difficulties.beatmap_id' => $this->getPlayedBeatmapIds()]]); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
since param signifies presence of filtering
'p' is not very informative..
fixes #2846