Skip to content

Commit

Permalink
Limit getSummaries to current collection
Browse files Browse the repository at this point in the history
  • Loading branch information
jjrom committed Sep 27, 2024
1 parent fecd49d commit 9050d89
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
6 changes: 4 additions & 2 deletions app/resto/core/RestoCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -871,11 +871,13 @@ public function addFeatures($body, $params)
public function getSummaries()
{
if ( !isset($this->summaries) ) {
$summaries = (new CatalogsFunctions($this->context->dbDriver))->getSummaries(null, $this->id);
$summaries = (new CatalogsFunctions($this->context->dbDriver))->getSummaries(null);
if ( isset($summaries[$this->id]) ) {
$this->setSummaries($summaries[$this->id]);
}
else $this->summaries = array();
else {
$this->summaries = array();
}
}
return $this->summaries;
}
Expand Down
8 changes: 7 additions & 1 deletion app/resto/core/RestoCollections.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,13 @@ public function getOSDD($model)
public function getSummaries()
{
if ( !isset($this->summaries) ) {
$this->summaries = (new CatalogsFunctions($this->context->dbDriver))->getSummaries(null, null);
$summaries = (new CatalogsFunctions($this->context->dbDriver))->getSummaries(null);
if ( isset($summaries[$this->id]) ) {
$this->setSummaries($summaries[$this->id]);
}
else {
$this->summaries = array();
}
}
return $this->summaries;
}
Expand Down
5 changes: 3 additions & 2 deletions app/resto/core/dbfunctions/CatalogsFunctions.php
Original file line number Diff line number Diff line change
Expand Up @@ -489,11 +489,10 @@ public function removeCatalog($catalogId)
* )
*
* @param array $types
* @param string $collectionId
*
* @return array
*/
public function getSummaries($types, $collectionId)
public function getSummaries($types)
{

$summaries = array();
Expand All @@ -507,6 +506,8 @@ public function getSummaries($types, $collectionId)
// First create collection pivots
$pivots = array();
for ($i = 0, $ii = count($catalogs); $i < $ii; $i++) {

// Process only collection
if ( $catalogs[$i]['rtype'] !== 'collection' ) {
continue;
}
Expand Down

0 comments on commit 9050d89

Please sign in to comment.