Улучшены подсчет и отображение статистики
This commit is contained in:
@@ -680,19 +680,21 @@ class Search {
|
||||
info += `<div style="min-width: 250px" />`;
|
||||
|
||||
info += `
|
||||
<div><div ${keyStyle}>Всего файлов книг:</div><span>${stat.filesCount}</span></div>
|
||||
<div><div ${keyStyle}>Всего файлов книг:</div><span>${stat.filesCountAll}</span></div>
|
||||
<div><div ${keyStyle}>Из них актуальных:</div><span>${stat.filesCount}</span></div>
|
||||
<div><div ${keyStyle}>Помеченных как удаленные:</div><span>${stat.filesDelCount}</span></div>
|
||||
<br>
|
||||
<div><div ${keyStyle}>Обработано ссылок на книги:</div><span>${stat.bookCountAll}</span></div>
|
||||
<div><div ${keyStyle}>Обработано ссылок на файлы:</div><span>${stat.bookCountAll}</span></div>
|
||||
<div><div ${keyStyle}>Из них актуальных:</div><span>${stat.bookCount}</span></div>
|
||||
<div><div ${keyStyle}>Помеченных как удаленные:</div><span>${stat.bookDelCount}</span></div>
|
||||
<div><div ${keyStyle}>Актуальных без автора:</div><span>${stat.noAuthorBookCount}</span></div>
|
||||
<br>
|
||||
<div><div ${keyStyle}>Всего записей об авторах:</div><span>${stat.authorCountAll}</span></div>
|
||||
<div><div ${keyStyle}>Записей без соавторов:</div><span>${stat.authorCount}</span></div>
|
||||
<div><div ${keyStyle}>Всего имен авторов:</div><span>${stat.authorCountAll}</span></div>
|
||||
<div><div ${keyStyle}>Уникальных имен без соавторов:</div><span>${stat.authorCount}</span></div>
|
||||
<div><div ${keyStyle}>С соавторами:</div><span>${stat.authorCountAll- stat.authorCount}</span></div>
|
||||
<br>
|
||||
<div><div ${keyStyle}>Уникальных названий книг:</div><span>${stat.titleCount}</span></div>
|
||||
<div><div ${keyStyle}>Уникальных серий:</div><span>${stat.seriesCount}</span></div>
|
||||
<div><div ${keyStyle}>Уникальных названий серий:</div><span>${stat.seriesCount}</span></div>
|
||||
<div><div ${keyStyle}>Найдено жанров:</div><span>${stat.genreCount}</span></div>
|
||||
<div><div ${keyStyle}>Найдено языков:</div><span>${stat.langCount}</span></div>
|
||||
`;
|
||||
|
||||
@@ -464,7 +464,9 @@ class DbCreator {
|
||||
|
||||
//stats
|
||||
const stats = {
|
||||
filesCount: 0,
|
||||
filesCount: 0,//вычислим позднее
|
||||
filesCountAll: 0,//вычислим позднее
|
||||
filesDelCount: 0,//вычислим позднее
|
||||
recsLoaded,
|
||||
authorCount,
|
||||
authorCountAll: authorArr.length,
|
||||
@@ -554,10 +556,10 @@ class DbCreator {
|
||||
cacheSize: (config.lowMemoryMode ? 5 : 500),
|
||||
});
|
||||
|
||||
callback({job: 'series optimization', jobMessage: 'Оптимизация', jobStep: 11, progress: 0});
|
||||
callback({job: 'optimization', jobMessage: 'Оптимизация', jobStep: 11, progress: 0});
|
||||
await this.optimizeSeries(db, callback);
|
||||
|
||||
callback({job: 'files count', jobMessage: 'Подсчет статистики', jobStep: 12, progress: 0});
|
||||
callback({job: 'stats count', jobMessage: 'Подсчет статистики', jobStep: 12, progress: 0});
|
||||
await this.countStats(db, callback, stats);
|
||||
|
||||
//чистка памяти, ибо жрет как не в себя
|
||||
@@ -676,22 +678,33 @@ class DbCreator {
|
||||
})();
|
||||
|
||||
//подчсет
|
||||
const countRes = await db.select({table: 'book', count: true, where: `
|
||||
const filesSet = new Set();
|
||||
const countRes = await db.select({table: 'book', rawResult: true, where: `
|
||||
const files = new Set();
|
||||
const filesDel = new Set();
|
||||
|
||||
@@iter(@all(), (r) => {
|
||||
for (const id of @all()) {
|
||||
const r = @row(id);
|
||||
const file = ${"`${r.folder}/${r.file}.${r.ext}`"};
|
||||
if (filesSet.has(file)) {
|
||||
return false;
|
||||
if (!r.del) {
|
||||
files.add(file);
|
||||
} else {
|
||||
filesSet.add(file);
|
||||
return true;
|
||||
filesDel.add(file);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
for (const file of filesDel)
|
||||
if (files.has(file))
|
||||
filesDel.delete(file);
|
||||
|
||||
return {filesCount: files.size, filesDelCount: filesDel.size};
|
||||
`});
|
||||
|
||||
if (countRes.length)
|
||||
stats.filesCount = countRes[0].count;
|
||||
if (countRes.length) {
|
||||
const res = countRes[0].rawResult;
|
||||
stats.filesCount = res.filesCount;
|
||||
stats.filesCountAll = res.filesCount + res.filesDelCount;
|
||||
stats.filesDelCount = res.filesDelCount;
|
||||
}
|
||||
|
||||
countDone = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user