diff --git a/public/assets/js/progress-charts.js b/public/assets/js/progress-charts.js index cca71f3..875507e 100644 --- a/public/assets/js/progress-charts.js +++ b/public/assets/js/progress-charts.js @@ -5,9 +5,10 @@ document.querySelectorAll('.feature-list-wrapper').forEach(progressListElement = const percentageOverride = progressListElement.querySelector('canvas.percentage-chart').dataset.percentageoverride; const allFeatureNodes = progressListElement.querySelectorAll('.feature'); const allDoneFeatureNodes = progressListElement.querySelectorAll('.feature .done'); + const allStartedFeatureNodes = progressListElement.querySelectorAll('.feature .ongoing'); // Use percentage override data attribute if present, else calculate - const progressPercentage = Math.round(percentageOverride) || Math.round(Math.min((allDoneFeatureNodes.length / allFeatureNodes.length) * 100, 100)); + const progressPercentage = Math.round(percentageOverride) || Math.round(Math.min((allDoneFeatureNodes.length + allStartedFeatureNodes.length * 0.5) / allFeatureNodes.length * 100, 100)); const remainingPercentage = 100 - progressPercentage; // Set inner paragraph diff --git a/src/routers/home.js b/src/routers/home.js index 121d58a..f670c00 100644 --- a/src/routers/home.js +++ b/src/routers/home.js @@ -54,7 +54,8 @@ router.get('/', async (request, response) => { cache.sections.forEach(section => { const { not_started, started, completed } = section.progress; - const sectionCompletionPercentage = completed.length / (completed.length + started.length + not_started.length); + // Calculates the completion percentage of the project, and sums it to the total + const sectionCompletionPercentage = (completed.length + started.length * 0.5) / (completed.length + started.length + not_started.length); totalProgress._calc.percentageSum += sectionCompletionPercentage; const sectionTitle = `${section.title} [${Math.round(sectionCompletionPercentage * 100)}%]`;