Update button elements in selection controls to ensure proper type attribute for improved accessibility
This commit is contained in:
+16
-10
@@ -859,24 +859,30 @@ def exam_migrate_rapids_to_shorts(request, pk):
|
||||
raise PermissionDenied()
|
||||
|
||||
from shorts.models import Question as ShortQuestion
|
||||
created = []
|
||||
skipped = []
|
||||
failed = []
|
||||
|
||||
for rapid in exam.exam_questions.all():
|
||||
try:
|
||||
q = ShortQuestion.from_rapid(rapid)
|
||||
if q is None:
|
||||
# skipped normal
|
||||
continue
|
||||
except Exception:
|
||||
# continue on error
|
||||
skipped.append(str(rapid.id))
|
||||
else:
|
||||
created.append(str(q.id))
|
||||
except Exception as e:
|
||||
failed.append(str(rapid.id))
|
||||
continue
|
||||
|
||||
messages.success(request, "Exam migration attempted. Normal questions were skipped.")
|
||||
if created:
|
||||
messages.success(request, f"Created shorts questions: {', '.join(created)}")
|
||||
if skipped:
|
||||
messages.info(request, f"Skipped normal rapids (not migrated): {', '.join(skipped)}")
|
||||
if failed:
|
||||
messages.error(request, f"Failed to migrate rapids: {', '.join(failed)}")
|
||||
|
||||
# Redirect to the exam overview for shorts if available, otherwise back to rapids exam
|
||||
try:
|
||||
return redirect("shorts:exam_overview", pk=exam.pk)
|
||||
except Exception:
|
||||
return redirect("rapids:exam_overview", pk=exam.pk)
|
||||
# Redirect back to the Rapids exam overview (shorts exam may not exist)
|
||||
return redirect("rapids:exam_overview", pk=exam.pk)
|
||||
|
||||
|
||||
class ExamClone(ExamCloneMixin, ExamCreate):
|
||||
|
||||
Reference in New Issue
Block a user