From 4bc5c346a7efd805745392be602d8997df1a34de Mon Sep 17 00:00:00 2001 From: Stanislav Chzhen Date: Wed, 20 Dec 2023 19:16:22 +0300 Subject: [PATCH] Pull request 2115: ADG-7924-stats-interval Squashed commit of the following: commit 2c7ee92b82087c7dfcb9f6955cc062e1c32d07f8 Merge: 67313ec7d 469857922 Author: Stanislav Chzhen Date: Wed Dec 20 19:04:44 2023 +0300 Merge branch 'master' into ADG-7924-stats-interval commit 67313ec7de745b4b1fd6201e127b7237dfe1bc30 Author: Stanislav Chzhen Date: Tue Dec 19 20:02:31 2023 +0300 all: imp docs commit f073dc46f18438cbc7d7249c8d623f6fa0e1403c Author: Stanislav Chzhen Date: Tue Dec 19 18:33:51 2023 +0300 upd: chlog commit 109dbb146ad589ee6d3f2b1b8bf4e12b31ccee61 Author: Stanislav Chzhen Date: Tue Dec 19 17:23:58 2023 +0300 stats: interval --- CHANGELOG.md | 1 + internal/stats/unit.go | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6067c7ad..1e185910 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ NOTE: Add new changes BELOW THIS COMMENT. ### Fixed +- Statistics for 7 days displayed as 168 hours on the dashboard. - Pre-filling the Edit static lease window with data ([#6534]). - Names defined in the `/etc/hosts` for a single address family wrongly considered undefined for another family ([#6541]). diff --git a/internal/stats/unit.go b/internal/stats/unit.go index 84c6770b..478d9f66 100644 --- a/internal/stats/unit.go +++ b/internal/stats/unit.go @@ -484,7 +484,7 @@ func (s *StatsCtx) fillCollectedStats(data *StatsResp, units []*unitDB, curID ui data.TimeUnits = timeUnitsHours daysCount := size / 24 - if daysCount > 7 { + if daysCount >= 7 { size = daysCount data.TimeUnits = timeUnitsDays } @@ -510,6 +510,10 @@ func (s *StatsCtx) fillCollectedStats(data *StatsResp, units []*unitDB, curID ui // fillCollectedStatsDaily fills data with collected daily statistics. units // must contain data for the count of days. +// +// TODO(s.chzhen): Improve collection of statistics for frontend. Dashboard +// cards should contain statistics for the whole interval without rounding to +// days. func (s *StatsCtx) fillCollectedStatsDaily( data *StatsResp, units []*unitDB,