Skip to content

Commit 67331cf

Browse files
author
Ilter
committed
Merge pull request #267 from autolab/hotfix_csv_assessment_order
Fixed CSV and Student Gradebook Ordering
2 parents d027a56 + 60608aa commit 67331cf

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

app/helpers/gradebook_helper.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def gradebook_rows(matrix, course, section = nil, lecture = nil)
7777
row["section"] = cud.section
7878

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

8383
cell = matrix.cell(a.id, cud.id)
@@ -110,7 +110,7 @@ def csv_header(matrix, course)
110110
header = [ "Email", "first_name", "last_name", "Lecture", "Section", "School", "Major", "Year" ]
111111
course.assessment_categories.each do |cat|
112112
next unless matrix.has_category? cat.id
113-
cat.assessments.each do |asmt|
113+
cat.assessments.ordered.each do |asmt|
114114
next unless matrix.has_assessment? asmt.id
115115
header << asmt.name
116116
end
@@ -146,7 +146,7 @@ def gradebook_csv(matrix, course)
146146
course.assessment_categories.each do |cat|
147147
next unless matrix.has_category? cat.id
148148

149-
cat.assessments.each do |asmt|
149+
cat.assessments.ordered.each do |asmt|
150150
next unless matrix.has_assessment? asmt.id
151151

152152
row << formatted_status(matrix.cell(asmt.id, cud.id)["status"])

app/models/assessment.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Assessment < ActiveRecord::Base
4444
RELEASED = "start_at < ?"
4545

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

app/views/gradebooks/student.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
<th>Final Score</th>
8787
</tr>
8888

89-
<% cat.assessments.each do |asmt| %>
89+
<% cat.assessments.ordered.each do |asmt| %>
9090
<% aud = asmt.aud_for @_cud %>
9191
<tr>
9292
<td>

0 commit comments

Comments
 (0)