Skip to content

Commit d4b84b3

Browse files
committed
Clarify business day average label
1 parent 5822685 commit d4b84b3

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

Sources/AgentTally/Presentation/MenuRowsBuilder.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ public enum MenuRowsBuilder {
6868
.disabled("Today: $\(StatusPresenter.displayDollarAmount(for: spending.todayCost))"))
6969
rows.append(
7070
.disabled(
71-
"Month: $\(StatusPresenter.displayDollarAmount(for: spending.monthCost)) (\(state.businessDays) biz days)"
71+
"Month: $\(StatusPresenter.displayDollarAmount(for: spending.monthCost)) (\(businessDaysLabel(state.businessDays)))"
7272
)
7373
)
7474
rows.append(
75-
.disabled("Avg/Day: $\(StatusPresenter.displayDollarAmount(for: spending.avgPerDay))")
75+
.disabled("Avg/Biz Day: $\(StatusPresenter.displayDollarAmount(for: spending.avgPerDay))")
7676
)
7777
rows.append(
7878
.disabled(
@@ -161,4 +161,8 @@ public enum MenuRowsBuilder {
161161

162162
return "AgentTally v\(appVersion)"
163163
}
164+
165+
private static func businessDaysLabel(_ count: Int) -> String {
166+
count == 1 ? "1 business day" : "\(count) business days"
167+
}
164168
}

Tests/MenuRowsHarness.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,12 @@ func testMenuRowsBuilder() throws {
9898
"menu should place the spending source label directly above the spending rows"
9999
)
100100
try expect(
101-
rows.contains(.disabled("Month: $209 (4 biz days)")),
102-
"month cost should round up to the next display dollar"
101+
rows.contains(.disabled("Month: $209 (4 business days)")),
102+
"month cost should round up to the next display dollar and label business days"
103103
)
104104
try expect(
105-
rows.contains(.disabled("Avg/Day: $53")),
106-
"average cost should round up to the next display dollar"
105+
rows.contains(.disabled("Avg/Biz Day: $53")),
106+
"average cost should clarify it is per business day"
107107
)
108108
try expect(
109109
rows.contains(.disabled("Last usage: 40s ago")),
@@ -122,7 +122,7 @@ func testMenuRowsBuilder() throws {
122122
"Codex today cost should be shown"
123123
)
124124
try expect(
125-
rows.contains(.disabled("Month: $40 (4 biz days)")),
125+
rows.contains(.disabled("Month: $40 (4 business days)")),
126126
"Codex month cost should be shown"
127127
)
128128
try expect(

0 commit comments

Comments
 (0)