mirror of
https://github.com/ansible/awx.git
synced 2026-04-07 02:59:21 -02:30
host_metrics date fix to make summary dates (datetime.datetime) comparable to month: datetime.date (#15704)
* host_metrics date fix * AAP-36839 Remove excess comments * fix extra date() conversion * actual fix * datetime is a library, use datetime.datetime --------- Co-authored-by: Andrea Restle-Lay <arestlel@arestlel-thinkpadx1carbongen9.rht.csb>
This commit is contained in:
committed by
GitHub
parent
c1f0a831ff
commit
86d202456a
@@ -221,7 +221,7 @@ class HostMetricSummaryMonthlyTask:
|
|||||||
self.records_to_update.append(summary)
|
self.records_to_update.append(summary)
|
||||||
return summary
|
return summary
|
||||||
|
|
||||||
def _find_summary(self, month):
|
def _find_summary(self, month: datetime.date):
|
||||||
"""
|
"""
|
||||||
Existing summaries are ordered by month ASC.
|
Existing summaries are ordered by month ASC.
|
||||||
This method is called with month in ascending order too => only 1 traversing is enough
|
This method is called with month in ascending order too => only 1 traversing is enough
|
||||||
@@ -229,6 +229,8 @@ class HostMetricSummaryMonthlyTask:
|
|||||||
summary = None
|
summary = None
|
||||||
while not summary and self.existing_summaries_idx < self.existing_summaries_cnt:
|
while not summary and self.existing_summaries_idx < self.existing_summaries_cnt:
|
||||||
tmp = self.existing_summaries[self.existing_summaries_idx]
|
tmp = self.existing_summaries[self.existing_summaries_idx]
|
||||||
|
if isinstance(tmp, datetime.datetime):
|
||||||
|
tmp = tmp.date()
|
||||||
if tmp.date < month:
|
if tmp.date < month:
|
||||||
self.existing_summaries_idx += 1
|
self.existing_summaries_idx += 1
|
||||||
elif tmp.date == month:
|
elif tmp.date == month:
|
||||||
|
|||||||
Reference in New Issue
Block a user