mirror of
https://github.com/PretendoNetwork/website.git
synced 2026-08-28 11:36:53 -05:00
feat(progress): calc started features as ½ complete
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)}%]`;
|
||||
|
||||
Reference in New Issue
Block a user