在线测试得分是否显示应该分情况

This commit is contained in:
cxt 2017-03-07 11:14:47 +08:00
parent 8f856da568
commit 69e3c8e893
2 changed files with 5 additions and 1 deletions

View File

@ -654,6 +654,10 @@ class ExerciseController < ApplicationController
# 更新提交状态
cur_exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", User.current, @exercise.id).first
cur_exercise_user.update_attributes(:status => 1, :commit_status => 1)
if @exercise.time && @exercise.time != -1
score = calculate_student_score(@exercise, User.current)
cur_exercise_user.update_attributes(:score => score)
end
# 答题过程中需要统计完成量
#@uncomplete_question = get_uncomplete_question(@exercise, User.current)
# 获取改学生的考试得分

View File

@ -47,7 +47,7 @@
<script type="text/javascript">
$(function(){
<% if Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %>
<% if (!@exercise.time.nil? && @exercise.time != -1) || Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %>
$(".student_work_<%= exercise.id%>").mouseenter(function(){
$("#work_click_<%= exercise.id%>").show();
}).mouseleave(function(){