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:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user