@@ -588,20 +588,22 @@ def authorquestion():
588588
589589 distractors = mergedDistractors
590590 new_distractors = []
591- added_traces = set ([answer ])
592- ## IF the kind is trace satisfaction_mc, we need to generate traces for each distractor:
593- if kind == "tracesatisfaction_mc" or kind == "tracesatisfaction_yn" :
594- # This is only true for trace_satisaction questions
595- answer_formula = question
596-
597- for distractor in distractors :
598- f = distractor ['formula' ]
599- potential_trace_choices = spotutils .generate_traces (f_accepted = f , f_rejected = answer_formula , max_traces = 10 )
600- trace_choices = [t for t in potential_trace_choices if t not in added_traces ]
601- if len (trace_choices ) > 0 :
602- c = spotutils .weighted_trace_choice (trace_choices )
603- ms = distractor ['code' ]
604- new_distractors .append ({
591+ added_traces = set ([exerciseprocessor .canonicalizeSpotTrace (answer )])
592+ ## IF the kind is trace satisfaction_mc, we need to generate traces for each distractor:
593+ if kind == "tracesatisfaction_mc" or kind == "tracesatisfaction_yn" :
594+ # This is only true for trace_satisaction questions
595+ answer_formula = question
596+
597+ for distractor in distractors :
598+ f = distractor ['formula' ]
599+ potential_trace_choices = spotutils .generate_traces (f_accepted = f , f_rejected = answer_formula , max_traces = 10 )
600+ potential_trace_choices = [exerciseprocessor .canonicalizeSpotTrace (t ) for t in potential_trace_choices ]
601+ potential_trace_choices = list (dict .fromkeys (potential_trace_choices ))
602+ trace_choices = [t for t in potential_trace_choices if t not in added_traces ]
603+ if len (trace_choices ) > 0 :
604+ c = spotutils .weighted_trace_choice (trace_choices )
605+ ms = distractor ['code' ]
606+ new_distractors .append ({
605607 'formula' : c ,
606608 'code' : ms
607609 })
0 commit comments