diff --git a/src/openforms/submissions/api/serializers.py b/src/openforms/submissions/api/serializers.py index f40fc2be86..341532f99e 100644 --- a/src/openforms/submissions/api/serializers.py +++ b/src/openforms/submissions/api/serializers.py @@ -200,7 +200,11 @@ def create(self, validated_data): return super().create(validated_data) def to_representation(self, instance): - check_submission_logic(instance, unsaved_data=self.context.get("unsaved_data")) + check_submission_logic( + instance, + unsaved_data=self.context.get("unsaved_data"), + current_step=self.context.get("current_step"), + ) return super().to_representation(instance) diff --git a/src/openforms/submissions/api/viewsets.py b/src/openforms/submissions/api/viewsets.py index 05b738f0ff..784183f258 100644 --- a/src/openforms/submissions/api/viewsets.py +++ b/src/openforms/submissions/api/viewsets.py @@ -635,6 +635,10 @@ def logic_check(self, request, *args, **kwargs): submission_state_logic_serializer = SubmissionStateLogicSerializer( instance=SubmissionStateLogic(submission=submission, step=submission_step), - context={"request": request, "unsaved_data": data}, + context={ + "request": request, + "unsaved_data": data, + "current_step": submission_step, + }, ) return Response(submission_state_logic_serializer.data) diff --git a/src/openforms/submissions/form_logic.py b/src/openforms/submissions/form_logic.py index 8691dfc8d4..f48c999c9f 100644 --- a/src/openforms/submissions/form_logic.py +++ b/src/openforms/submissions/form_logic.py @@ -188,7 +188,9 @@ def evaluate_form_logic( def check_submission_logic( - submission: "Submission", unsaved_data: dict | None = None + submission: "Submission", + unsaved_data: dict | None = None, + current_step: "SubmissionStep | None" = None, ) -> None: if getattr(submission, "_form_logic_evaluated", False): return @@ -198,7 +200,7 @@ def check_submission_logic( if not submission_state.form_steps: return - rules = get_rules_to_evaluate(submission) + rules = get_rules_to_evaluate(submission, current_step) # load the data state and all variables submission_variables_state = submission.load_submission_value_variables_state()