REST Service for POPCORN - ILIAS
alex
6 hours ago b9ca09b770f0cd55c7f5d044205cd7a451f8e07e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
export function goStart (offset, limit, total) {
   console.log(`goStart: offset=${offset} limit=${limit} total=${total}`)
   const offset2 = 0
   return offset2
}
 
export function goEnd (offset, limit, total) {
   console.log(`goEnd: offset=${offset} limit=${limit} total=${total}`)
   let offset2 = Math.floor(total / limit) * limit
   return offset2
}
 
export function goPrev (offset, limit, total) {
   console.log(`goPrev: offset=${offset} limit=${limit} total=${total}`)
   let offset2 = Math.max(0, offset - limit)
   return offset2
}
 
export function goNext (offset, limit, total) {
   console.log(`goNext: offset=${offset} limit=${limit} total=${total}`)
   const maxNext = Math.floor(total / limit) * limit
   const nextNext = offset + limit
   let offset2 = Math.min(maxNext, nextNext)
   return offset2
}