some cleanup of request for comments. Work in progress.

Noticed a flaw when fetching the last submission, which is caused by timezone differences. First step to solve this.
Existing Request for Comments still need to be updated with their current submissionId, the SQL to do that is not yet finished.
This commit is contained in:
Ralf Teusner
2016-07-04 17:44:22 +02:00
parent 6e7c250ad1
commit 223df2ffa8
7 changed files with 57 additions and 33 deletions

View File

@@ -3,19 +3,12 @@
<p class="list-group-item-text">
<%
user = @request_for_comment.user
submission_id = ActiveRecord::Base.connection.execute("select id from submissions
where exercise_id =
#{@request_for_comment.exercise_id} AND
user_id = #{@request_for_comment.user_id} AND
'#{@request_for_comment.created_at}' > created_at
order by created_at desc
limit 1").first['id'].to_i
submission = Submission.find(submission_id)
submission = @request_for_comment.last_submission_before_creation
%>
<%= user.displayname %> | <%= @request_for_comment.requested_at %>
<%= user.displayname %> | <%= @request_for_comment.requested_at.localtime %>
</p>
<h5>
<u><%= t('activerecord.attributes.exercise.instructions') %>:</u> "<%= @request_for_comment.exercise.description %>"
<u><%= t('activerecord.attributes.exercise.description') %>:</u> "<%= render_markdown(@request_for_comment.exercise.description) %>"
</h5>
<h5>