Исправление багов
This commit is contained in:
@@ -616,25 +616,25 @@ class Reader {
|
|||||||
await bookManager.recentSetItem(book);
|
await bookManager.recentSetItem(book);
|
||||||
}
|
}
|
||||||
|
|
||||||
//подготовка к следующему шагу
|
//подготовка к следующему шагу, ищем книгу по url с максимальной датой установки checkBucTime/loadTime
|
||||||
|
//от этой даты будем потом отсчитывать bucCancelDays
|
||||||
if (updateUrls.has(book.url)) {
|
if (updateUrls.has(book.url)) {
|
||||||
let time = checkSetTime[book.key] || 0;
|
let rec = checkSetTime[book.url] || {time: 0, loadTime: 0};
|
||||||
if (book.checkBucTime && book.checkBucTime > time) {
|
|
||||||
time = book.checkBucTime;
|
|
||||||
} else if (book.loadTime && book.loadTime > time) {
|
|
||||||
time = book.loadTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
checkSetTime[book.key] = time;
|
const time = (book.checkBucTime ? book.checkBucTime : (rec.loadTime || 0));
|
||||||
|
if (time > rec.time || (time == rec.time && (book.loadTime > rec.loadTime)))
|
||||||
|
rec = {time, loadTime: book.loadTime, key: book.key};
|
||||||
|
|
||||||
|
checkSetTime[book.url] = rec;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//bucCancelEnabled и bucCancelDays
|
//bucCancelEnabled и bucCancelDays
|
||||||
//снимем флаг checkBuc у необновлявшихся bucCancelDays
|
//снимем флаг checkBuc у необновлявшихся bucCancelDays
|
||||||
if (this.bucCancelEnabled) {
|
if (this.bucCancelEnabled) {
|
||||||
for (const [key, time] of Object.entries(checkSetTime)) {
|
for (const rec of Object.values(checkSetTime)) {
|
||||||
if (time && Date.now() - time > this.bucCancelDays*24*3600*1000) {
|
if (rec.time && Date.now() - rec.time > this.bucCancelDays*24*3600*1000) {
|
||||||
const book = await bookManager.getRecentBook({key});
|
const book = await bookManager.getRecentBook({key: rec.key});
|
||||||
const needBookUpdate =
|
const needBookUpdate =
|
||||||
book.checkBuc
|
book.checkBuc
|
||||||
&& book.bucSize
|
&& book.bucSize
|
||||||
@@ -644,8 +644,7 @@ class Reader {
|
|||||||
;
|
;
|
||||||
|
|
||||||
if (book && !needBookUpdate) {
|
if (book && !needBookUpdate) {
|
||||||
book.checkBuc = undefined;//!!!
|
await bookManager.setCheckBuc(book, undefined);//!!!
|
||||||
await bookManager.recentSetItem(book);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1289,6 +1288,7 @@ class Reader {
|
|||||||
|
|
||||||
this.checkBookPosPercent();
|
this.checkBookPosPercent();
|
||||||
this.activateClickMapPage();//no await
|
this.activateClickMapPage();//no await
|
||||||
|
this.$refs.recentBooksPage.updateTableData();//no await
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -487,7 +487,7 @@ class BookManager {
|
|||||||
await this.recentSetItem(item);
|
await this.recentSetItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
async setCheckBuc(value, checkBuc = true) {
|
async setCheckBuc(value, checkBuc) {
|
||||||
const item = this.recent[value.key];
|
const item = this.recent[value.key];
|
||||||
|
|
||||||
const updateItems = [];
|
const updateItems = [];
|
||||||
@@ -503,10 +503,11 @@ class BookManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const now = Date.now();
|
||||||
for (const book of updateItems) {
|
for (const book of updateItems) {
|
||||||
book.checkBuc = checkBuc;
|
book.checkBuc = checkBuc;
|
||||||
if (checkBuc)
|
if (checkBuc)
|
||||||
book.checkBucTime = Date.now();
|
book.checkBucTime = now;
|
||||||
await this.recentSetItem(book);
|
await this.recentSetItem(book);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user