Skip to content

Commit

Permalink
Fix(MM): Add reason on history for add in m2m relationship (#716)
Browse files Browse the repository at this point in the history
  • Loading branch information
williamputraintan authored Nov 25, 2024
1 parent 53b32d7 commit a0fe733
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ def load_metadata_csv(df: pd.DataFrame, is_emit_eb_events: bool = True, user_id:
try:
subject.individual_set.get(orcabus_id=idv.orcabus_id)
except ObjectDoesNotExist:
subject._change_reason = reason
subject.individual_set.add(idv)

# We update the stats when new idv is linked to sbj, only if this is not recorded as
Expand Down Expand Up @@ -182,6 +183,7 @@ def load_metadata_csv(df: pd.DataFrame, is_emit_eb_events: bool = True, user_id:
try:
project.contact_set.get(orcabus_id=contact.orcabus_id)
except ObjectDoesNotExist:
project._change_reason = reason
project.contact_set.add(contact)

# We update the stats when new ctc is linked to prj, only if this is not recorded as
Expand Down Expand Up @@ -236,8 +238,8 @@ def load_metadata_csv(df: pd.DataFrame, is_emit_eb_events: bool = True, user_id:
try:
library.project_set.get(orcabus_id=project.orcabus_id)
except ObjectDoesNotExist:
library._change_reason = reason
library.project_set.add(project)

# We update the stats when new project is linked to library, only if this is not recorded as
# update/create in previous upsert method
if not is_lib_created and not is_lib_updated:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ def persist_lab_metadata(df: pd.DataFrame, sheet_year: str, is_emit_eb_events: b
try:
subject.individual_set.get(orcabus_id=idv.orcabus_id)
except ObjectDoesNotExist:
subject._change_reason = reason
subject.individual_set.add(idv)

# We update the stats when new idv is linked to sbj, only if this is not recorded as
Expand Down Expand Up @@ -192,6 +193,7 @@ def persist_lab_metadata(df: pd.DataFrame, sheet_year: str, is_emit_eb_events: b
try:
project.contact_set.get(orcabus_id=contact.orcabus_id)
except ObjectDoesNotExist:
project._change_reason = reason
project.contact_set.add(contact)

# We update the stats when new ctc is linked to prj, only if this is not recorded as
Expand Down Expand Up @@ -247,6 +249,7 @@ def persist_lab_metadata(df: pd.DataFrame, sheet_year: str, is_emit_eb_events: b
try:
library.project_set.get(orcabus_id=project.orcabus_id)
except ObjectDoesNotExist:
library._change_reason = reason
library.project_set.add(project)

# We update the stats when new project is linked to library, only if this is not recorded as
Expand Down

0 comments on commit a0fe733

Please sign in to comment.