-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feature/sckan-273 #354
Feature/sckan-273 #354
Changes from all commits
c87eafa
552c48f
9e26fce
0b50d12
92d9f82
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
from composer.services.cs_ingestion.helpers.getters import get_sex, get_circuit_type, get_functional_circuit_role, \ | ||
get_phenotype, get_projection_phenotype | ||
from composer.services.cs_ingestion.helpers.notes_helper import do_transition_to_invalid_with_note, create_invalid_note, \ | ||
add_ingestion_system_note | ||
add_ingestion_system_note, do_transition_to_exported | ||
from composer.services.cs_ingestion.models import ValidationErrors | ||
|
||
|
||
|
@@ -35,11 +35,11 @@ def create_or_update_connectivity_statement(statement: Dict, sentence: Sentence, | |
reference_uri=reference_uri, | ||
defaults=defaults | ||
) | ||
if not created: | ||
if not created: | ||
if has_changes(connectivity_statement, statement, defaults): | ||
ConnectivityStatement.objects.filter(reference_uri=reference_uri).update(**defaults) | ||
fields_to_refresh = [field for field in defaults.keys() if field != 'state'] | ||
connectivity_statement.refresh_from_db(fields=fields_to_refresh) | ||
defaults_without_state = {field: value for field, value in defaults.items() if field != 'state'} | ||
ConnectivityStatement.objects.filter(reference_uri=reference_uri).update(**defaults_without_state) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @afonsobspinto - keeping the filter instead of the get here - since we cannot update a get (can only update a queryset) also doing
as return value after the update. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe we could do:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mean the following?
since the |
||
connectivity_statement = ConnectivityStatement.objects.get(reference_uri=reference_uri) | ||
add_ingestion_system_note(connectivity_statement) | ||
|
||
validation_errors = statement.get(VALIDATION_ERRORS, ValidationErrors()) | ||
|
@@ -50,6 +50,9 @@ def create_or_update_connectivity_statement(statement: Dict, sentence: Sentence, | |
do_transition_to_invalid_with_note(connectivity_statement, error_message) | ||
else: | ||
create_invalid_note(connectivity_statement, error_message) | ||
else: | ||
if connectivity_statement.state != CSState.EXPORTED: | ||
do_transition_to_exported(connectivity_statement) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move to EXPORTED state (default) if not in EXPORTED state - if there's no validation errors. Reason to include this: (credit thanks - @afonsobspinto : ) ) If a statement was in INVALID state in the past; but if it has no validation errors when running it again in the future, then it should to be moved to EXPORTED state. To cover the fourth edge case here - #354 (review) |
||
|
||
update_many_to_many_fields(connectivity_statement, statement, update_anatomical_entities) | ||
statement[STATE] = connectivity_statement.state | ||
|
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.
NOTE: allow to export from invalid.