Skip to content

Commit 7252d55

Browse files
Merge pull request #406 from jinyoungmoonDEV/test
fix: fix CostReport update query filter
2 parents e7a75f1 + 97bd4b3 commit 7252d55

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/spaceone/cost_analysis/service/cost_report_serivce.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,13 +312,15 @@ def _change_status_to_expired(
312312
domain_id: str,
313313
cost_report_config_id: str,
314314
report_month: str,
315+
cost_report_created_at: datetime,
315316
):
316317
cost_report_update_query = {
317318
"filter": [
318319
{"k": "cost_report_config_id", "v": cost_report_config_id, "o": "eq"},
319320
{"k": "report_month", "v": report_month, "o": "eq"},
320321
{"k": "domain_id", "v": domain_id, "o": "eq"},
321322
{"k": "status", "v": "DONE", "o": "eq"},
323+
{"k": "created_at", "v": cost_report_created_at, "o": "lt"},
322324
]
323325
}
324326

@@ -670,13 +672,13 @@ def _persist_cost_reports_by_status(
670672
self.send_cost_report(cost_report_vo)
671673

672674
if self._check_done_cost_report_exist(domain_id, cost_report_config_id, report_month):
673-
self._change_status_to_expired(domain_id, cost_report_config_id, report_month)
675+
self._change_status_to_expired(domain_id, cost_report_config_id, report_month, report_created_at)
674676

675677
self._delete_old_cost_reports(
676678
report_month,
677679
domain_id,
678680
cost_report_config_id,
679-
report_created_at,
681+
report_created_at
680682
)
681683

682684
@staticmethod

0 commit comments

Comments
 (0)