lml / ost

OpenStax Tutor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

removal of assigned topic exercises causes exception

kjdav opened this issue · comments

The code prevents users from deleting an assigned topic exercise as long as that exercise has been worked by at least one student. But it is still possible to delete assigned Topic Exercises when those exercises haven't been worked by anyone. Deleting an assigned exercises causes the exercise to be removed from the assignment (and preview), and the resulting oprhan SA's cause an exception where the class/assignment can't be accessed.

Eventually would be good to let instructors remove assigned exercises safely, but I'm guessing that is a 3.0 and beyond type task? If true, we should do the following:

  1. Make it so assigned topic exercises can't be deleted, regardless of whether a student worked a corresponding SA or not. Also, return an error message when user attempts to do this, e.g. Exercises cannot be deleted once assigned.
  2. The code already prevents you from deleting an assigned Topic Exercise as long as it has been worked by someone. But there's no error message, so should add one.

Exception: #<NoMethodError: undefined method `tag_list' for nil:NilClass>

Backtrace:

app/models/basic_feedback_condition.rb:102:in applies_to?' app/models/learning_condition.rb:132:inblock in get_feedback_condition'
app/models/learning_condition.rb:132:in get_feedback_condition' app/models/learning_condition.rb:140:inshow_student_exercise_correctness_feedback?'
app/models/learning_condition.rb:136:in block in show_student_assignment_correctness_feedback?' app/models/learning_condition.rb:136:inshow_student_assignment_correctness_feedback?'
app/models/learning_condition.rb:75:in show_correctness_feedback?' app/views/classes/_student_assignments.html.erb:40:inblock (2 levels) in _app_views_classes__student_assignments_html_erb__675462716_97952320'
app/views/classes/_student_assignments.html.erb:32:in each' app/views/classes/_student_assignments.html.erb:32:inblock in _app_views_classes__student_assignments_html_erb__675462716_97952320'
app/helpers/application_helper.rb:59:in block_to_partial' app/helpers/application_helper.rb:108:insection'
app/views/classes/_student_assignments.html.erb:4:in _app_views_classes__student_assignments_html_erb__675462716_97952320' app/views/classes/show.html.erb:211:in_app_views_classes_show_html_erb__749743567_100700610'

Parameters: {"action"=>"show", "controller"=>"classes", "id"=>"22"}