Skip to content

Conversation

@jinyoungmoonDEV
Copy link
Contributor

Category

  • New feature
  • Bug fix
  • Improvement
  • Refactor
  • etc

Description

  • fix CostReport Date LogIc & add status EXPIRED and some logic

Signed-off-by: jinyoungmoonDEV <moonjinyoung.dev@gmail.com>
…me logic

Signed-off-by: jinyoungmoonDEV <moonjinyoung.dev@gmail.com>
Signed-off-by: jinyoungmoonDEV <moonjinyoung.dev@gmail.com>
@jinyoungmoonDEV jinyoungmoonDEV requested a review from Copilot June 13, 2025 04:52
@jinyoungmoonDEV jinyoungmoonDEV merged commit 4f8ba59 into cloudforet-io:master Jun 13, 2025
3 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refines the cost report scheduling logic, introduces an EXPIRED status for old reports, and adjusts filtering/deletion/update flows to handle expiration.

  • Revise _calculate_report_flags_and_report_month signature and simplify date logic
  • Add _change_status_to_expired method and hook it into the persistence flow
  • Expand status enums and filters to include the new EXPIRED state

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/spaceone/cost_analysis/service/cost_report_serivce.py Fix date-calculation parameters, add EXPIRED transition logic, remove unused code and adjust delete filters
src/spaceone/cost_analysis/model/cost_report/request.py Extend Status literal to include "EXPIRED"
src/spaceone/cost_analysis/model/cost_report/database.py Update status field choices to allow "EXPIRED"
Comments suppressed due to low confidence (2)

src/spaceone/cost_analysis/service/cost_report_serivce.py:340

  • [nitpick] Remove this stale commented filter since it's been replaced by the combined "status": ["DONE","EXPIRED"] rule.
# {"k": "status", "v": "DONE", "o": "not"},

src/spaceone/cost_analysis/model/cost_report/request.py:12

  • Add or update unit tests to cover transitions into and out of the new EXPIRED status to ensure correct behavior.
Status = Literal["IN_PROGRESS", "ADJUSTING", "DONE", "EXPIRED"]

self.send_cost_report(cost_report_vo)

if self._check_done_cost_report_exist(domain_id, cost_report_config_id, report_month):
self._change_status_to_expired(domain_id, cost_report_config_id, report_month)
Copy link

Copilot AI Jun 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The argument order for _change_status_to_expired doesn’t match its signature (report_month, domain_id, cost_report_config_id). Swap them to (report_month, domain_id, cost_report_config_id).

Suggested change
self._change_status_to_expired(domain_id, cost_report_config_id, report_month)
self._change_status_to_expired(report_month, domain_id, cost_report_config_id)

Copilot uses AI. Check for mistakes.
cost_report_update_query
)

for cost_report_vo in cost_reports_vos:
Copy link

Copilot AI Jun 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Iterating and updating each report one by one may be inefficient for large datasets; consider using a bulk update query if supported by the manager.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant