1
0
Fork 0

Prevent invalid watch sections

This commit is contained in:
Chocobozzz 2022-07-12 09:51:21 +02:00
parent 0f7195fa40
commit a49407524f
No known key found for this signature in database
GPG key ID: 583A612D890159BE

View file

@ -104,8 +104,13 @@ export class VideoViewerStats {
}) })
} else { } else {
const lastSection = stats.watchSections[stats.watchSections.length - 1] const lastSection = stats.watchSections[stats.watchSections.length - 1]
if (lastSection.start > currentTime) {
logger.warn('Invalid end watch section %d. Last start record was at %d.', currentTime, lastSection.start)
} else {
lastSection.end = currentTime lastSection.end = currentTime
} }
}
stats.watchTime = this.buildWatchTimeFromSections(stats.watchSections) stats.watchTime = this.buildWatchTimeFromSections(stats.watchSections)