mirror of
https://codeberg.org/timelimit/timelimit-server.git
synced 2025-10-03 01:39:31 +02:00
Fix session reset for the session duration limit
This commit is contained in:
parent
ef1b19a01c
commit
7b7f888335
1 changed files with 5 additions and 5 deletions
|
@ -121,19 +121,19 @@ export async function dispatchAddUsedTimeVersion2 ({ deviceId, action, cache }:
|
|||
})
|
||||
|
||||
if (oldItem) {
|
||||
if (hasTrustedTimestamp) {
|
||||
oldItem.lastUsage = action.trustedTimestamp.toString(10)
|
||||
}
|
||||
|
||||
if (
|
||||
hasTrustedTimestamp &&
|
||||
action.trustedTimestamp > parseInt(oldItem.lastUsage, 10) + oldItem.sessionPauseDuration
|
||||
action.trustedTimestamp - item.timeToAdd > parseInt(oldItem.lastUsage, 10) + oldItem.sessionPauseDuration
|
||||
) {
|
||||
oldItem.lastSessionDuration = item.timeToAdd
|
||||
} else {
|
||||
oldItem.lastSessionDuration = oldItem.lastSessionDuration + item.timeToAdd
|
||||
}
|
||||
|
||||
if (hasTrustedTimestamp) {
|
||||
oldItem.lastUsage = action.trustedTimestamp.toString(10)
|
||||
}
|
||||
|
||||
oldItem.roundedLastUpdate = roundedTimestampForSessionDuration
|
||||
|
||||
await oldItem.save({ transaction: cache.transaction })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue