Skip to content

Commit 85c1480

Browse files
committed
fix: its strange, but seems frontend is sending all the data in params
1 parent 3ce7908 commit 85c1480

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

evaluation_function/evaluation.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,25 @@ def evaluation_function(
2727
LFResult with is_correct and feedback_items
2828
"""
2929
try:
30-
# Extract student and expected FSAs from whatever is present
31-
raw_response = response or getattr(params, "response", None) or params.get("response", None)
32-
raw_answer = answer or getattr(params, "answer", None) or params.get("answer", None)
33-
extra_params = params.get("params") or params
30+
# TEMPORARY WORKAROUND: Extract from params if not passed directly
31+
if params is None:
32+
params = {}
3433

35-
if raw_response is None or raw_answer is None:
36-
raise ValueError("Missing FSA data: response or answer is None")
34+
if isinstance(params, dict):
35+
raw_response = response or params.get("response") or {}
36+
raw_answer = answer or params.get("answer") or {}
37+
extra_params = params.get("params") or {}
38+
else:
39+
# If params is not a dict, fallback to empty dict
40+
raw_response = response
41+
raw_answer = answer
42+
extra_params = {}
43+
44+
if not raw_response or not raw_answer:
45+
raise ValueError(
46+
f"Missing FSA data: response or answer is None\n"
47+
f"raw_response: {raw_response}\nraw_answer: {raw_answer}"
48+
)
3749

3850
# Parse FSAs
3951
student_fsa = validate_fsa(raw_response)

0 commit comments

Comments
 (0)