Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

editedBy item sort option for group libraries #154

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

abaevbog
Copy link
Contributor

Fixes: #153

@abaevbog abaevbog requested a review from dstillman June 22, 2023 20:23
@@ -482,7 +482,7 @@ public function init($extra) {

// Sorting by Item Type or Added By currently require writing to shard tables, so don't
// send those to the read replicas
if ($this->queryParams['sort'] == 'itemType' || $this->queryParams['sort'] == 'addedBy') {
if ($this->queryParams['sort'] == 'itemType' || $this->queryParams['sort'] == 'addedBy' || $this->queryParams['sort'] == 'editedBy') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can switch this to in_array($this->queryParams['sort'], ['itemType', 'addedBy', 'editedBy'])

@@ -274,13 +274,15 @@ public static function search($libraryID, $onlyTopLevel = false, array $params =
// Join temp table to query
$sql .= "JOIN tmpItemTypeNames TITN ON (TITN.itemTypeID=$itemTypeIDSelector) ";
break;


case 'editedBy':
case 'addedBy':
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

editedBy goes second, here and below

case 'addedBy':
$isGroup = Zotero_Libraries::getType($libraryID) == 'group';
$userParameter = $params['sort'] == "editedBy" ? 'lastModifiedByUserID' : 'createdByUserID';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use == 'addedBy' instead

@abaevbog abaevbog requested a review from dstillman June 23, 2023 15:32
abaevbog added a commit to abaevbog/dataserver that referenced this pull request Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

editedBy item sort option for group libraries
2 participants