From 08da73b84d2b1224f62a8a160076960383c12666 Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Tue, 30 Jul 2024 16:12:45 +0100 Subject: [PATCH] fixup! improved automatic points adding script --- .../management/commands/add_automatic_points.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/crowdsourcer/management/commands/add_automatic_points.py b/crowdsourcer/management/commands/add_automatic_points.py index 25deb89..39c9232 100644 --- a/crowdsourcer/management/commands/add_automatic_points.py +++ b/crowdsourcer/management/commands/add_automatic_points.py @@ -349,19 +349,19 @@ def handle( response_opts["page_number"] = prev_response.page_number response_opts["evidence"] = prev_response.evidence - if pd.isna(point["evidence notes"]) is not False: + if pd.isna(point["evidence notes"]) is False: response_opts["public_notes"] = point[ "evidence notes" ] else: - if pd.isna(point["page no"]) is not False: + if pd.isna(point["page no"]) is False: response_opts["page_number"] = point["page no"] - if pd.isna(point["evidence link"]) is not False: - response_opts["evidence"] = point["evidence link"] - if pd.isna(point["evidence notes"]) is not False: + if pd.isna(point["evidence link"]) is False: response_opts["public_notes"] = point[ - "evidence notes" + "evidence link" ] + if pd.isna(point["evidence notes"]) is False: + response_opts["evidence"] = point["evidence notes"] if ( pd.isna(point["private notes"]) is not False and point["private notes"] != "n/a" @@ -391,6 +391,11 @@ def handle( response.public_notes = ( point["evidence"] + "\n" + response.public_notes ) + if copy_last_year: + response.public_notes = prev_response.public_notes + response.evidence = prev_response.evidence + response.page_number = prev_response.page_number + if commit: response.save()