在线测验报500、 学生看不到已截止的测验、测验列表的样式调整
This commit is contained in:
parent
eb8e9f32a3
commit
85b11010d2
|
@ -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 => 2).order("created_at asc")
|
||||
exercises = @course.exercises.where("exercise_status <> 1 ").order("created_at asc")
|
||||
end
|
||||
@exercises = paginateHelper exercises,20 #分页
|
||||
respond_to do |format|
|
||||
|
@ -54,41 +54,26 @@ class ExerciseController < ApplicationController
|
|||
end
|
||||
@exercise = Exercise.find params[:id]
|
||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
|
||||
if @exercise.exercise_status != 2 && (!(User.current.allowed_to?(:as_teacher,@course) || User.current.admin?))
|
||||
render_403
|
||||
return
|
||||
end
|
||||
exercise_end = @exercise.end_time > Time.now
|
||||
if @exercise.time == -1
|
||||
@can_edit_excercise = exercise_end
|
||||
else
|
||||
@can_edit_excercise = (!has_commit_exercise?(@exercise.id,User.current.id)&& exercise_end) || User.current.admin?
|
||||
@can_edit_excercise = !has_commit_exercise?(@exercise.id,User.current.id)&& exercise_end
|
||||
end
|
||||
@exercise_user = ExerciseUser.where("user_id=? and exercise_id=?", User.current.id, @exercise.id).first
|
||||
# 学生点击的时候即创建关联,自动保存
|
||||
#eu = ExerciseUser.create(:user_id => User.current, :exercise_id => @exercise.id, :start_at => Time.now, :status => false)
|
||||
|
||||
# 已提交问卷的用户不能再访问该界面
|
||||
=begin
|
||||
if has_commit_exercise?(@exercise.id, User.current.id) && (!User.current.admin?)
|
||||
respond_to do |format|
|
||||
format.html {render :layout => 'base_courses'}
|
||||
end
|
||||
else
|
||||
=end
|
||||
if !@is_teacher && !has_click_exercise?(@exercise.id, User.current.id)
|
||||
eu = ExerciseUser.create(:user_id => User.current.id, :exercise_id => @exercise.id, :start_at => Time.now, :status => false)
|
||||
@exercise_user = ExerciseUser.where("user_id=? and exercise_id=?", User.current.id, @exercise.id).first
|
||||
end
|
||||
# @percent = get_percent(@exercise,User.current)
|
||||
exercise_questions = @exercise.exercise_questions
|
||||
@exercise_questions = paginateHelper exercise_questions,5 #分页
|
||||
score = calculate_student_score(@exercise, User.current)
|
||||
eu = get_exercise_user(@exercise.id, User.current.id)
|
||||
eu.update_attributes(:score => score)
|
||||
respond_to do |format|
|
||||
format.html {render :layout => 'base_courses'}
|
||||
end
|
||||
if @exercise_user.nil?
|
||||
eu = ExerciseUser.create(:user_id => User.current.id, :exercise_id => @exercise.id, :start_at => Time.now, :status => false)
|
||||
@exercise_user = ExerciseUser.where("user_id=? and exercise_id=?", User.current.id, @exercise.id).first
|
||||
end
|
||||
# @percent = get_percent(@exercise,User.current)
|
||||
exercise_questions = @exercise.exercise_questions
|
||||
@exercise_questions = paginateHelper exercise_questions,5 #分页
|
||||
score = calculate_student_score(@exercise, User.current)
|
||||
#eu = get_exercise_user(@exercise.id, User.current.id)
|
||||
@exercise_user.update_attributes(:score => score)
|
||||
respond_to do |format|
|
||||
format.html {render :layout => 'base_courses'}
|
||||
end
|
||||
#end
|
||||
end
|
||||
|
||||
|
|
|
@ -24,11 +24,11 @@
|
|||
<!--<li><%#= link_to "导出", export_exercise_exercise_path(exercise.id,:format => "xls"), :class => "polls_de fr ml5"%></li>-->
|
||||
<%# end%>
|
||||
<% if exercise.exercise_status == 1 %>
|
||||
<li><a href="javascript:" class="pollsbtn btn_pu fr mr5" onclick="exercise_submit(<%= exercise.id%>,<%= exercise.exercise_name.length %>,<%=index.to_i %>);">发布试卷</a></li>
|
||||
<li><a href="javascript:" class="pollsbtn btn_pu fr mr10 ml5" onclick="exercise_submit(<%= exercise.id%>,<%= exercise.exercise_name.length %>,<%=index.to_i %>);">发布试卷</a></li>
|
||||
<% elsif exercise.exercise_status == 2%>
|
||||
<li><a href="javascript:" class="pollsbtn btn_de fr mr5" onclick="republish_exercise(<%= exercise.id%>,<%=index.to_i %>);">取消发布</a></li>
|
||||
<li><a href="javascript:" class="pollsbtn btn_de fr mr10 ml5" onclick="republish_exercise(<%= exercise.id%>,<%=index.to_i %>);">取消发布</a></li>
|
||||
<% else%>
|
||||
<li class="pollsbtn fr mr10 pollsbtn_grey" style="margin-left: 5px;" >发布试卷</li>
|
||||
<li class="pollsbtn fr mr10 pollsbtn_grey ml5">发布试卷</li>
|
||||
<% end%>
|
||||
|
||||
<% if exercise.exercise_status == 1%>
|
||||
|
@ -42,13 +42,16 @@
|
|||
<% if exercise.exercise_status == 1 %>
|
||||
<li><%= link_to l(:button_edit), edit_exercise_path(exercise.id), :class => "polls_de fr ml10"%></li>
|
||||
<li class="polls_date fr"><%=exercise.publish_time.nil? ? "未发布" : "将于"+format_time(exercise.publish_time.to_s)+"发布"%></li>
|
||||
<% else%>
|
||||
<% elsif exercise.exercise_status == 2 %>
|
||||
<li class="polls_de_grey fr ml10" title="未发布的试卷才能进行编辑">编辑</li>
|
||||
<li class="polls_date fr">已发布</li>
|
||||
<% else %>
|
||||
<li class="polls_de_grey fr ml10" title="未发布的试卷才能进行编辑">编辑</li>
|
||||
<li class="polls_date fr">已截止</li>
|
||||
<% end%>
|
||||
|
||||
<% else%>
|
||||
<% if exercise.exercise_status == 2%>
|
||||
<% if exercise.exercise_status != 1%>
|
||||
<%# if has_commit%>
|
||||
<!--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-->
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
<% else %>
|
||||
×
|
||||
<% end %></span><br />
|
||||
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>
|
||||
标准答案:<%= convert_to_char(standard_answer.first.exercise_choice_id.to_s) if !standard_answer.empty? %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="ur_inputs">
|
||||
|
|
|
@ -188,7 +188,7 @@
|
|||
<%= link_to( "", new_poll_path(:polls_type => "Course",:polls_group_id => @course.id), :class => 'courseMenuSetting', :title =>"#{l(:label_new_poll)}") if is_teacher %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% unless show_nav?(User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status=2").count) %>
|
||||
<% unless show_nav?(User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status<>1").count) %>
|
||||
<div class="subNav">
|
||||
<%= link_to "在线测验", exercise_index_path(:course_id => @course.id), :class => " f14 c_blue02"%>
|
||||
<%= link_to "(#{User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status=2").count})", exercise_index_path(:course_id => @course.id), :class => "subnav_num c_orange" %>
|
||||
|
|
Loading…
Reference in New Issue