use submission from model

This commit is contained in:
Ralf Teusner
2016-07-14 16:59:42 +02:00
parent 519581f82a
commit 39a253997d
2 changed files with 2 additions and 5 deletions

View File

@ -1,5 +1,6 @@
class RequestForComment < ActiveRecord::Base class RequestForComment < ActiveRecord::Base
include Creation include Creation
belongs_to :submission
belongs_to :exercise belongs_to :exercise
belongs_to :file, class_name: 'CodeOcean::File' belongs_to :file, class_name: 'CodeOcean::File'
@ -13,10 +14,6 @@ class RequestForComment < ActiveRecord::Base
self.requested_at = Time.now self.requested_at = Time.now
end end
def submission
Submission.find(file.context_id)
end
# not used right now, finds the last submission for the respective user and exercise. # 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. # might be helpful to check whether the exercise has been solved in the meantime.
def last_submission def last_submission

View File

@ -3,7 +3,7 @@
<p class="list-group-item-text"> <p class="list-group-item-text">
<% <%
user = @request_for_comment.user user = @request_for_comment.user
submission = @request_for_comment.last_submission_before_creation submission = @request_for_comment.submission
%> %>
<%= user.displayname %> | <%= @request_for_comment.created_at.localtime %> <%= user.displayname %> | <%= @request_for_comment.created_at.localtime %>
</p> </p>