学生测验列表的提示信息

This commit is contained in:
cxt 2015-12-15 16:02:10 +08:00
parent 0215e5e38c
commit d6c2b95858
2 changed files with 14 additions and 14 deletions

View File

@ -60,17 +60,17 @@ class ExerciseController < ApplicationController
else
@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
if @exercise_user.nil?
eu = ExerciseUser.create(:user_id => User.current.id, :exercise_id => @exercise.id, :start_at => Time.now, :status => false)
unless @is_teacher
@exercise_user = ExerciseUser.where("user_id=? and exercise_id=?", User.current.id, @exercise.id).first
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
score = calculate_student_score(@exercise, User.current)
@exercise_user.update_attributes(:score => score)
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)
@exercise_questions = @exercise.exercise_questions
respond_to do |format|
format.html {render :layout => 'base_courses'}
end

View File

@ -38,9 +38,9 @@
$("#show_student_result_div").on('click',show_result);
<% else %>
$("#show_student_result_div").attr("title","截止日期未到,暂不能查看学生答题结果");
$("#student_name_id").attr("title","截止日期未到,暂不能查看学生答题结果");
$("#student_id_id").attr("title","截止日期未到,暂不能查看学生答题结果");
$("#student_class_id").attr("title","截止日期未到,暂不能查看学生答题结果");
$("#student_name_<%= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
$("#student_id_<%= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
$("#student_class_<%= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
<% end %>
});
function show_result() {
@ -56,13 +56,13 @@
<div id="show_student_result_div" style="cursor: pointer;" class="student_work_<%= exercise.id%>">
<li>
<ul class="mt10 fl">
<li class="hworkStName mr15 mt16" title="姓名" id="student_name_id">
<li class="hworkStName mr15 mt16" title="姓名" id="student_name_<%= exercise.id%>">
<%=exercise.user.show_name %>
</li>
<li class="hworkStID mr10 mt16" title="学号" id="student_id_id">
<li class="hworkStID mr10 mt16" title="学号" id="student_id_<%= exercise.id%>">
<%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%>
</li>
<li class="hworkStID mt16" title="班级" id="student_class_id">
<li class="hworkStID mt16" title="班级" id="student_class_<%= exercise.id%>">
--
</li>
</ul>