fix: address audit findings — nil pointers, timezone bug, dead code, tests, README

- Fix nil pointer dereference in clock.go (guard GetOrCreateSettings and
  GetOrCreateRPGStats errors before accessing fields)
- Fix timezone bug in handleSetBreakMsg (was using system time.Now()
  instead of user's configured timezone)
- Remove dead code: sendExportMonthPicker (unused wrapper)
- Simplify xpForWorkSeconds (xpPerSecond=1, inline to just return sec)
- Extract computeStreakFromDates as pure testable function from
  recalcAggregates; add 6 tests covering empty, current, gaps,
  no-today, long streak, longest-not-current edge cases
- Update README with full feature documentation: RPG, League, Salary,
  Burnout, Work Types, Inline History Editing, all missing commands
This commit is contained in:
2026-06-25 02:25:13 +03:30
parent 5cd811e057
commit af23f80fbb
6 changed files with 207 additions and 72 deletions

View File

@@ -146,7 +146,8 @@ func (h *Handler) handleSetBreakMsg(ctx context.Context, msg *models.Message) {
h.sendText(ctx, msg.Chat.ID, "Error loading profile")
return
}
now := time.Now()
loc := loadLocation(user.Timezone)
now := time.Now().In(loc)
date := now.Format(DateLayout)
day, err := h.DB.GetOrCreateDay(user.ID, date)
if err != nil {