diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 8d5ab7a9b..9f8d25c7e 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -166,7 +166,10 @@ class StudentWorkController < ApplicationController end def new - redirect_to new_user_commit_homework_users_path(homework_id: @homework.id) if @homework.homework_type==2 + if @homework.homework_type==2 + redirect_to new_user_commit_homework_users_path(homework_id: @homework.id) + return + end @user = User.current @student_work = @homework.student_works.where("user_id = ?",User.current.id).first if @student_work.nil? diff --git a/app/views/users/new_user_commit_homework.html.erb b/app/views/users/new_user_commit_homework.html.erb index 0ec78fb39..e4b1db757 100644 --- a/app/views/users/new_user_commit_homework.html.erb +++ b/app/views/users/new_user_commit_homework.html.erb @@ -41,7 +41,7 @@
第<%= @student_work.student_work_tests.count - index%>次测试
<%= test.created_at.to_s(:db) %> diff --git a/public/javascripts/homework.js b/public/javascripts/homework.js index e36c9ed86..6813f90af 100644 --- a/public/javascripts/homework.js +++ b/public/javascripts/homework.js @@ -38,6 +38,9 @@ $(function(){ function(data,status){ tested = true; console.log(data); + if(data.index <=0){ + data.index = $('.ProResultTop').length+1; + } if (typeof cb == 'function') {cb(); return;} @@ -45,7 +48,7 @@ $(function(){ var html=bt('t:result-list',data); $('.ProResult').prepend(html); - if (data.status==0) { + if (data.status==0 && is_test != 'true') { var r=confirm("答题正确,是否立刻提交?"); if (r) { $(".HomeWorkCon form").submit();