mirror of
https://codeberg.org/timelimit/timelimit-server.git
synced 2026-08-31 19:03:45 +02:00
Fix session reset for the session duration limit
This commit is contained in:
@@ -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 })
|
||||||
|
|||||||
Reference in New Issue
Block a user