Added API to get the schools related to USer#4739
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
There was a problem hiding this comment.
Code Review
This pull request splits the combined logic for the PROGRAM_MANAGER and FIELD_COORDINATOR roles in SupabaseApi.ts. A dedicated block is introduced for FIELD_COORDINATOR to query the SchoolUser table, filter, sort, and paginate the results. The review feedback suggests a minor performance optimization to convert the search query to lowercase outside of the loop instead of on every iteration.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| for (const row of schoolUsers ?? []) { | ||
| const school = firstOrSelf(row.school); | ||
| if ( | ||
| !school?.id || | ||
| school.is_deleted || | ||
| (search && | ||
| !String(school.name ?? '') | ||
| .toLowerCase() | ||
| .includes(search.toLowerCase())) | ||
| ) { | ||
| continue; | ||
| } |
There was a problem hiding this comment.
To improve efficiency, consider converting the search string to lowercase once outside the loop instead of calling search.toLowerCase() on every iteration.
const searchLower = search?.toLowerCase();
for (const row of schoolUsers ?? []) {
const school = firstOrSelf(row.school);
if (
!school?.id ||
school.is_deleted ||
(searchLower &&
!String(school.name ?? '')
.toLowerCase()
.includes(searchLower))
) {
continue;
}
No description provided.