refactor: remove dead code, DRY calendar navigation and helpers
- Fix Jalali calendar weekday offset in buildCalendarMonth - Remove unused gregorianDateKey function and PairCount field - Replace inline export month title with formatMonthTitle - Extract navMonth helper for prev/next month navigation - Extract sendOrEdit helper for send-vs-edit message pattern - Extract monthGregorianRange helper to simplify editCalendar 3-way switch - Replace export displayDate conversion with formatDateForCalendar
This commit is contained in:
@@ -17,7 +17,6 @@ const (
|
||||
type DailyTotals struct {
|
||||
TotalSeconds int64
|
||||
BreakSeconds int64
|
||||
PairCount int
|
||||
}
|
||||
|
||||
func ComputeDailyTotals(events []db.Event, minBreakThreshold int64, dayStart, dayEnd int64) DailyTotals {
|
||||
@@ -41,7 +40,6 @@ func ComputeDailyTotals(events []db.Event, minBreakThreshold int64, dayStart, da
|
||||
|
||||
var workTotal, breakTotal int64
|
||||
var workStart, breakStart int64
|
||||
pairs := 0
|
||||
state := StateIdle
|
||||
|
||||
for _, e := range sorted {
|
||||
@@ -66,7 +64,6 @@ func ComputeDailyTotals(events []db.Event, minBreakThreshold int64, dayStart, da
|
||||
case StateWorking:
|
||||
workTotal += e.OccurredAt - workStart
|
||||
workStart = 0
|
||||
pairs++
|
||||
breakStart = e.OccurredAt
|
||||
state = StateOnBreak
|
||||
case StateIdle:
|
||||
@@ -81,6 +78,5 @@ func ComputeDailyTotals(events []db.Event, minBreakThreshold int64, dayStart, da
|
||||
return DailyTotals{
|
||||
TotalSeconds: workTotal,
|
||||
BreakSeconds: breakTotal,
|
||||
PairCount: pairs,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user