diff --git a/summary-viewer/Contributors.html b/summary-viewer/Contributors.html index 7c91198e..a9bf169d 100644 --- a/summary-viewer/Contributors.html +++ b/summary-viewer/Contributors.html @@ -308,6 +308,15 @@ // show details cards function showDetails(type, id, name, detailsSectionId) { const detailsSection = document.getElementById(detailsSectionId) + if (detailsSectionId === "member-details-section") { + const p = document.getElementById("member-placeholder") + if (p) p.style.display = "none" + } + + if (detailsSectionId === "team-details-section") { + const p = document.getElementById("team-placeholder") + if (p) p.style.display = "none" + } if (!detailsSection) { console.error(`Details section with ID "${detailsSectionId}" not found.`) @@ -780,10 +789,18 @@

${name} Details

// Count the unique members const numberOfUniqueMembers = uniqueMemberNames.size document.getElementById("stat-number-1").textContent = numberOfUniqueMembers + const memberPlaceholder = document.getElementById("member-placeholder") + if (memberPlaceholder) { + memberPlaceholder.style.display = numberOfUniqueMembers > 0 ? "block" : "none" + } const uniqueTeamNames = new Set(teamsDataArray.map((team) => team.name)) const numberOfUniqueTeams = teamsWithTaskData.size document.getElementById("stat-number-2").textContent = numberOfUniqueTeams + const teamPlaceholder = document.getElementById("team-placeholder") + if (teamPlaceholder) { + teamPlaceholder.style.display = numberOfUniqueTeams > 0 ? "block" : "none" + } // Extract all roles from project members const memberRoles = jsonData.projectMembers.flatMap((member) => member.roles) @@ -870,7 +887,16 @@

${name} Details

} // Render the donut chart - Plotly.newPlot("roles-donut-chart", roleData, roleLayout) + const hasAnyRoles = roleValues.some((v) => v > 0) + + if (hasAnyRoles) { + Plotly.newPlot("roles-donut-chart", roleData, roleLayout) + } else { + const rolesEl = document.getElementById("roles-donut-chart") + if (rolesEl) { + rolesEl.innerHTML = '

No roles

' + } + } // Count the total number of rows const totalTasks = latestTaskLogs.length @@ -920,7 +946,12 @@

${name} Details

} // Render the chart - Plotly.newPlot("completed-tasks-chart", dataCompletedTasks, layout) + if (totalTasks > 0) { + Plotly.newPlot("completed-tasks-chart", dataCompletedTasks, layout) + } else { + const el = document.getElementById("completed-tasks-chart") + if (el) el.innerHTML = '

No tasks yet

' + } // completed form chart // Count the total number of form tasks @@ -972,7 +1003,12 @@

${name} Details

} // Render the chart - Plotly.newPlot("completed-forms-chart", dataCompletedForms, layoutForm) + if (totalForms > 0) { + Plotly.newPlot("completed-forms-chart", dataCompletedForms, layoutForm) + } else { + const el = document.getElementById("completed-forms-chart") + if (el) el.innerHTML = '

No forms

' + } //get roles individuals const rolesByIndividual = projectMembersDataFrame.map((individual) => { @@ -1042,6 +1078,12 @@

${name} Details

100 ).toFixed(1) + // Hide progress bar if percentage is NaN + const showTasksBar = Number.isFinite(Number(tasksPercentComplete)) + const showFormsBar = Number.isFinite(Number(formsPercentComplete)) + const showNoTasksNote = !showTasksBar + const showNoFormsNote = !showFormsBar + // Create the card container const card = document.createElement("div") card.className = "small-card clickable" @@ -1051,28 +1093,57 @@

${name} Details

title.textContent = member.name card.appendChild(title) - // Create a container for the donut chart - const containerId = `member-role-chart-${member.projectMemberId}` - const chartDiv = document.createElement("div") - chartDiv.id = containerId - card.appendChild(chartDiv) + // Create a container for the donut chart or an empty note + const hasRoles = member.roles.length > 0 + + let chartDiv = null + if (hasRoles) { + chartDiv = document.createElement("div") + chartDiv.id = `member-role-chart-${member.projectMemberId}` + card.appendChild(chartDiv) + } else { + const note = document.createElement("p") + note.className = "empty-note" + note.textContent = "No roles" + card.appendChild(note) + } // Add progress bars for tasks and forms const progressBars = ` -
-
-
-
-
-
- ` + ${ + showTasksBar + ? ` +
+
+
` + : `

No tasks

` + } + ${ + showFormsBar + ? ` +
+
+
` + : `

No forms

` + } +` card.innerHTML += progressBars // Append progress bars to the card - // Append the card to the members section and render the chart + // Append the card to the members section and render the chart if appropriate const memberRoleChartContainer = document.getElementById("members-section") if (memberRoleChartContainer) { memberRoleChartContainer.appendChild(card) - createDonutChart(data, containerId, `${member.name}`) + if (hasRoles) { + createDonutChart( + data, + `member-role-chart-${member.projectMemberId}`, + `${member.name}` + ) + } } else { console.error("Main container for member charts not found!") } @@ -1157,32 +1228,57 @@

${name} Details

title.textContent = team.teamName card.appendChild(title) - // Create a container for the donut chart - const containerId = `team-role-chart-${team.teamId}` - const chartDiv = document.createElement("div") - chartDiv.id = containerId - card.appendChild(chartDiv) + // Create a container for the donut chart or an empty note + const hasRoles = team.roles.length > 0 + + let chartDiv = null + if (hasRoles) { + chartDiv = document.createElement("div") + chartDiv.id = `team-role-chart-${team.teamId}` + card.appendChild(chartDiv) + } else { + const note = document.createElement("p") + note.className = "empty-note" + note.textContent = "No roles" + card.appendChild(note) + } + + // NaN guards for progress bars + const showTeamTasksBar = Number.isFinite(Number(team.tasksPercentComplete)) + const showTeamFormsBar = Number.isFinite(Number(team.formsPercentComplete)) // Add progress bars for tasks and forms const progressBars = ` -
-
-
-
-
-
- ` + ${ + showTeamTasksBar + ? ` +
+
+
` + : `

No tasks

` + } + ${ + showTeamFormsBar + ? ` +
+
+
` + : `

No forms

` + } +` card.innerHTML += progressBars // Append progress bars to the card - // Append the card to the teams section and render the chart + // Append the card to the teams section and render the chart if appropriate const teamRoleChartContainer = document.getElementById("teams-section") if (teamRoleChartContainer) { teamRoleChartContainer.appendChild(card) - createDonutChart(data, containerId, `${team.teamName}`) + if (hasRoles) { + createDonutChart(data, `team-role-chart-${team.teamId}`, `${team.teamName}`) + } } else { console.error("Main container for team charts not found!") } @@ -1625,7 +1721,7 @@

Forms Submitted

-

Select a card to view details about the contributor or team.

+

Select a card to view details about the contributor.

@@ -1643,7 +1739,7 @@

Forms Submitted

-

Select a card to view details about the contributor or team.

+

Select a card to view details about the team.

diff --git a/summary-viewer/Events.html b/summary-viewer/Events.html index 916a1fa4..0d6e0b1c 100644 --- a/summary-viewer/Events.html +++ b/summary-viewer/Events.html @@ -480,6 +480,7 @@

Select Time Interval and Color Scheme

const tickvals = [] const ticktext = [] const allChartData = [] + let rowCount = 0 milestoneDataRaw.forEach((m) => { const milestoneId = String(m.id) @@ -489,6 +490,7 @@

Select Time Interval and Color Scheme

) milestoneTasks.forEach((t) => { + rowCount += 1 const yLabel = `task-${t.id}` tickvals.push(yLabel) ticktext.push("↳ " + t.name) @@ -509,6 +511,7 @@

Select Time Interval and Color Scheme

}) }) + rowCount += 1 tickvals.push(milestoneId) ticktext.push(m.name) @@ -543,8 +546,9 @@

Select Time Interval and Color Scheme

type: "category", automargin: true, tickfont: { size: 14 }, + tickpadding: 8, }, - height: milestoneDataRaw.length * 40 + 100, + height: Math.min(rowCount * 40 + 120, 2000), showlegend: false, margin: { l: 150, r: 30, t: 50, b: 40 }, } @@ -740,7 +744,9 @@

Milestone Gantt Chart

+
-
+
+
+
diff --git a/summary-viewer/Form_Data.html b/summary-viewer/Form_Data.html index 152df4e4..240c3bc0 100644 --- a/summary-viewer/Form_Data.html +++ b/summary-viewer/Form_Data.html @@ -47,12 +47,6 @@