Skip to content

Commit

Permalink
pkp#8700 Removed not needed optimizations
Browse files Browse the repository at this point in the history
(cherry picked from commit c1bcdc8)
  • Loading branch information
jonasraoni committed May 23, 2024
1 parent 5652fde commit 7141a1f
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions api/v1/_submissions/PKPBackendSubmissionsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public function getMany(Request $illuminateRequest): JsonResponse
$genres = $genreDao->getByContextId($context->getId())->toArray();

return response()->json([
'itemsMax' => $collector->limit(null)->offset(null)->getCount(),
'itemsMax' => $collector->getCount(),
'items' => Repo::submission()->getSchemaMap()->mapManyToSubmissionsList($submissions, $userGroups, $genres)->values(),
], Response::HTTP_OK);
}
Expand Down Expand Up @@ -259,7 +259,7 @@ public function assigned(Request $illuminateRequest): JsonResponse
$genres = $genreDao->getByContextId($context->getId())->toArray();

return response()->json([
'itemsMax' => $collector->limit(null)->offset(null)->getCount(),
'itemsMax' => $collector->getCount(),
'items' => Repo::submission()->getSchemaMap()->mapManyToSubmissionsList($submissions, $userGroups, $genres)->values(),
], Response::HTTP_OK);
}
Expand Down Expand Up @@ -326,7 +326,7 @@ public function reviews(Request $illuminateRequest): JsonResponse
$genres = $genreDao->getByContextId($context->getId())->toArray();

return response()->json([
'itemsMax' => $collector->limit(null)->offset(null)->getCount(),
'itemsMax' => $collector->getCount(),
'items' => Repo::submission()->getSchemaMap()->mapManyToSubmissionsList($submissions, $userGroups, $genres)->values(),
], Response::HTTP_OK);
}
Expand Down Expand Up @@ -384,7 +384,7 @@ public function getReviewAssignments(Request $illuminateRequest): JsonResponse
$reviewAssignments = $collector->getMany();

return response()->json([
'itemsMax' => $collector->limit(null)->offset(null)->getCount(),
'itemsMax' => $collector->getCount(),
'items' => Repo::reviewAssignment()->getSchemaMap()->mapMany($reviewAssignments)->values(),
], Response::HTTP_OK);
}
Expand Down
2 changes: 1 addition & 1 deletion api/v1/announcements/PKPAnnouncementController.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public function getMany(Request $illuminateRequest): JsonResponse
$announcements = $collector->getMany();

return response()->json([
'itemsMax' => $collector->limit(null)->offset(null)->getCount(),
'itemsMax' => $collector->getCount(),
'items' => Repo::announcement()->getSchemaMap()->summarizeMany($announcements)->values(),
], Response::HTTP_OK);
}
Expand Down
2 changes: 1 addition & 1 deletion api/v1/dois/PKPDoiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public function getMany(Request $illuminateRequest): JsonResponse
$dois = $collector->getMany();

return response()->json([
'itemsMax' => $collector->limit(null)->offset(0)->getCount(),
'itemsMax' => $collector->getCount(),
'items' => Repo::doi()->getSchemaMap()->summarizeMany($dois)->values(),
], Response::HTTP_OK);
}
Expand Down
2 changes: 1 addition & 1 deletion api/v1/emailTemplates/PKPEmailTemplateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public function getMany(Request $illuminateRequest): JsonResponse
$emailTemplates = $collector->getMany();

return response()->json([
'itemsMax' => $collector->limit(null)->offset(null)->getCount(),
'itemsMax' => $collector->getCount(),
'items' => Repo::emailTemplate()->getSchemaMap()->summarizeMany($emailTemplates),
], Response::HTTP_OK);
}
Expand Down
2 changes: 1 addition & 1 deletion api/v1/highlights/HighlightsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function getMany(Request $illuminateRequest): JsonResponse
$highlights = $collector->getMany();

return response()->json([
'itemsMax' => $collector->limit(null)->offset(null)->getCount(),
'itemsMax' => $collector->getCount(),
'items' => Repo::highlight()->getSchemaMap()->summarizeMany($highlights)->values(),
], Response::HTTP_OK);
}
Expand Down
2 changes: 1 addition & 1 deletion api/v1/institutions/PKPInstitutionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public function getMany(Request $illuminateRequest): JsonResponse
$institutions = $collector->getMany();

return response()->json([
'itemsMax' => $collector->limit(null)->offset(null)->getCount(),
'itemsMax' => $collector->getCount(),
'items' => Repo::institution()->getSchemaMap()->summarizeMany($institutions->values())->values(),
], Response::HTTP_OK);
}
Expand Down
2 changes: 1 addition & 1 deletion api/v1/sections/SectionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function getMany(Request $illuminateRequest): JsonResponse
$sections = $collector->getMany();

return response()->json([
'itemsMax' => $collector->limit(null)->offset(null)->getCount(),
'itemsMax' => $collector->getCount(),
'items' => Repo::section()->getSchemaMap()->summarizeMany($sections)->values(),
], Response::HTTP_OK);
}
Expand Down
6 changes: 3 additions & 3 deletions api/v1/submissions/PKPSubmissionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ public function getMany(Request $illuminateRequest): JsonResponse
$genres = $genreDao->getByContextId($context->getId())->toArray();

return response()->json([
'itemsMax' => $collector->limit(null)->offset(null)->getCount(),
'itemsMax' => $collector->getCount(),
'items' => Repo::submission()->getSchemaMap()->summarizeMany($submissions, $userGroups, $genres)->values(),
], Response::HTTP_OK);
}
Expand Down Expand Up @@ -900,7 +900,7 @@ public function getPublications(Request $illuminateRequest): JsonResponse
$genres = $genreDao->getByContextId($submission->getData('contextId'))->toArray();

return response()->json([
'itemsMax' => $collector->limit(null)->offset(null)->getCount(),
'itemsMax' => $collector->getCount(),
'items' => Repo::publication()->getSchemaMap($submission, $userGroups, $genres)->summarizeMany($publications, $anonymize)->values(),
], Response::HTTP_OK);
}
Expand Down Expand Up @@ -1357,7 +1357,7 @@ public function getContributors(Request $illuminateRequest): JsonResponse
$authors = $collector->getMany();

return response()->json([
'itemsMax' => $collector->limit(null)->offset(null)->getCount(),
'itemsMax' => $collector->getCount(),
'items' => Repo::author()->getSchemaMap()->summarizeMany($authors)->values(),
], Response::HTTP_OK);
}
Expand Down
4 changes: 2 additions & 2 deletions api/v1/users/PKPUserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public function getMany(Request $request): JsonResponse
}

return response()->json([
'itemsMax' => $collector->limit(null)->offset(null)->getCount(),
'itemsMax' => $collector->getCount(),
'items' => $items,
], Response::HTTP_OK);
}
Expand Down Expand Up @@ -230,7 +230,7 @@ public function getReviewers(Request $request): JsonResponse
}

return response()->json([
'itemsMax' => $collector->limit(null)->offset(null)->getCount(),
'itemsMax' => $collector->getCount(),
'items' => $items,
], Response::HTTP_OK);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public function getItems($request)
*/
public function getItemsMax()
{
return $this->_getCollector()->offset(null)->limit(null)->getCount();
return $this->_getCollector()->getCount();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ protected function loadData($request, $filter)
->offset($rangeInfo->getOffset() + max(0, $rangeInfo->getPage() - 1) * $rangeInfo->getCount());

$users = $collector->getMany()->toArray();
$totalCount = $collector->limit(null)->offset(null)->getCount();
$totalCount = $collector->getCount();
return new \PKP\core\VirtualArrayIterator($users, $totalCount, $rangeInfo->getPage(), $rangeInfo->getCount());
}

Expand Down

0 comments on commit 7141a1f

Please sign in to comment.