This repository was archived by the owner on Sep 3, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 642
Add Classic Cost Model for Cases and Calculate case costs using both cost models in parallel. #5814
Merged
metroid-samus
merged 10 commits into
main
from
enhancement/parallel-case-cost-model-calculation
Mar 12, 2025
Merged
Add Classic Cost Model for Cases and Calculate case costs using both cost models in parallel. #5814
metroid-samus
merged 10 commits into
main
from
enhancement/parallel-case-cost-model-calculation
Mar 12, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…b for running case costs in parallel.
wssheldon
approved these changes
Mar 12, 2025
wssheldon
reviewed
Mar 12, 2025
Comment on lines
+203
to
220
| def total_cost_classic(self): | ||
| total_cost = 0 | ||
| if self.case_costs: | ||
| for cost in self.case_costs: | ||
| if cost.case_cost_type.model_type == CostModelType.new: | ||
| continue | ||
| total_cost += cost.amount | ||
| return total_cost | ||
|
|
||
| @hybrid_property | ||
| def total_cost_new(self): | ||
| total_cost = 0 | ||
| if self.case_costs: | ||
| for cost in self.case_costs: | ||
| if cost.case_cost_type.model_type == CostModelType.classic: | ||
| continue | ||
| total_cost += cost.amount | ||
| return total_cost |
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: could fail fast here to reduce nesting and improve readability
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements the classic cost model functionality for cases, mirroring the existing incident cost model while adapting for case-specific concepts.
Changes
Core Implementation
Added role-based engagement multipliers for case roles:
Implemented time calculation functions that handle case status transitions:
Cost Calculation
Testing
The implementation includes tests for:
Migration
No migration required. The classic model will begin calculating costs for cases automatically while maintaining the existing new model calculations.
UI
Related PR: #5800