Skip to content

Commit

Permalink
Show section due date on student view.
Browse files Browse the repository at this point in the history
Closes #263. Students will now see the section due date where previously
it only showed "Due dates are specified per section".
  • Loading branch information
aimenk authored and jerboaa committed Feb 23, 2012
1 parent d202ba9 commit 777aa58
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/controllers/assignments_controller.rb
Expand Up @@ -109,6 +109,8 @@ def index
@assignments = Assignment.all(:order => :id)
@grade_entry_forms = GradeEntryForm.all(:order => :id)
if current_user.student?
#get the section of current user
@section = current_user.section
# get results for assignments for the current user
@a_id_results = Hash.new()
@assignments.each do |a|
Expand Down
9 changes: 8 additions & 1 deletion app/views/assignments/_list.html.erb
Expand Up @@ -36,7 +36,14 @@
:hours => ((((assignment.due_date - Time.now)/(60 * 60)) % 24).floor)) %>
<% end %>
<% else %>
<%= I18n.t('assignment.section_due_date_type')%>
<% if assignment.section_due_date(@section) < Time.now %>
<strong><%= I18n.l(assignment.section_due_date(@section), :format => :long_date) %></strong>
<% else %>
<strong><%= I18n.l(assignment.section_due_date(@section), :format => :long_date) %></strong><br />
<%= I18n.t(:days_and_hours_left,
:days => ((((assignment.due_date - Time.now)/(60 * 60 * 24)).floor).to_s),
:hours => ((((assignment.due_date - Time.now)/(60 * 60)) % 24).floor)) %>
<% end %>
<% end %>
</td>
<td style="width: 40%;">
Expand Down

0 comments on commit 777aa58

Please sign in to comment.