scanLibrary fail and cancel handling round 2

This commit is contained in:
mikiher 2024-09-13 09:23:48 +03:00
parent 1099dbe642
commit f8034e1b78
2 changed files with 36 additions and 39 deletions

View file

@ -75,13 +75,14 @@ class LibraryScan {
return date.format(new Date(), 'YYYY-MM-DD') + '_' + this.id + '.txt'
}
get scanResultsString() {
if (this.error) return this.error
const strs = []
if (this.resultsAdded) strs.push(`${this.resultsAdded} added`)
if (this.resultsUpdated) strs.push(`${this.resultsUpdated} updated`)
if (this.resultsMissing) strs.push(`${this.resultsMissing} missing`)
if (!strs.length) return `Everything was up to date (${elapsedPretty(this.elapsed / 1000)})`
return strs.join(', ') + ` (${elapsedPretty(this.elapsed / 1000)})`
const changesDetected = strs.length > 0 ? strs.join(', ') : 'No changes detected'
const timeElapsed = `(${elapsedPretty(this.elapsed / 1000)})`
const error = this.error ? `${this.error}. ` : ''
return `${error}${changesDetected} ${timeElapsed}`
}
toJSON() {