From 67ad2d253ea0b4f5f5a4d3793349b1df9dbf0524 Mon Sep 17 00:00:00 2001 From: Jorrit Schaap <schaap@astron.nl> Date: Tue, 23 Jan 2024 14:18:18 +0100 Subject: [PATCH] TMSS-2890: do/don't add copy annotations to name/description --- SAS/TMSS/backend/src/tmss/tmssapp/tasks.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SAS/TMSS/backend/src/tmss/tmssapp/tasks.py b/SAS/TMSS/backend/src/tmss/tmssapp/tasks.py index 810d42c38df..84caab6a8c3 100644 --- a/SAS/TMSS/backend/src/tmss/tmssapp/tasks.py +++ b/SAS/TMSS/backend/src/tmss/tmssapp/tasks.py @@ -177,7 +177,7 @@ def copy_scheduling_unit_draft(scheduling_unit_draft: models.SchedulingUnitDraft return scheduling_unit_draft_copy -def create_scheduling_unit_draft_from_scheduling_unit_blueprint(scheduling_unit_blueprint: models.SchedulingUnitBlueprint, remove_lofar1_stations=False, remove_lofar2_stations=False) -> models.SchedulingUnitDraft: +def create_scheduling_unit_draft_from_scheduling_unit_blueprint(scheduling_unit_blueprint: models.SchedulingUnitBlueprint, remove_lofar1_stations=False, remove_lofar2_stations=False, add_copy_annotations: bool=True) -> models.SchedulingUnitDraft: """ Create a SchedulingUnitDraft from the SchedulingUnitBlueprint :raises Exception if instantiate fails. @@ -185,8 +185,8 @@ def create_scheduling_unit_draft_from_scheduling_unit_blueprint(scheduling_unit_ logger.debug("create_scheduling_unit_draft_from_scheduling_unit_blueprint(scheduling_unit_blueprint.id=%s)", scheduling_unit_blueprint.pk) with transaction.atomic(): - scheduling_unit_draft_copy = models.SchedulingUnitDraft.objects.create(name="%s (Copy)" % (scheduling_unit_blueprint.name,)[:128], - description="%s (Copy from blueprint id=%s)" % (scheduling_unit_blueprint.description or "<no description>", scheduling_unit_blueprint.id)[:256], + scheduling_unit_draft_copy = models.SchedulingUnitDraft.objects.create(name="%s%s" % (scheduling_unit_blueprint.name, " (Copy)" if add_copy_annotations else "")[:128], + description="%s%s" % (scheduling_unit_blueprint.description or "<no description>", " (Copy from blueprint id=%s)" % (scheduling_unit_blueprint.id,) if add_copy_annotations else "")[:256], scheduling_set=scheduling_unit_blueprint.draft.scheduling_set, observation_strategy_template=scheduling_unit_blueprint.draft.observation_strategy_template, specifications_template=scheduling_unit_blueprint.specifications_template, -- GitLab