From 75ede3ce5dd5a3d17da53f9fd964870a84042cd6 Mon Sep 17 00:00:00 2001 From: Marcus Messer Date: Wed, 26 Nov 2025 10:21:53 +0000 Subject: [PATCH 1/2] Made all feedback start with a capital letter automatically. --- app/evaluation_tests.py | 14 ++++++++++++++ app/tests/example_tests.py | 4 ++-- app/utility/evaluation_result_utilities.py | 4 ++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/app/evaluation_tests.py b/app/evaluation_tests.py index 21b8609..a9c3d45 100755 --- a/app/evaluation_tests.py +++ b/app/evaluation_tests.py @@ -94,6 +94,20 @@ def test_physical_qualities_no_tolerance(self): result = evaluation_function(response, answer, params) assert result["is_correct"] is False + def test_physical_qualities_correct_feedback(self): + params = { + "atol": 0.0, + "rtol": 0.0, + "strict_syntax": False, + "physical_quantity": True, + "elementary_functions": True, + } + response = "0.6 Nm" + answer = "0.6 Nm" + result = evaluation_function(response, answer, params) + assert result["is_correct"] is True + assert result["feedback"] == "Response matches answer." + def test_euler_preview_evaluate(self): response = "ER_2" params = Params(is_latex=True, elementary_functions=False, strict_syntax=False) diff --git a/app/tests/example_tests.py b/app/tests/example_tests.py index 4e99325..3a1235f 100644 --- a/app/tests/example_tests.py +++ b/app/tests/example_tests.py @@ -651,8 +651,8 @@ def test_custom_comparison_with_criteria_contains(self, response, value, tags): "2+answer > response_UNKNOWN", ], { - "answer <= response_TRUE": "AAA", - "2+answer > response_UNKNOWN": "BBB", + "answer <= response_TRUE": "Custom response true", + "2+answer > response_UNKNOWN": "Custom response unknown", }, { "symbol_assumptions": "('x', 'real')", diff --git a/app/utility/evaluation_result_utilities.py b/app/utility/evaluation_result_utilities.py index f1c0eb5..19145d3 100644 --- a/app/utility/evaluation_result_utilities.py +++ b/app/utility/evaluation_result_utilities.py @@ -38,6 +38,10 @@ def add_feedback_from_tags(self, tags, graph, custom_feedback=None): feedback_string = graph.criteria[tag].feedback_string_generator(dict()) else: feedback_string = graph.criteria[tag].feedback_string_generator(inputs) + + if feedback_string is not None: + feedback_string = feedback_string.capitalize() + self.add_feedback((tag, feedback_string)) def add_criteria_graph(self, name, graph): From e94d8698d5016a2ee4d6f5dddf3c2b6f14a2bb0e Mon Sep 17 00:00:00 2001 From: Marcus Messer Date: Wed, 26 Nov 2025 11:49:42 +0000 Subject: [PATCH 2/2] Added a condition to only captalise ASCII letters --- app/tests/example_tests.py | 2 +- app/utility/evaluation_result_utilities.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/tests/example_tests.py b/app/tests/example_tests.py index 3a1235f..1b2301d 100644 --- a/app/tests/example_tests.py +++ b/app/tests/example_tests.py @@ -652,7 +652,7 @@ def test_custom_comparison_with_criteria_contains(self, response, value, tags): ], { "answer <= response_TRUE": "Custom response true", - "2+answer > response_UNKNOWN": "Custom response unknown", + "2+answer > response_UNKNOWN": "μ Custom response unknown", }, { "symbol_assumptions": "('x', 'real')", diff --git a/app/utility/evaluation_result_utilities.py b/app/utility/evaluation_result_utilities.py index 19145d3..c7c222f 100644 --- a/app/utility/evaluation_result_utilities.py +++ b/app/utility/evaluation_result_utilities.py @@ -39,7 +39,7 @@ def add_feedback_from_tags(self, tags, graph, custom_feedback=None): else: feedback_string = graph.criteria[tag].feedback_string_generator(inputs) - if feedback_string is not None: + if feedback_string is not None and feedback_string[0].isalpha() and feedback_string[0].isascii(): feedback_string = feedback_string.capitalize() self.add_feedback((tag, feedback_string))