Added totals of updated and unmatched books to toast shown at completion of batch quick match.

This commit is contained in:
Nick Thomson 2022-09-24 18:57:09 +01:00
parent 11e3cf4f19
commit 2d6f9bab8b
2 changed files with 17 additions and 4 deletions

View File

@ -124,8 +124,17 @@ export default {
options: this.options, options: this.options,
libraryItemIds: this.selectedBookIds libraryItemIds: this.selectedBookIds
}) })
.then(() => { .then((result) => {
this.$toast.success('Batch quick match success!') var success = result.success || false
var toast = 'Batch quick match complete!\n' + result.updates + ' Updated'
if (result.unmatched && (result.unmatched > 0)) {
toast += '\n' + result.unmatched + ' with no matches'
}
if (success) {
this.$toast.success(toast)
} else {
this.$toast.info(toast)
}
this.processing = false this.processing = false
this.$store.commit('setProcessingBatch', false) this.$store.commit('setProcessingBatch', false)
this.show = false this.show = false

View File

@ -308,6 +308,7 @@ class LibraryItemController {
// POST: api/items/batch/quickmatch // POST: api/items/batch/quickmatch
async batchQuickMatch(req, res) { async batchQuickMatch(req, res) {
var itemsUpdated = 0 var itemsUpdated = 0
var itemsUnmatched = 0
var matchData = req.body var matchData = req.body
var options = matchData.options || {} var options = matchData.options || {}
@ -321,12 +322,15 @@ class LibraryItemController {
var matchResult = await this.scanner.quickMatchLibraryItem(libraryItem, options) var matchResult = await this.scanner.quickMatchLibraryItem(libraryItem, options)
if (matchResult.updated) { if (matchResult.updated) {
itemsUpdated++ itemsUpdated++
} } else if (matchResult.warning) {
itemsUnmatched++
}
} }
res.json({ res.json({
success: itemsUpdated > 0, success: itemsUpdated > 0,
updates: itemsUpdated updates: itemsUpdated,
unmatched: itemsUnmatched
}) })
} }