]> git.proxmox.com Git - pmg-api.git/commit
fix #1974: postscreen_stat_graph: go through all entries
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 15 Nov 2018 09:28:01 +0000 (10:28 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 17 Dec 2018 11:06:47 +0000 (12:06 +0100)
commitcb609ca098823734dde590fcf42164f72bbfbf37
treed1d5c2a07e6ab85c726dc886cb20cc37ed7699ce
parent3b6c2b725ec9a59efd6def05435c157dc2ca8204
fix #1974: postscreen_stat_graph: go through all entries

When the GUI requests the values for a whole month
containing a DST switch it will request a range a little
longer or shorter than a month, eg. 31.04166 days for
October 2018 in CET.

Since we use integer math to calculate the number of entries
we expect, the database then returns one more value than
expected, and we forget to fill in the last time value.

For example, requesting Oct. 2018 from CET causes the
equivalent of this query:

  # pmgsh get /statistics/rejectcount --starttime=1538344800 --endtime=$[1541026800] --timespan=86400
  400 Result verification failed
  [31].time: property is missing and it is not optional

Note that:

  $ echo $[(1541026800-1538344800) / (60*60*24.)]
  31.041666666666668

This also happens when for example taking the working range
for the month and simply subtracting 1 second from the
end-time. Our division will then round down by a day while
the database timestamps still cause that day to be included
in the result.
PMG/Statistic.pm