Skip to content

Commit

Permalink
fix(apps/analytics): ensure that free text questions without sample s…
Browse files Browse the repository at this point in the history
…olution are handled correctly
  • Loading branch information
sjschlapbach committed Dec 3, 2024
1 parent 61754cd commit 4ca93c7
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ def compute_correctness_columns(df_element_instances, row):
return "INCORRECT"

elif element_instance["type"] == "FREE_TEXT":
# if no sample solution is specified, automatically grade as correct
if "solutions" not in options:
return "CORRECT"

# otherwise, check if the response (ignoring capitalization) is included in the list of solutions
response_value = response["value"]
solutions = list(
map(lambda solution: solution.strip().lower(), options["solutions"])
Expand Down

0 comments on commit 4ca93c7

Please sign in to comment.