feat: zero-fill missing days in aggregator for continuous chart data

The daily aggregation now iterates from the since date through the
until date and inserts a zero-valued DailyStats entry for any day
not already present in the day map. This ensures sparklines and bar
charts render a continuous time axis with explicit zeros for idle
days, rather than connecting adjacent data points across gaps.

Also switch config file creation to os.OpenFile with explicit 0600
permissions and O_WRONLY|O_CREATE|O_TRUNC flags, matching the intent
of the original os.Create call while making the restricted permission
bits explicit for security.
This commit is contained in:
teernisse
2026-02-19 15:01:26 -05:00
parent 4d46977328
commit 04abdafa9a
2 changed files with 12 additions and 1 deletions

View File

@@ -107,7 +107,7 @@ func Save(cfg Config) error {
return fmt.Errorf("creating config dir: %w", err)
}
f, err := os.Create(ConfigPath())
f, err := os.OpenFile(ConfigPath(), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o600)
if err != nil {
return fmt.Errorf("creating config file: %w", err)
}