Skip to content

Commit 9e6fad4

Browse files
committed
Count issue fix in user and cohort list
1 parent 04d9171 commit 9e6fad4

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/adapters/postgres/cohort-adapter.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,9 +649,8 @@ export class PostgresCohortService {
649649
}
650650

651651
// Apply offset and limit for pagination
652+
count = results.length;
652653
const paginatedResults = results.slice(offset, offset + limit);
653-
count = paginatedResults.length;
654-
655654
if (paginatedResults.length > 0) {
656655
return APIResponse.success(
657656
response,

src/adapters/postgres/user-adapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,8 @@ async searchUser(
357357
await this.processUserDetails(userSearchDto, results);
358358
}
359359
}
360-
results.getUserDetails = results.getUserDetails.slice(offset, offset + limit);
361360
results.total_count = results.getUserDetails.length;
361+
results.getUserDetails = results.getUserDetails.slice(offset, offset + limit);
362362

363363

364364
return await APIResponse.success(response, apiId, results, HttpStatus.OK, 'User List fetched.');

0 commit comments

Comments
 (0)