若测验已截止且学生已提交则在测验列表后面显示“已答”

This commit is contained in:
cxt 2015-12-15 15:37:57 +08:00
parent 0deffdba33
commit 0215e5e38c
2 changed files with 5 additions and 2 deletions

View File

@ -27,7 +27,7 @@ class ExerciseController < ApplicationController
if @is_teacher || User.current.admin?
exercises = @course.exercises.order("created_at asc")
else
exercises = @course.exercises.where("exercise_status <> 1 ").order("created_at asc")
exercises = @course.exercises.where("exercise_status <> 1").order("created_at asc")
end
@exercises = paginateHelper exercises,20 #分页
respond_to do |format|

View File

@ -56,7 +56,10 @@
<!--li><%#= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_st fl c_dblue" %></li>
<li class="pollsbtn_tip fl ml5">已答</li-->
<%#else%>
<%= link_to (index.to_i+1).to_s+". "+exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_st fl c_dblue"%>
<%= link_to (index.to_i+1).to_s+". "+exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_st fl c_dblue"%>
<% if exercise.end_time <= Time.now && has_commit_exercise?(exercise.id, User.current.id) %>
<li class="pollsbtn_tip fl ml5">已答</li>
<% end %>
<%#end%>
<% end%>
<li class="polls_date fr mr10">截止时间:<%= format_time(exercise.end_time.to_s)%></li>