Skip to content
Snippets Groups Projects
Commit 03e7a799 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

TMSS-207: moved allow_scheduling_observations setting from observation check to generic check

parent f9063640
No related branches found
No related tags found
No related merge requests found
...@@ -319,6 +319,12 @@ def check_prerequities_for_scheduling(subtask: Subtask) -> bool: ...@@ -319,6 +319,12 @@ def check_prerequities_for_scheduling(subtask: Subtask) -> bool:
if predecessor.state.value != SubtaskState.Choices.FINISHED.value: if predecessor.state.value != SubtaskState.Choices.FINISHED.value:
raise SubtaskSchedulingException("Cannot schedule subtask id=%d because its predecessor id=%s in not FINISHED but state=%s" % (subtask.pk, predecessor.pk, predecessor.state.value)) raise SubtaskSchedulingException("Cannot schedule subtask id=%d because its predecessor id=%s in not FINISHED but state=%s" % (subtask.pk, predecessor.pk, predecessor.state.value))
# check if settings allow scheduling observations
setting = Setting.objects.get(name='allow_scheduling_observations')
if not setting.value:
raise SubtaskSchedulingException("Cannot schedule subtask id=%d because setting %s=%s does not allow that." %
(subtask.pk, setting.name, setting.value))
return True return True
def schedule_qafile_subtask(qafile_subtask: Subtask): def schedule_qafile_subtask(qafile_subtask: Subtask):
...@@ -434,13 +440,6 @@ def schedule_observation_subtask(observation_subtask: Subtask): ...@@ -434,13 +440,6 @@ def schedule_observation_subtask(observation_subtask: Subtask):
observation_subtask.specifications_template.type, observation_subtask.specifications_template.type,
SubtaskType.Choices.OBSERVATION.value)) SubtaskType.Choices.OBSERVATION.value))
# check if settings allow scheduling observations
# (not sure if this should be in check_prerequities_for_scheduling() instead....?)
setting = Setting.objects.get(name='allow_scheduling_observations')
if not setting.value:
raise SubtaskSchedulingException("Cannot schedule subtask id=%d because setting %s=%s does not allow that." %
(observation_subtask.pk, setting.name, setting.value))
# step 1: set state to SCHEDULING # step 1: set state to SCHEDULING
observation_subtask.state = SubtaskState.objects.get(value=SubtaskState.Choices.SCHEDULING.value) observation_subtask.state = SubtaskState.objects.get(value=SubtaskState.Choices.SCHEDULING.value)
observation_subtask.save() observation_subtask.save()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment