Skip to content

Commit 79d9bf7

Browse files
committed
🔧 Обновлен пайплайн pTopUsersInSeason: добавлен параметр page для постраничной навигации
1 parent 0b064ae commit 79d9bf7

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

app/rep/mongo/pipelines/seasons.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ export const pSeasonWinners = (startDate: Date, endDate: Date): PipelineStage[]
77
{ $limit: 3 },
88
];
99

10-
export const pTopUsersInSeason = (startDate: Date, endDate: Date, limit = 13): PipelineStage[] => [
10+
export const pTopUsersInSeason = (startDate: Date, endDate: Date, limit: number, page: number): PipelineStage[] => [
1111
{ $match: { requested_at: { $gte: startDate, $lt: endDate } } },
1212
{ $group: { _id: "$user_id", total_size: { $sum: "$size" }, nickname: { $first: "$nickname" } } },
1313
{ $sort: { total_size: -1 } },
14+
{ $skip: Math.max(page - 1, 0) * limit },
1415
{ $limit: limit },
1516
];
1617

0 commit comments

Comments
 (0)