Skip to content

Commit 7d476db

Browse files
committed
hide bars when it's NAN
1 parent e40a12b commit 7d476db

File tree

1 file changed

+50
-18
lines changed

1 file changed

+50
-18
lines changed

summary-viewer/Contributors.html

Lines changed: 50 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,6 +1042,10 @@ <h2>${name} Details</h2>
10421042
100
10431043
).toFixed(1)
10441044

1045+
// Hide progress bar if percentage is NaN
1046+
const showTasksBar = Number.isFinite(Number(tasksPercentComplete))
1047+
const showFormsBar = Number.isFinite(Number(formsPercentComplete))
1048+
10451049
// Create the card container
10461050
const card = document.createElement("div")
10471051
card.className = "small-card clickable"
@@ -1059,13 +1063,27 @@ <h2>${name} Details</h2>
10591063

10601064
// Add progress bars for tasks and forms
10611065
const progressBars = `
1062-
<div class="progress-container">
1063-
<div class="progress-bar" style="width: ${tasksPercentComplete}%; background-color: ${themeColors.primary3};" title="Tasks: ${tasksPercentComplete}% Completed"></div>
1064-
</div>
1065-
<div class="progress-container">
1066-
<div class="progress-bar" style="width: ${formsPercentComplete}%; background-color: ${themeColors.primary4};" title="Forms: ${formsPercentComplete}% Submitted"></div>
1067-
</div>
1068-
`
1066+
${
1067+
showTasksBar
1068+
? `
1069+
<div class="progress-container">
1070+
<div class="progress-bar"
1071+
style="width: ${tasksPercentComplete}%; background-color: ${themeColors.primary3};"
1072+
title="Tasks: ${tasksPercentComplete}% Completed"></div>
1073+
</div>`
1074+
: ``
1075+
}
1076+
${
1077+
showFormsBar
1078+
? `
1079+
<div class="progress-container">
1080+
<div class="progress-bar"
1081+
style="width: ${formsPercentComplete}%; background-color: ${themeColors.primary4};"
1082+
title="Forms: ${formsPercentComplete}% Submitted"></div>
1083+
</div>`
1084+
: ``
1085+
}
1086+
`
10691087
card.innerHTML += progressBars // Append progress bars to the card
10701088

10711089
// Append the card to the members section and render the chart
@@ -1163,19 +1181,33 @@ <h2>${name} Details</h2>
11631181
chartDiv.id = containerId
11641182
card.appendChild(chartDiv)
11651183

1184+
// NaN guards for progress bars
1185+
const showTeamTasksBar = Number.isFinite(Number(team.tasksPercentComplete))
1186+
const showTeamFormsBar = Number.isFinite(Number(team.formsPercentComplete))
1187+
11661188
// Add progress bars for tasks and forms
11671189
const progressBars = `
1168-
<div class="progress-container">
1169-
<div class="progress-bar"
1170-
style="width: ${team.tasksPercentComplete}%; background-color: ${themeColors.primary3};"
1171-
title="Tasks: ${team.tasksPercentComplete}% Completed"></div>
1172-
</div>
1173-
<div class="progress-container">
1174-
<div class="progress-bar"
1175-
style="width: ${team.formsPercentComplete}%; background-color: ${themeColors.primary4};"
1176-
title="Forms: ${team.formsPercentComplete}% Submitted"></div>
1177-
</div>
1178-
`
1190+
${
1191+
showTeamTasksBar
1192+
? `
1193+
<div class="progress-container">
1194+
<div class="progress-bar"
1195+
style="width: ${team.tasksPercentComplete}%; background-color: ${themeColors.primary3};"
1196+
title="Tasks: ${team.tasksPercentComplete}% Completed"></div>
1197+
</div>`
1198+
: ``
1199+
}
1200+
${
1201+
showTeamFormsBar
1202+
? `
1203+
<div class="progress-container">
1204+
<div class="progress-bar"
1205+
style="width: ${team.formsPercentComplete}%; background-color: ${themeColors.primary4};"
1206+
title="Forms: ${team.formsPercentComplete}% Submitted"></div>
1207+
</div>`
1208+
: ``
1209+
}
1210+
`
11791211
card.innerHTML += progressBars // Append progress bars to the card
11801212

11811213
// Append the card to the teams section and render the chart

0 commit comments

Comments
 (0)