speed up MoreLikeLoans by avoiding hitting solr
This commit is contained in:
@@ -122,8 +122,10 @@ class User extends DbMapping
|
|||||||
return $result ? $result->to_array() : array();
|
return $result ? $result->to_array() : array();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function _getLoans($table, $sort = "ItemNr ASC") {
|
public function getLoansData($table, $sort = "ItemNr ASC")
|
||||||
|
{
|
||||||
$sql = sprintf("SELECT
|
$sql = sprintf("SELECT
|
||||||
|
n.NoticeId,
|
||||||
n.NoticeNr,
|
n.NoticeNr,
|
||||||
CheckOutDate,
|
CheckOutDate,
|
||||||
ItemNr
|
ItemNr
|
||||||
@@ -134,9 +136,12 @@ class User extends DbMapping
|
|||||||
c.UserAccountID = %s
|
c.UserAccountID = %s
|
||||||
ORDER BY %s", $table, $this->id, $sort);
|
ORDER BY %s", $table, $this->id, $sort);
|
||||||
|
|
||||||
$result = Connection::execute($sql);
|
return Connection::execute($sql)->to_array();
|
||||||
|
}
|
||||||
|
|
||||||
$circulations = $result->to_array();
|
private function _getLoans($table, $sort = "ItemNr ASC")
|
||||||
|
{
|
||||||
|
$circulations = $this->getLoansData($table, $sort);
|
||||||
// getting the intval of the NoticeNr will remove any 'V' or 'T' and thus we will have no issues with
|
// getting the intval of the NoticeNr will remove any 'V' or 'T' and thus we will have no issues with
|
||||||
// the virtual books that are used for Downloads and so.
|
// the virtual books that are used for Downloads and so.
|
||||||
$codes = array_unique(array_map(function($c) { return intval(trim($c['NoticeNr'])); }, $circulations));
|
$codes = array_unique(array_map(function($c) { return intval(trim($c['NoticeNr'])); }, $circulations));
|
||||||
|
|||||||
@@ -735,12 +735,8 @@ class NetBiblio extends WebService
|
|||||||
*/
|
*/
|
||||||
public function MoreLikeLoans()
|
public function MoreLikeLoans()
|
||||||
{
|
{
|
||||||
$_SESSION["user"]["login"] = 35;
|
$circulations = $this->getUser()->getLoansData('OldCirculations');
|
||||||
|
$ids = array_map(function($c) { return $c['NoticeId']; }, $circulations);
|
||||||
$loans = $this->getUser()->GetOldLoans();
|
|
||||||
$ids = array_map(function($l) {
|
|
||||||
return $l['id'];
|
|
||||||
}, $loans);
|
|
||||||
return $this->MoreLikeThis($ids);
|
return $this->MoreLikeThis($ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user