From a0c611378bc94e7b8bbc9e37b7ddac6801527578 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Wed, 2 Sep 2015 22:09:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BD=9C=E4=B8=9A=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 5 ++++- app/views/users/new_user_commit_homework.html.erb | 5 ++++- public/javascripts/homework.js | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) 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 @@
-
提交作品
+
<%= @is_test ? '模拟答题' : '提交作品' %>
@@ -86,7 +86,10 @@ <% end %>
+ +
+ <% @student_work.student_work_tests.each_with_index do |test, index| %>

第<%= @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();