Populate the wanted list from DB placeholders

This commit is contained in:
Mike Colagrosso 2024-12-27 02:00:00 -07:00 committed by Alex Cabal
parent 0359119a11
commit 5b605a00b7
3 changed files with 46 additions and 459 deletions

View file

@ -2420,4 +2420,21 @@ final class Ebook{
return ['ebooks' => $ebooks, 'ebooksCount' => $ebooksCount];
}
/**
* Queries for `Ebook`s on the wanted list for a given `EbookPlaceholderDifficulty`.
*
* @return array<Ebook>
*/
public static function GetWantedByDifficulty(Enums\EbookPlaceholderDifficulty $difficulty): array{
return Db::Query('
SELECT Ebooks.*
from Ebooks inner join EbookPlaceholders using (EbookId)
where EbookPlaceholders.IsWanted = true and
EbookPlaceholders.IsInProgress = false and
EbookPlaceholders.Difficulty = ?
order by Ebooks.Updated desc
', [$difficulty], Ebook::class);
}
}