mirror of
https://codeberg.org/timelimit/timelimit-server.git
synced 2025-10-03 09:49:32 +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 (oldItem) {
|
||||||
if (hasTrustedTimestamp) {
|
|
||||||
oldItem.lastUsage = action.trustedTimestamp.toString(10)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
hasTrustedTimestamp &&
|
hasTrustedTimestamp &&
|
||||||
action.trustedTimestamp > parseInt(oldItem.lastUsage, 10) + oldItem.sessionPauseDuration
|
action.trustedTimestamp - item.timeToAdd > parseInt(oldItem.lastUsage, 10) + oldItem.sessionPauseDuration
|
||||||
) {
|
) {
|
||||||
oldItem.lastSessionDuration = item.timeToAdd
|
oldItem.lastSessionDuration = item.timeToAdd
|
||||||
} else {
|
} else {
|
||||||
oldItem.lastSessionDuration = oldItem.lastSessionDuration + item.timeToAdd
|
oldItem.lastSessionDuration = oldItem.lastSessionDuration + item.timeToAdd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hasTrustedTimestamp) {
|
||||||
|
oldItem.lastUsage = action.trustedTimestamp.toString(10)
|
||||||
|
}
|
||||||
|
|
||||||
oldItem.roundedLastUpdate = roundedTimestampForSessionDuration
|
oldItem.roundedLastUpdate = roundedTimestampForSessionDuration
|
||||||
|
|
||||||
await oldItem.save({ transaction: cache.transaction })
|
await oldItem.save({ transaction: cache.transaction })
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue