Refactor user redirect after submission

This commit is contained in:
Maximilian Grundke
2017-11-08 15:39:04 +01:00
parent ac14e2d0ca
commit c4cf11f299
3 changed files with 36 additions and 17 deletions

View File

@ -37,6 +37,8 @@ class Exercise < ActiveRecord::Base
@working_time_statistics = nil
MAX_EXERCISE_FEEDBACKS = 20
def average_percentage
if average_score and maximum_score != 0.0 and submissions.exists?(cause: 'submit')
@ -362,4 +364,8 @@ class Exercise < ActiveRecord::Base
end
private :valid_main_file?
def needs_more_feedback
user_exercise_feedbacks.size <= MAX_EXERCISE_FEEDBACKS
end
end