-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
14.0 t0735 - fcp state not correct when suspension and reactivation lifecycle are on the same date #1844
Conversation
Your pull request should only contain the relevant commit. Could you please rebase your branch onto compassion/14.0 ? |
…cle are on the same date
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.
Don't forget also to run "pre-commit" on your branch. In the modules directory you can type the command "pre-commit run -a".
most_recent_date = max(project.lifecycle_ids.mapped('date')) | ||
most_recent_lifecycles = project.lifecycle_ids.filtered(lambda r: r.date == most_recent_date) | ||
|
||
# Check if there is a lifecyle with type 'Reactivation' in the most recent date | ||
reactivation_lifecycle = next( | ||
(lifecycle for lifecycle in most_recent_lifecycles if lifecycle.type == 'Reactivation'), None) | ||
|
||
# If it exists, lifecycle with type 'Reactivation' is determinant | ||
if reactivation_lifecycle is None: | ||
determinant_lifecycle = most_recent_lifecycles[-1] | ||
else: | ||
determinant_lifecycle = reactivation_lifecycle | ||
project.suspension = False | ||
|
||
if determinant_lifecycle.type == "Suspension": |
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.
Lifecycle events are ordered by date from most recent to oldest. I would suggest it like this to make it shorter.
most_recent_date = max(project.lifecycle_ids.mapped('date')) | |
most_recent_lifecycles = project.lifecycle_ids.filtered(lambda r: r.date == most_recent_date) | |
# Check if there is a lifecyle with type 'Reactivation' in the most recent date | |
reactivation_lifecycle = next( | |
(lifecycle for lifecycle in most_recent_lifecycles if lifecycle.type == 'Reactivation'), None) | |
# If it exists, lifecycle with type 'Reactivation' is determinant | |
if reactivation_lifecycle is None: | |
determinant_lifecycle = most_recent_lifecycles[-1] | |
else: | |
determinant_lifecycle = reactivation_lifecycle | |
project.suspension = False | |
if determinant_lifecycle.type == "Suspension": | |
last_info = project.lifecycle_ids[0] | |
reactivation_lifecycle = project.lifecycle_ids.filtered(lambda r: r.date == last_info.date and r.type == "Reactivation") | |
# If it exists, lifecycle with type 'Reactivation' is determinant | |
determinant_lifecycle = reactivation_lifecycle or last_info | |
if determinant_lifecycle.type == "Suspension": |
Quality Gate failedFailed conditions See analysis details on SonarCloud Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
No description provided.