Skip to content

Commit

Permalink
Merge pull request #2240 from LeoStoyanovByWater/DIS-376-fetching-lis…
Browse files Browse the repository at this point in the history
…t-records

DIS-376: Added SQL Pagination for List Record Handling
  • Loading branch information
mdnoble73 authored Feb 13, 2025
2 parents e82bff6 + aa85fae commit ee9dcf5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
1 change: 1 addition & 0 deletions code/web/release_notes/25.02.00.MD
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@
- Update UserListEntry to grab a title from the grouped work associated with its source ID if it is given no title and the grouped work is available. (DIS-225) (*IT*)
- Change substr to mb_substr in MyList.php BulkAddTitles when figuring out the title for the new user list entry (DIS-225) (*IT*)
- Use mb_substr to preserve diacritics in lists (DIS-178) (*WNC*)
- `UserList::getListRecords()` now calls `UserList::getListEntries()` with a proper number of arguments for SQL-level pagination. (DIS-376) (*LS*)

### Web Builder Updates
- Add a message when saving a Grapes JS Template or Page to confirm it has been updated successfully. (DIS-92) (*AB*)
Expand Down
9 changes: 2 additions & 7 deletions code/web/sys/UserLists/UserList.php
Original file line number Diff line number Diff line change
Expand Up @@ -386,14 +386,9 @@ public function getListRecords($start, $numItems, $allowEdit, $format, $citation
if ($sortName == null) {
$sortName = $this->defaultSort;
}
$listEntryInfo = $this->getListEntries($sortName, $forLiDA, $appVersion);

//Trim to the number of records we want to return
if ($numItems > 0) {
$filteredListEntries = array_slice($listEntryInfo['listEntries'], $start, $numItems);
} else {
$listEntryInfo = $this->getListEntries($sortName, $forLiDA, $appVersion, $start, $numItems);
// No need to check $numItems as getListEntries() already checks for this before limiting the query.
$filteredListEntries = $listEntryInfo['listEntries'];
}

$filteredIdsBySource = [];
foreach ($filteredListEntries as $listItemEntry) {
Expand Down

0 comments on commit ee9dcf5

Please sign in to comment.