Fix UsageEnd in CSV reports

This fixes the value of UsageEnd in CSV reports. Currently, it is always
equal to the usage_start of the first processed dataframe + one collect period.

It was an issue with the first condition of _get_usage_end(): given that
_get_usage_start() was always called before _get_usage_end(), the condition
was always true and cached_end was never updated.

Change-Id: Ice8f3b291a2b1327b9b95e1974de1431a93fd29e
Story: 2001414
Task: 6112
This commit is contained in:
Luka Peschke 2017-12-19 11:57:05 +01:00
parent 51d1dd4635
commit 6e470bc37b
2 changed files with 6 additions and 1 deletions

View File

@ -95,7 +95,8 @@ class CSVMapped(csv_base.BaseCSVBackend):
"""Get the end usage of this period.
"""
if self.cached_start == self.usage_start and self.cached_end_str:
if self.cached_start == self.usage_start and self.cached_end_str \
and self.cached_end > self.cached_start:
return self.cached_end_str
else:
usage_end = self.usage_start_dt + datetime.timedelta(

View File

@ -0,0 +1,4 @@
---
fixes:
- |
The value of the UsageEnd field in CSV reports has been fixed.