reword peer reviews to be more clear

The verbiage said peer reviews were "due" at a certain
date, but the code was actually using that date to decide
when to *assign* the peer reviews.  This starts the
process of renaming that column.

fixes #4118

Change-Id: I1c476c97495de6fa0c76ff33658b37ffa02e9022
Reviewed-on: https://gerrit.instructure.com/2958
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Brian Whitmer <brian@instructure.com>
This commit is contained in:
Brian Whitmer 2011-04-05 15:00:02 -06:00
parent 528e4aa6e0
commit f71b0b4808
3 changed files with 19 additions and 10 deletions

View File

@ -168,6 +168,7 @@ class Assignment < ActiveRecord::Base
self.mastery_score = [self.mastery_score, self.points_possible].min if self.mastery_score && self.points_possible
self.all_day_date = (zoned_due_at.to_date rescue nil) if !self.all_day_date || self.due_at_changed? || self.all_day_date_changed?
self.submission_types ||= "none"
self.peer_reviews_assign_at = [self.due_at, self.peer_reviews_assign_at].compact.max
self.anonymous_peer_reviews = true if self.peer_reviews
@workflow_state_was = self.workflow_state_was
@points_possible_was = self.points_possible_was
@ -1053,13 +1054,24 @@ class Assignment < ActiveRecord::Base
end
end
if self.peer_reviews_due_at && self.peer_reviews_due_at < Time.now
reviews_due_at = self.peer_reviews_assign_at || self.due_at
if reviews_due_at && reviews_due_at < Time.now
self.peer_reviews_assigned = true
end
self.save
return res
end
# TODO: on a future deploy, rename the column peer_reviews_due_at
# to peer_reviews_assign_at
def peer_reviews_assign_at
peer_reviews_due_at
end
def peer_reviews_assign_at=(val)
peer_reviews_due_at = val
end
def has_peer_reviews?
self.peer_reviews
end
@ -1082,10 +1094,6 @@ class Assignment < ActiveRecord::Base
}
}
# don't really need this scope anymore since we are doing the auto_peer_reviews assigning as a delayed job instead of a poller, but I'll leave it here if it is useful to anyone. -RS
named_scope :to_be_auto_peer_reviewed, lambda {
{:conditions => ['assignments.peer_reviews_assigned != ? AND assignments.peer_reviews = ? AND assignments.due_at < ? AND assignments.automatic_peer_reviews = ?', true, true, Time.now.utc, true], :order => 'assignments.updated_at, assignments.peer_reviews_due_at' }
}
named_scope :include_quiz_and_topic, lambda {
{:include => [:quiz, :discussion_topic] }
}

View File

@ -44,6 +44,6 @@
<a target="_blank" class="button button-sidebar-wide" href="<%= context_url(@context, :speed_grader_context_gradebook_url, :assignment_id => @assignment.id) %>"><%= image_tag "grading_icon.png" %> SpeedGrader</a>
<% end %>
<div class="rs-margin-lr">
<a style="<%= hidden unless @assignment.has_peer_reviews? %>" class="assignment_peer_reviews_link word-bubble" href="<%= context_url(@context, :context_assignment_peer_reviews_url, @assignment.id) %>">Peer Reviews</a>
<a style="<%= hidden unless @assignment.has_peer_reviews? %>" class="assignment_peer_reviews_link button button-sidebar-wide" href="<%= context_url(@context, :context_assignment_peer_reviews_url, @assignment.id) %>"><%= image_tag "word_bubble.png", :alt => "" %> Peer Reviews</a>
</div>
</div>

View File

@ -221,12 +221,13 @@
<tr class="auto_peer_reviews">
<td><%= f.label :peer_review_count, "Reviews Per User:" %></td>
<td><%= f.text_field :peer_review_count, :style => "width: 20px;" %></td>
</tr><tr>
<td><%= f.label :peer_reviews_due_at, "Finish Reviews By:", :style => "float: left;" %></td>
</tr><tr class="auto_peer_reviews">
<td style="vertical-align: top;"><%= f.label :peer_reviews_assign_at, "Assign Reviews:", :style => "float: left;" %></td>
<td>
<div>
<%= f.text_field :peer_reviews_due_at, :value => datetime_string(assignment.peer_reviews_due_at, :due_date), :style => "width: 120px;", :class => "date_field" %>
<%= f.text_field :peer_reviews_assign_at, :value => datetime_string(assignment.peer_reviews_assign_at, :due_date), :style => "width: 120px;", :class => "date_field" %>
</div>
<div style="font-size: 0.8em;">Must come after due date. If blank, uses due date.</div>
</td>
</tr>
</table>
@ -240,7 +241,7 @@
<option value="on_paper" <%= "selected" if (assignment.submission_types == "on_paper") %>>On Paper</option>
</select>
</td>
<td style="width: 10%; vertical-align: top;" class="more_assignment_values">Lock After:</td>
<td style="width: 10%; vertical-align: top;" class="more_assignment_values">Lock Submits After:</td>
<td style="width: 40%; vertical-align: top;" class="more_assignment_values">
<%= f.text_field :lock_at, :value => datetime_string(assignment.lock_at), :style => "width: 120px;", :class => "date_field" %>
</td>