fix score display on quiz moderation; fixes #4003

Also did a couple other tweaks:

  * Fixed the "Time" display when reloading via ajax (wasn't checking for the
    right workflow_state
  * Hide the "Attempts" column on quizzes that have an unlimited # of
    since it doesn't contain any useful data (always "--").

Change-Id: I21182193005d7415594b9c0531c03d619a31c262
Reviewed-on: https://gerrit.instructure.com/2857
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
This commit is contained in:
Zach Wily 2011-03-29 12:31:19 -06:00
parent bace2a985d
commit 1b1d607a9b
3 changed files with 7 additions and 7 deletions

View File

@ -429,7 +429,7 @@ class QuizzesController < ApplicationController
@submissions = @quiz.quiz_submissions.updated_after(last_updated_at).for_user_ids(@students.map(&:id)) @submissions = @quiz.quiz_submissions.updated_after(last_updated_at).for_user_ids(@students.map(&:id))
respond_to do |format| respond_to do |format|
format.html format.html
format.json { render :json => @submissions.to_json(:include_root => false, :exclude => :submission_data, :methods => ['extendable?', :finished_in_words, :attempts_left]) } format.json { render :json => @submissions.to_json(:include_root => false, :except => [:submission_data, :quiz_data], :methods => ['extendable?', :finished_in_words, :attempts_left]) }
end end
end end
end end

View File

@ -12,8 +12,8 @@
<th>Student</th> <th>Student</th>
<th>Attempt</th> <th>Attempt</th>
<th>Time</th> <th>Time</th>
<th>Attempts<br/>Left</th> <th style="<%= hidden if @quiz.allowed_attempts < 0 %>">Attempts<br/>Left</th>
<th>Current<br/>Score</th> <th>Score</th>
<th style="text-align: right;"> <th style="text-align: right;">
<a href="#" class="reload_link"><%= image_tag "ajax-reload.gif" %></a> <a href="#" class="reload_link"><%= image_tag "ajax-reload.gif" %></a>
</th> </th>
@ -57,7 +57,7 @@
</span> </span>
<a href="#" class="extend_time_link no-hover"><%= image_tag "history.png", :alt => "Add Time" %></a> <a href="#" class="extend_time_link no-hover"><%= image_tag "history.png", :alt => "Add Time" %></a>
</td> </td>
<td class="attempts_left number"> <td class="attempts_left number" style="<%= hidden if @quiz.allowed_attempts < 0 %>">
<% if @quiz.allowed_attempts < 0 %> <% if @quiz.allowed_attempts < 0 %>
-- --
<% elsif submission %> <% elsif submission %>
@ -67,7 +67,7 @@
<% end %> <% end %>
</td> </td>
<td class="score_holder"> <td class="score_holder">
<span class="score"><%= submission && submission.score %></span> <span class="score"><%= submission && submission.kept_score %></span>
</td> </td>
<td class="links"> <td class="links">
<span class="unlocked" title="Manually Unlocked" style="<%= hidden unless submission && submission.manually_unlocked %>"><%= image_tag "unlock.png" %></span> <span class="unlocked" title="Manually Unlocked" style="<%= hidden unless submission && submission.manually_unlocked %>"><%= image_tag "unlock.png" %></span>

View File

@ -59,14 +59,14 @@ var moderation = {
moderation.lastUpdatedAt = new Date(Math.max(Date.parse(submission.updated_at), moderation.lastUpdatedAt)); moderation.lastUpdatedAt = new Date(Math.max(Date.parse(submission.updated_at), moderation.lastUpdatedAt));
} }
var state_text = ""; var state_text = "";
if(submission.workflow_state == 'complete' || submission.workflow_state == 'needs_review') { if(submission.workflow_state == 'complete' || submission.workflow_state == 'pending_review') {
state_text = "finished in " + submission.finished_in_words; state_text = "finished in " + submission.finished_in_words;
} }
var data = { var data = {
attempt: submission.attempt || '--', attempt: submission.attempt || '--',
extra_time: submission.extra_time, extra_time: submission.extra_time,
extra_attempts: submission.extra_attempts, extra_attempts: submission.extra_attempts,
score: submission.score score: submission.kept_score
}; };
if(submission.attempts_left == -1) { if(submission.attempts_left == -1) {
data.attempts_left = '--'; data.attempts_left = '--';