Cached displaynames of users

Added solved state and #comments to index of request_for_comments
Added translations
This commit is contained in:
Ralf Teusner
2016-06-27 16:46:26 +02:00
parent 2a52b66daa
commit 2ff12dbeb6
7 changed files with 39 additions and 6 deletions

View File

@ -25,12 +25,16 @@ class RequestForComment < ActiveRecord::Base
limit 1").first
end
def comments_count
submission.files.map { |file| file.comments.size}.sum
end
def to_s
"RFC-" + self.id.to_s
end
private
def self.row_number_user_sql
select("id, user_id, exercise_id, file_id, question, requested_at, created_at, updated_at, user_type, row_number() OVER (PARTITION BY user_id ORDER BY created_at DESC) as row_number").to_sql
select("id, user_id, exercise_id, file_id, question, requested_at, created_at, updated_at, user_type, solved, row_number() OVER (PARTITION BY user_id ORDER BY created_at DESC) as row_number").to_sql
end
end