mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 03:20:12 +08:00
feat: show analytics data page by page
This commit is contained in:
1 parent
9200336b49
commit
ac31ca8659
9 files changed
+87
-12
No files matched your search
@@ -30,7 +30,9 @@ function formatTime(time) {
|
||||
return `${hours}h ${minutes % 60}m ${seconds % 60}s`
|
||||
}
|
||||
|
||||
export async function sessionList() {
|
||||
export async function sessionList(pageNumber, itemsPerPage) {
|
||||
const skipAmount = (pageNumber - 1) * itemsPerPage
|
||||
|
||||
const sessions = await Session.aggregate([
|
||||
{
|
||||
$lookup: {
|
||||
@@ -50,6 +52,8 @@ export async function sessionList() {
|
||||
},
|
||||
},
|
||||
])
|
||||
.skip(skipAmount)
|
||||
.limit(itemsPerPage)
|
||||
return sessions.map(
|
||||
({
|
||||
_id,
|
||||
|
||||
Reference in new issue
Block a user