Some tidy up in request for comments (bugfix: removed leftover parts of requested_at attribute, some UI changes in comment dialog)

Redirect to open rfc if an exercise has been solved
This commit is contained in:
Ralf Teusner
2016-08-11 18:13:33 +02:00
parent 269c592bb8
commit 6e6c9143cd
10 changed files with 43 additions and 23 deletions

View File

@ -4,16 +4,12 @@ class RequestForComment < ActiveRecord::Base
belongs_to :exercise
belongs_to :file, class_name: 'CodeOcean::File'
before_create :set_requested_timestamp
scope :unsolved, -> { where(solved: [false, nil]) }
def self.last_per_user(n = 5)
from("(#{row_number_user_sql}) as request_for_comments").where("row_number <= ?", n)
end
def set_requested_timestamp
self.requested_at = Time.now
end
# not used right now, finds the last submission for the respective user and exercise.
# might be helpful to check whether the exercise has been solved in the meantime.
def last_submission