From be17e022a6cfd01215cc7597df5cea6be7e360d9 Mon Sep 17 00:00:00 2001 From: Thomas Date: Fri, 3 Dec 2021 11:00:27 +0100 Subject: [PATCH] Merge pull request #5975 from overleaf/tm-history-upgrade-count-fails Fix for counting upgrade failures in history counts script GitOrigin-RevId: a679fc6e588fc236c31f32e3c27883f25b7f6249 --- .../count_project_history_categories.js | 29 +++++++++---------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/services/web/scripts/history/count_project_history_categories.js b/services/web/scripts/history/count_project_history_categories.js index ace3f9f6c0..490c45c8ed 100644 --- a/services/web/scripts/history/count_project_history_categories.js +++ b/services/web/scripts/history/count_project_history_categories.js @@ -38,21 +38,9 @@ async function processBatch(_, projects) { } async function processProject(project) { - if ( - project.overleaf && - project.overleaf.history && - project.overleaf.history.upgradeFailed - ) { - // a failed history upgrade might look like a v1 project, but history may be broken - COUNT.HistoryUpgradeFailed += 1 - return - } - if ( - project.overleaf && - project.overleaf.history && - project.overleaf.history.id - ) { + if (project.overleaf && project.overleaf.history) { if (project.overleaf.history.upgradeFailed) { + // a failed history upgrade might look like a v1 project, but history may be broken COUNT.HistoryUpgradeFailed += 1 if (VERBOSE_LOGGING) { console.log( @@ -61,16 +49,25 @@ async function processProject(project) { } has a history upgrade failure recorded` ) } + return } else if (project.overleaf.history.conversionFailed) { COUNT.HistoryConversionFailed += 1 if (VERBOSE_LOGGING) { console.log( `project ${ project[VERBOSE_PROJECT_NAMES ? 'name' : '_id'] - } has a history upgrade failure recorded` + } has a history conversion failure recorded` ) } - } else if (project.overleaf.history.display) { + return + } + } + if ( + project.overleaf && + project.overleaf.history && + project.overleaf.history.id + ) { + if (project.overleaf.history.display) { // v2: full project history, do nothing, (query shoudln't include any, but we should stlll check?) COUNT.v2 += 1 if (VERBOSE_LOGGING) {