Skip to content

Commit

Permalink
Merge pull request #626 from hansonwu/326_add_column_graders_submissions
Browse files Browse the repository at this point in the history
326 add column graders submissions
  • Loading branch information
jerboaa committed Jan 30, 2012
2 parents ce0c146 + aa85afe commit 9ae7d75
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 2 deletions.
5 changes: 5 additions & 0 deletions app/controllers/submissions_controller.rb
Expand Up @@ -79,6 +79,11 @@ class SubmissionsController < ApplicationController
},
'grace_credits_used' => lambda { |a,b|
return a.grace_period_deduction_sum <=> b.grace_period_deduction_sum
},
'section' => lambda { |a,b|
return -1 if !a.section
return 1 if !b.section
return a.section <=> b.section
}
}
}
Expand Down
1 change: 1 addition & 0 deletions app/helpers/pagination_helper.rb
Expand Up @@ -70,6 +70,7 @@ def get_filtered_items(hash, filter, sort_by, object_hash)
case sort_by
when "group_name" then to_include = [:group]
when "repo_name" then to_include = [:group]
when "section" then to_include = [:group]
when "revision_timestamp" then to_include = [:current_submission_used]
when "marking_state" then to_include = [{:current_submission_used => :result}]
when "total_mark" then to_include = [{:current_submission_used => :result}]
Expand Down
11 changes: 11 additions & 0 deletions app/models/grouping.rb
Expand Up @@ -558,6 +558,17 @@ def all_assigned_criteria(ta_array)
end
return result.map{|a| a.criterion}.uniq
end

# Get the section for this group. Since all students must be in the same section to
# be in the same group, return the section name for the first student with a section.
def section
self.students.each do |student|
if student.has_section?
return student.section.name
end
end
return '-'
end

private

Expand Down
1 change: 1 addition & 0 deletions app/views/graders/_boot.js.erb
Expand Up @@ -11,6 +11,7 @@ document.observe("dom:loaded", function() {
table_id: $('groups'),
headers: {
name: {display: "<%= I18n.t('name') %>", sortable: true},
section: {display: "<%= I18n.t('graders.section') %>", sortable: true},
members: {display: "<%= I18n.t('graders.graders') %>", sortable: true, sort_with: 'nohtml'},
coverage: {display: "<%= I18n.t('graders.coverage') if @assignment.assign_graders_to_criteria %>", sortable: true}
},
Expand Down
4 changes: 4 additions & 0 deletions app/views/graders/table_row/_filter_table_row.html.erb
Expand Up @@ -5,6 +5,10 @@
<% end %>
</td>

<td>
<%= grouping.section %>
</td>

<td>
<%= render :partial => "graders/manage/member",
:locals => {:grouping => grouping } %>
Expand Down
10 changes: 10 additions & 0 deletions app/views/submissions/_submissions_table_sorting_links.html.erb
Expand Up @@ -66,6 +66,16 @@
:sort_by => 'total_mark',
:desc => (sort_by == 'total_mark' && desc.blank?) %>
</th>
<th class="<%="ap_sorting_by" if (sort_by == 'section')%>
<%="ap_sorting_by_desc" if (sort_by == 'section' && !desc.blank?)%>">
<%= link_to I18n.t("browse_submissions.section"),
:id => assignment.id,
:filter => filter,
:page => page,
:per_page => per_page,
:sort_by => 'section',
:desc => (sort_by == 'section' && desc.blank?) %>
</th>
<th>
<%= I18n.t("browse_submissions.can_begin_grading") %>
</th>
Expand Down
Expand Up @@ -128,6 +128,9 @@
<% end %>
<% end %>
</td>
<td>
<%= h(grouping.section) %>
</td>
<td>
<% if Time.now >= assignment.submission_rule.calculate_grouping_collection_time(grouping) %>
<%= image_tag('icons/tick.png') %>
Expand Down
2 changes: 2 additions & 0 deletions config/locales/en.yml
Expand Up @@ -376,6 +376,7 @@ en:
replace: "Replace"
delete: "Delete"
can_begin_grading: "Can begin grading"
section: "Section"

grade_entry_forms:
blank_field: "can't be blank"
Expand Down Expand Up @@ -654,6 +655,7 @@ en:
edit_grader: "Edit a Grader"
manage_graders: "Manage Graders"
graders: "Graders"
section: "Section"
all_graders: "All Graders"
assigned_graders: "Assigned Graders"
possible_graders: "Possible Graders"
Expand Down
8 changes: 6 additions & 2 deletions public/stylesheets/main.css
Expand Up @@ -751,11 +751,15 @@ td.student_total input:hover {
}

#FilterTable_manage_graders_header_name{
width: 37%;
width: 32%;
}

#FilterTable_manage_graders_header_members{
width: 45%;
width: 40%;
}

#FilterTable_manage_graders_header_section{
width: 12%;
}

#FilterTable_manage_graders_header_coverage, #FilterTable_header_coverage{
Expand Down

0 comments on commit 9ae7d75

Please sign in to comment.