feat(progress): calc started features as ½ complete

This commit is contained in:
ash
2022-06-17 22:39:48 +02:00
parent ac8a9a003d
commit 667f1e6a21
2 changed files with 4 additions and 2 deletions

View File

@@ -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

View File

@@ -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)}%]`;