Pull request 2115: ADG-7924-stats-interval

Squashed commit of the following:

commit 2c7ee92b82087c7dfcb9f6955cc062e1c32d07f8
Merge: 67313ec7d 469857922
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Wed Dec 20 19:04:44 2023 +0300

    Merge branch 'master' into ADG-7924-stats-interval

commit 67313ec7de745b4b1fd6201e127b7237dfe1bc30
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Tue Dec 19 20:02:31 2023 +0300

    all: imp docs

commit f073dc46f18438cbc7d7249c8d623f6fa0e1403c
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Tue Dec 19 18:33:51 2023 +0300

    upd: chlog

commit 109dbb146ad589ee6d3f2b1b8bf4e12b31ccee61
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Tue Dec 19 17:23:58 2023 +0300

    stats: interval
This commit is contained in:
Stanislav Chzhen 2023-12-20 19:16:22 +03:00
parent 4698579227
commit 4bc5c346a7
2 changed files with 6 additions and 1 deletions

View File

@ -33,6 +33,7 @@ NOTE: Add new changes BELOW THIS COMMENT.
### Fixed ### Fixed
- Statistics for 7 days displayed as 168 hours on the dashboard.
- Pre-filling the Edit static lease window with data ([#6534]). - Pre-filling the Edit static lease window with data ([#6534]).
- Names defined in the `/etc/hosts` for a single address family wrongly - Names defined in the `/etc/hosts` for a single address family wrongly
considered undefined for another family ([#6541]). considered undefined for another family ([#6541]).

View File

@ -484,7 +484,7 @@ func (s *StatsCtx) fillCollectedStats(data *StatsResp, units []*unitDB, curID ui
data.TimeUnits = timeUnitsHours data.TimeUnits = timeUnitsHours
daysCount := size / 24 daysCount := size / 24
if daysCount > 7 { if daysCount >= 7 {
size = daysCount size = daysCount
data.TimeUnits = timeUnitsDays 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 // fillCollectedStatsDaily fills data with collected daily statistics. units
// must contain data for the count of days. // 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( func (s *StatsCtx) fillCollectedStatsDaily(
data *StatsResp, data *StatsResp,
units []*unitDB, units []*unitDB,