better random book filter

master
Gilles Crettenand 11 years ago
parent 47f9ce93be
commit 16860ce7f7

@ -265,7 +265,14 @@ class NetBiblio extends WebService
public function GetRandomBooks($number = 100) { public function GetRandomBooks($number = 100) {
$sql = "SELECT TOP $number NoticeId $sql = "SELECT TOP $number NoticeId
FROM Notices FROM Notices
WHERE Notices.[NoticeNr] NOT LIKE '%%~%%' WHERE
(
Notices.MediaType1Code='CDD' OR
Notices.MediaType1Code='CDA' OR
Notices.MediaType1Code='CDS'
)
AND Notices.Visible=1
AND Notices.[NoticeNr] NOT LIKE '%%~%%'
ORDER BY NEWID();"; ORDER BY NEWID();";
$ids = Connection::execute($sql)->to_array(); $ids = Connection::execute($sql)->to_array();
$ids = array_map(function($a) { return $a['NoticeId']; }, $ids); $ids = array_map(function($a) { return $a['NoticeId']; }, $ids);

Loading…
Cancel
Save