mirror of
https://github.com/standardebooks/web.git
synced 2025-07-19 12:54:48 -04:00
Populate the wanted list from DB placeholders
This commit is contained in:
parent
0359119a11
commit
5b605a00b7
3 changed files with 46 additions and 459 deletions
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue