Skip to content

Commit 10b067c

Browse files
Thomas StrombergThomas Stromberg
authored andcommitted
Move time graph to the top
1 parent a97bca4 commit 10b067c

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

internal/server/static/index.html

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,8 +1667,9 @@ <h3>Why calculate PR costs?</h3>
16671667
}
16681668

16691669
// Build the HTML for the timeline
1670-
let html = '<div class="workflow-timeline" style="margin-top: 32px;">';
1671-
html += '<h3 style="font-size: 18px; font-weight: 600; margin-bottom: 16px; color: #1d1d1f;">Workflow State Timeline</h3>';
1670+
let html = '<div class="workflow-timeline" style="margin-top: 32px; margin-bottom: 32px;">';
1671+
html += '<h3 style="font-size: 18px; font-weight: 600; margin-bottom: 4px; color: #1d1d1f;">Workflow State Timeline</h3>';
1672+
html += '<p style="font-size: 14px; color: #6e6e73; margin-bottom: 16px;">How long, on average, is a PR stuck in each state?</p>';
16721673

16731674
// Stacked bar
16741675
html += '<div style="display: flex; width: 100%; height: 40px; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">';
@@ -2090,16 +2091,17 @@ <h3>Why calculate PR costs?</h3>
20902091

20912092
// Generate HTML with efficiency section at top
20922093
let html = formatEfficiencyHTML(efficiencyPct, grade, message, preventableCost, preventableHours, b.total_cost, totalHours, b.pr_duration, false, 0, 0);
2093-
html += '<div class="result-section">';
2094-
html += '<h2>Cost Breakdown</h2>';
2095-
html += '<pre><code>' + formatBreakdown(data) + '</code></pre>';
2096-
html += '</div>';
20972094

20982095
// Add workflow timeline if available (only when using turnserver)
20992096
if (data.seconds_in_state) {
21002097
html += formatWorkflowTimeline(data.seconds_in_state);
21012098
}
21022099

2100+
html += '<div class="result-section">';
2101+
html += '<h2>Cost Breakdown</h2>';
2102+
html += '<pre><code>' + formatBreakdown(data) + '</code></pre>';
2103+
html += '</div>';
2104+
21032105
resultDiv.innerHTML = html;
21042106
}
21052107

@@ -2230,6 +2232,17 @@ <h3>Why calculate PR costs?</h3>
22302232
const avgEfficiencyPct = avgTotalHours > 0 ? 100.0 * (avgTotalHours - avgPreventableHours) / avgTotalHours : 100.0;
22312233
const avgEfficiency = efficiencyGrade(avgEfficiencyPct);
22322234

2235+
// Add workflow timeline if available (only when using turnserver)
2236+
if (data.seconds_in_state) {
2237+
// Calculate average seconds per PR
2238+
const avgSecondsInState = {};
2239+
const sampleCount = e.successful_samples || 1;
2240+
for (const [state, totalSeconds] of Object.entries(data.seconds_in_state)) {
2241+
avgSecondsInState[state] = Math.round(totalSeconds / sampleCount);
2242+
}
2243+
html += formatWorkflowTimeline(avgSecondsInState);
2244+
}
2245+
22332246
// Extrapolated total section
22342247
html += '<div class="result-section">';
22352248
html += `<h2>${days}-day Estimated Costs</h2>`;
@@ -2242,17 +2255,6 @@ <h3>Why calculate PR costs?</h3>
22422255
html += '<pre><code>' + formatAveragePR(e) + '</code></pre>';
22432256
html += '</div>';
22442257

2245-
// Add workflow timeline if available (only when using turnserver)
2246-
if (data.seconds_in_state) {
2247-
// Calculate average seconds per PR
2248-
const avgSecondsInState = {};
2249-
const sampleCount = e.successful_samples || 1;
2250-
for (const [state, totalSeconds] of Object.entries(data.seconds_in_state)) {
2251-
avgSecondsInState[state] = Math.round(totalSeconds / sampleCount);
2252-
}
2253-
html += formatWorkflowTimeline(avgSecondsInState);
2254-
}
2255-
22562258
resultDiv.innerHTML = html;
22572259
resolve();
22582260
return;

0 commit comments

Comments
 (0)