Skip to content

Commit 60d21a7

Browse files
Thomas StrombergThomas Stromberg
authored andcommitted
web: subtotal alignment improvements
1 parent 0e8980d commit 60d21a7

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

internal/server/static/index.html

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,7 +1516,8 @@ <h3>Why calculate PR costs?</h3>
15161516
}
15171517
output += ' ────────────\n';
15181518
let pct = (b.author.total_cost / b.total_cost) * 100;
1519-
output += ` Subtotal ${formatCurrency(b.author.total_cost).padStart(12)} ${formatTimeUnit(b.author.total_hours)} (${pct.toFixed(1)}%)\n\n`;
1519+
output += formatSubtotalLine("Subtotal", b.author.total_cost, formatTimeUnit(b.author.total_hours), `(${pct.toFixed(1)}%)`);
1520+
output += '\n';
15201521

15211522
// Participants
15221523
if (b.participants && b.participants.length > 0) {
@@ -1546,7 +1547,8 @@ <h3>Why calculate PR costs?</h3>
15461547
});
15471548
output += ' ────────────\n';
15481549
pct = (totalParticipantCost / b.total_cost) * 100;
1549-
output += ` Subtotal ${formatCurrency(totalParticipantCost).padStart(12)} ${formatTimeUnit(totalParticipantHours)} (${pct.toFixed(1)}%)\n\n`;
1550+
output += formatSubtotalLine("Subtotal", totalParticipantCost, formatTimeUnit(totalParticipantHours), `(${pct.toFixed(1)}%)`);
1551+
output += '\n';
15501552
}
15511553

15521554
// Delay and Future Costs - only show if there are any delay costs
@@ -1560,7 +1562,8 @@ <h3>Why calculate PR costs?</h3>
15601562
const mergeDelayHours = b.delay_cost_detail.delivery_delay_hours + b.delay_cost_detail.code_churn_hours + b.delay_cost_detail.automated_updates_hours + b.delay_cost_detail.pr_tracking_hours;
15611563
output += ' ────────────\n';
15621564
pct = (mergeDelayCost / b.total_cost) * 100;
1563-
output += ` Subtotal ${formatCurrency(mergeDelayCost).padStart(12)} ${formatTimeUnit(mergeDelayHours)} (${pct.toFixed(1)}%)\n\n`;
1565+
output += formatSubtotalLine("Subtotal", mergeDelayCost, formatTimeUnit(mergeDelayHours), `(${pct.toFixed(1)}%)`);
1566+
output += '\n';
15641567

15651568
// Future Costs
15661569
const hasFuture = b.delay_cost_detail.rework_percentage > 0 ||
@@ -1591,7 +1594,8 @@ <h3>Why calculate PR costs?</h3>
15911594
b.delay_cost_detail.future_merge_hours + b.delay_cost_detail.future_context_hours;
15921595
output += ' ────────────\n';
15931596
pct = (futureCost / b.total_cost) * 100;
1594-
output += ` Subtotal ${formatCurrency(futureCost).padStart(12)} ${formatTimeUnit(futureHours)} (${pct.toFixed(1)}%)\n\n`;
1597+
output += formatSubtotalLine("Subtotal", futureCost, formatTimeUnit(futureHours), `(${pct.toFixed(1)}%)`);
1598+
output += '\n';
15951599
}
15961600
}
15971601

@@ -1664,7 +1668,8 @@ <h3>Why calculate PR costs?</h3>
16641668
output += formatItemLine("Context Switching", avgAuthorGitHubContextCost, formatTimeUnit(avgAuthorGitHubContextHours), `(${avgAuthorSessions.toFixed(1)} sessions)`);
16651669
output += ' ──────────\n';
16661670
let pct = (avgAuthorTotalCost / avgTotalCost) * 100;
1667-
output += ` Subtotal ${formatCurrency(avgAuthorTotalCost).padStart(15)} ${formatTimeUnit(avgAuthorTotalHours)} (${pct.toFixed(1)}%)\n\n`;
1671+
output += formatSubtotalLine("Subtotal", avgAuthorTotalCost, formatTimeUnit(avgAuthorTotalHours), `(${pct.toFixed(1)}%)`);
1672+
output += '\n';
16681673

16691674
// Participants
16701675
if (e.participant_total_cost > 0) {
@@ -1679,7 +1684,8 @@ <h3>Why calculate PR costs?</h3>
16791684
output += formatItemLine("Context Switching", avgParticipantContextCost, formatTimeUnit(avgParticipantContextHours), `(${avgParticipantSessions.toFixed(1)} sessions)`);
16801685
output += ' ──────────\n';
16811686
pct = (avgParticipantTotalCost / avgTotalCost) * 100;
1682-
output += ` Subtotal ${formatCurrency(avgParticipantTotalCost).padStart(15)} ${formatTimeUnit(avgParticipantTotalHours)} (${pct.toFixed(1)}%)\n\n`;
1687+
output += formatSubtotalLine("Subtotal", avgParticipantTotalCost, formatTimeUnit(avgParticipantTotalHours), `(${pct.toFixed(1)}%)`);
1688+
output += '\n';
16831689
}
16841690

16851691
// Delay Costs
@@ -1700,7 +1706,8 @@ <h3>Why calculate PR costs?</h3>
17001706
const avgMergeDelayHours = avgDeliveryDelayHours + avgCodeChurnHours + avgAutomatedUpdatesHours + avgPRTrackingHours;
17011707
output += ' ──────────\n';
17021708
pct = (avgMergeDelayCost / avgTotalCost) * 100;
1703-
output += ` Subtotal ${formatCurrency(avgMergeDelayCost).padStart(15)} ${formatTimeUnit(avgMergeDelayHours)} (${pct.toFixed(1)}%)\n\n`;
1709+
output += formatSubtotalLine("Subtotal", avgMergeDelayCost, formatTimeUnit(avgMergeDelayHours), `(${pct.toFixed(1)}%)`);
1710+
output += '\n';
17041711

17051712
// Future Costs
17061713
const hasFuture = e.code_churn_cost > 0.01 || e.future_review_cost > 0.01 || e.future_merge_cost > 0.01 || e.future_context_cost > 0.01;
@@ -1726,7 +1733,8 @@ <h3>Why calculate PR costs?</h3>
17261733
const avgFutureHours = avgCodeChurnHours + avgFutureReviewHours + avgFutureMergeHours + avgFutureContextHours;
17271734
output += ' ──────────\n';
17281735
pct = (avgFutureCost / avgTotalCost) * 100;
1729-
output += ` Subtotal ${formatCurrency(avgFutureCost).padStart(15)} ${formatTimeUnit(avgFutureHours)} (${pct.toFixed(1)}%)\n\n`;
1736+
output += formatSubtotalLine("Subtotal", avgFutureCost, formatTimeUnit(avgFutureHours), `(${pct.toFixed(1)}%)`);
1737+
output += '\n';
17301738
}
17311739

17321740
// Average Preventable Loss Total (before grand total)
@@ -1766,7 +1774,8 @@ <h3>Why calculate PR costs?</h3>
17661774

17671775
output += ' ──────────\n';
17681776
let pct = (e.author_total_cost / e.total_cost) * 100;
1769-
output += ` Subtotal ${formatCurrency(e.author_total_cost).padStart(15)} ${formatTimeUnit(e.author_total_hours)} (${pct.toFixed(1)}%)\n\n`;
1777+
output += formatSubtotalLine("Subtotal", e.author_total_cost, formatTimeUnit(e.author_total_hours), `(${pct.toFixed(1)}%)`);
1778+
output += '\n';
17701779

17711780
// Participants
17721781
if (e.participant_total_cost > 0) {
@@ -1781,7 +1790,8 @@ <h3>Why calculate PR costs?</h3>
17811790
output += formatItemLine("Context Switching", e.participant_context_cost, formatTimeUnit(e.participant_context_hours), `(${e.participant_sessions || 0} sessions)`);
17821791
output += ' ──────────\n';
17831792
pct = (e.participant_total_cost / e.total_cost) * 100;
1784-
output += ` Subtotal ${formatCurrency(e.participant_total_cost).padStart(15)} ${formatTimeUnit(e.participant_total_hours)} (${pct.toFixed(1)}%)\n\n`;
1793+
output += formatSubtotalLine("Subtotal", e.participant_total_cost, formatTimeUnit(e.participant_total_hours), `(${pct.toFixed(1)}%)`);
1794+
output += '\n';
17851795
}
17861796

17871797
// Delay Costs
@@ -1807,7 +1817,8 @@ <h3>Why calculate PR costs?</h3>
18071817
const mergeDelayHours = (e.delivery_delay_hours || 0) + (e.code_churn_hours || 0) + (e.automated_updates_hours || 0) + (e.pr_tracking_hours || 0);
18081818
output += ' ──────────\n';
18091819
pct = (mergeDelayCost / e.total_cost) * 100;
1810-
output += ` Subtotal ${formatCurrency(mergeDelayCost).padStart(15)} ${formatTimeUnit(mergeDelayHours)} (${pct.toFixed(1)}%)\n\n`;
1820+
output += formatSubtotalLine("Subtotal", mergeDelayCost, formatTimeUnit(mergeDelayHours), `(${pct.toFixed(1)}%)`);
1821+
output += '\n';
18111822

18121823
// Future Costs
18131824
const hasFuture = (e.code_churn_cost || 0) > 0.01 || (e.future_review_cost || 0) > 0.01 || (e.future_merge_cost || 0) > 0.01 || (e.future_context_cost || 0) > 0.01;
@@ -1832,7 +1843,8 @@ <h3>Why calculate PR costs?</h3>
18321843
const futureHours = (e.code_churn_hours || 0) + (e.future_review_hours || 0) + (e.future_merge_hours || 0) + (e.future_context_hours || 0);
18331844
output += ' ──────────\n';
18341845
pct = (futureCost / e.total_cost) * 100;
1835-
output += ` Subtotal ${formatCurrency(futureCost).padStart(15)} ${formatTimeUnit(futureHours)} (${pct.toFixed(1)}%)\n\n`;
1846+
output += formatSubtotalLine("Subtotal", futureCost, formatTimeUnit(futureHours), `(${pct.toFixed(1)}%)`);
1847+
output += '\n';
18361848
}
18371849

18381850
// Preventable Loss Total (before grand total)

0 commit comments

Comments
 (0)