Skip to content

Commit

Permalink
Merge pull request #267 from autolab/hotfix_csv_assessment_order
Browse files Browse the repository at this point in the history
Fixed CSV and Student Gradebook Ordering
  • Loading branch information
Ilter committed Feb 10, 2015
2 parents d027a56 + 60608aa commit 67331cf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions app/helpers/gradebook_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def gradebook_rows(matrix, course, section = nil, lecture = nil)
row["section"] = cud.section

# TODO: formalize score render stack, consolidate with computed score
course.assessments.each do |a|
course.assessments.ordered.each do |a|
next unless matrix.has_assessment? a.id

cell = matrix.cell(a.id, cud.id)
Expand Down Expand Up @@ -110,7 +110,7 @@ def csv_header(matrix, course)
header = [ "Email", "first_name", "last_name", "Lecture", "Section", "School", "Major", "Year" ]
course.assessment_categories.each do |cat|
next unless matrix.has_category? cat.id
cat.assessments.each do |asmt|
cat.assessments.ordered.each do |asmt|
next unless matrix.has_assessment? asmt.id
header << asmt.name
end
Expand Down Expand Up @@ -146,7 +146,7 @@ def gradebook_csv(matrix, course)
course.assessment_categories.each do |cat|
next unless matrix.has_category? cat.id

cat.assessments.each do |asmt|
cat.assessments.ordered.each do |asmt|
next unless matrix.has_assessment? asmt.id

row << formatted_status(matrix.cell(asmt.id, cud.id)["status"])
Expand Down
2 changes: 1 addition & 1 deletion app/models/assessment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Assessment < ActiveRecord::Base
RELEASED = "start_at < ?"

# Scopes
scope :ordered, -> { order ORDERING }
scope :ordered, -> { order(ORDERING) }
scope :released, ->(as_of = Time.now) { where(RELEASED, as_of) }
scope :unreleased, ->(as_of = Time.now) { where.not(RELEASED, as_of) }

Expand Down
2 changes: 1 addition & 1 deletion app/views/gradebooks/student.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
<th>Final Score</th>
</tr>

<% cat.assessments.each do |asmt| %>
<% cat.assessments.ordered.each do |asmt| %>
<% aud = asmt.aud_for @_cud %>
<tr>
<td>
Expand Down

0 comments on commit 67331cf

Please sign in to comment.