From 13d4ddb76d85187ef17e00b8704e66dfa3e987d8 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 10 Oct 2017 10:20:53 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E7=9A=84=E6=97=B6=E5=80=99=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E2=80=9C=E6=8A=80=E8=83=BD=E6=A0=87=E7=AD=BE=E2=80=9D=E7=9A=84?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 28 +++++++++++++++++-------- app/views/shixuns/_monitor_tip.html.erb | 5 ++++- app/views/shixuns/publish.js.erb | 2 +- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 6299519b0..a5f3a9782 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -367,16 +367,26 @@ class ShixunsController < ApplicationController # jenkins回调脚本 # gameID 及实训ID def publish + @status = 0 + @position = "" begin - @shixun.update_attributes!(:status => 1) - apply = ApplyAction.where(:container_type => "ApplyShixun", :container_id => @shixun.id).order("created_at desc").first - if apply && apply.status == 0 - @status = 0 - else - ApplyAction.create(:container_type => "ApplyShixun", :container_id => @shixun.id, :user_id => User.current.id, :status => 0) - notes = User.current.show_name.to_s + " 申请发布实训:#{@shixun.name}" - JournalsForMessage.create(:jour_id => 1, :jour_type => 'Principal', :user_id => User.current.id, :notes => notes, :private => 1, :reply_id => 0) - @status = 1 + @shixun.challenges.each do |challenge| + if challenge.challenge_tags.count == 0 + @status = 2 + @position = (@position == "" ? @position : (@position + ",")) + challenge.position.to_s + "关" + end + end + if @status == 0 + @shixun.update_attributes!(:status => 1) + apply = ApplyAction.where(:container_type => "ApplyShixun", :container_id => @shixun.id).order("created_at desc").first + if apply && apply.status == 0 + @status = 0 + else + ApplyAction.create(:container_type => "ApplyShixun", :container_id => @shixun.id, :user_id => User.current.id, :status => 0) + notes = User.current.show_name.to_s + " 申请发布实训:#{@shixun.name}" + JournalsForMessage.create(:jour_id => 1, :jour_type => 'Principal', :user_id => User.current.id, :notes => notes, :private => 1, :reply_id => 0) + @status = 1 + end end rescue Exception => e @jenkin_error = true diff --git a/app/views/shixuns/_monitor_tip.html.erb b/app/views/shixuns/_monitor_tip.html.erb index bb427fb4e..aceb016f1 100644 --- a/app/views/shixuns/_monitor_tip.html.erb +++ b/app/views/shixuns/_monitor_tip.html.erb @@ -8,9 +8,12 @@ <% if result %> <% if @status == 0 %> 已发布过申请,请等待管理员审核 - <% else %> + <% elsif @status == 1 %> 发布申请已提交,请等待管理员的审核
• 我们将在1-2个工作日内完成审核 + <% else %> + 每一个关卡至少需要一个技能标签
+ 第<%= @position %>尚未设置技能标签,请补充 <% end %> <% else %> 实训云平台繁忙(繁忙等级:80) diff --git a/app/views/shixuns/publish.js.erb b/app/views/shixuns/publish.js.erb index b4099d3ae..90ccba95a 100644 --- a/app/views/shixuns/publish.js.erb +++ b/app/views/shixuns/publish.js.erb @@ -1,4 +1,4 @@ -<% unless @status && @status = 1 %> +<% unless @status && @status == 1 %> $("#apply_publish_shixun").attr("data-option", 1); $("#apply_publish_shixun").removeClass("disabled-grey-bg"); <% end %> From 485a10ef702812cc650518e3ef9777ca9007072e Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 10 Oct 2017 10:38:11 +0800 Subject: [PATCH 02/13] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/stages_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/stages_controller.rb b/app/controllers/stages_controller.rb index d653d33a3..e5812e398 100644 --- a/app/controllers/stages_controller.rb +++ b/app/controllers/stages_controller.rb @@ -39,7 +39,7 @@ class StagesController < ApplicationController @stage.name = params[:stage_name] @stage.description = params[:stage_des] ActiveRecord::Base.transaction do - if @stage.save && params[:shixun_id] + if @stage.save begin @stage.stage_shixuns.destroy_all params[:shixun_id].each do |shixun_id| From ea08271e9cec5c2d1f733bc7871a2ab05eabde1d Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 10 Oct 2017 14:29:08 +0800 Subject: [PATCH 03/13] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E7=9A=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/exercise/_exercises_list.html.erb | 30 +++++++++++++++---- .../_homework_index_list.html.erb | 5 ++-- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/app/views/exercise/_exercises_list.html.erb b/app/views/exercise/_exercises_list.html.erb index ed1030a52..6f4a971f4 100644 --- a/app/views/exercise/_exercises_list.html.erb +++ b/app/views/exercise/_exercises_list.html.erb @@ -16,13 +16,31 @@

创建于<%=time_from_now exercise.created_at %> 更新于<%=time_from_now exercise.updated_at %> - <%= exercise.exercise_users.where("commit_status = 1").count %>已答 - <%= exercise.course.student.count - exercise.exercise_users.where("commit_status = 1").count %>未答 - <%# count = exercise.exercise_users.where("commit_status = 1 and subjective_score = -1").count %> - <%= un_commit_num exercise %>未评 - <%= ex_curr_status[:time] %> - <% if exercise.try(:exercise_status) == 0 && exercise.publish_time %> + <% if exercise.try(:exercise_status) > 1 %> + <% if @is_teacher %> + + <%= link_to exercise.exercise_users.where("commit_status = 1").count, student_exercise_list_exercise_path(exercise, :ex_status => ['1']), :class => "color-orange05 mr3", :target =>"_blank" %> + 已答 + + <%= link_to (exercise.course.student.count - exercise.exercise_users.where("commit_status = 1").count), student_exercise_list_exercise_path(exercise, :ex_status => ['0']), :class => "color-orange05 mr3", :target =>"_blank" %> + 未答 + <%# count = exercise.exercise_users.where("commit_status = 1 and subjective_score = -1").count %> + + <%= link_to un_commit_num(exercise), student_exercise_list_exercise_path(exercise, :ex_comment => ['0']), :class => "color-orange05 mr3", :target =>"_blank" %> + 未评 + <% else %> + + <%= link_to exercise.exercise_users.where("commit_status = 1").count, student_exercise_list_exercise_path(exercise), :class => "color-orange05 mr3", :target =>"_blank" %> + 已答 + + <%= link_to (exercise.course.student.count - exercise.exercise_users.where("commit_status = 1").count), student_exercise_list_exercise_path(exercise), :class => "color-orange05 mr3", :target =>"_blank" %> + 未答 + <% end %> + <% end %> + <% if exercise.try(:exercise_status) == 1 && exercise.publish_time %> 将于 <%= format_time(exercise.publish_time).to_s %> 发布 + <% else %> + <%= ex_curr_status[:time] %> <% end %>

diff --git a/app/views/homework_common/_homework_index_list.html.erb b/app/views/homework_common/_homework_index_list.html.erb index 4013d1c29..4b957b505 100644 --- a/app/views/homework_common/_homework_index_list.html.erb +++ b/app/views/homework_common/_homework_index_list.html.erb @@ -53,10 +53,11 @@ <% end %> <% end %> - <%= homework_curr_status[:time] %> <% if homework_common.homework_detail_manual.try(:comment_status) == 0 && homework_common.publish_time %> 将于 <%= format_time(homework_common.publish_time).to_s %> 发布 - <% end %> + <% else %> + <%= homework_curr_status[:time] %> + <% end %>

<% if @is_teacher %> From 6ef62db5fa777dd01567663fca074d1e36a211e2 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 10 Oct 2017 17:01:59 +0800 Subject: [PATCH 04/13] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=BC=B9=E6=A1=86=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF=E5=AE=8C?= =?UTF-8?q?=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/exercise/_exercises_list.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/exercise/_exercises_list.html.erb b/app/views/exercise/_exercises_list.html.erb index 6f4a971f4..3de19a9a3 100644 --- a/app/views/exercise/_exercises_list.html.erb +++ b/app/views/exercise/_exercises_list.html.erb @@ -60,7 +60,7 @@ <% end %> -
  • 删除
  • +
  • 删除
  • <% end %> From a51f3b760dcb8267dbcf31f8ab408173eb2a1c05 Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 11 Oct 2017 09:40:32 +0800 Subject: [PATCH 05/13] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E7=9A=84=E6=8A=A5=E8=A1=A8=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index c4eaeee70..be2443999 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -106,7 +106,7 @@ class CoursesController < ApplicationController end def shixun_statistics - @homeworks = @course.homework_commons.where("homework_type = 4").order("created_at asc") + @homeworks = @course.homework_commons.where("homework_type = 4 and publish_time < '#{Time.now}'").order("publish_time desc") filename="#{format_date(Time.now)}_#{@course.teacher.show_real_name.to_s}_#{@course.name}_实训数据报告"; respond_to do |format| @@ -2043,14 +2043,14 @@ class CoursesController < ApplicationController user = game.user sheet[current_row,6] = user.login sheet[current_row,7] = user.show_real_name - sheet[current_row,8] = game.final_score ? "+#{game.final_score.to_s} 经验值" : "--" + sheet[current_row,8] = game.final_score ? "+#{game.final_score.to_s}" : "--" count_exp_score = count_exp_score + (game.final_score ? game.final_score.to_i : 0) - sheet[current_row,9] = game.final_score ? (game.answer_open? ? "#{-challenge.score.to_i} 金币" : "+#{game.final_score.to_i} 金币") : "--" + sheet[current_row,9] = game.final_score ? (game.answer_open? ? "#{-challenge.score.to_i}" : "+#{game.final_score.to_i}") : "--" count_gold_score = count_gold_score + (game.final_score ? (game.answer_open? ? -challenge.score.to_i : game.final_score.to_i) : 0) count = game.outputs.count if count > 0 - outputs = game.outputs.where(:test_set_position => 1).order("created_at asc") + outputs = game.outputs.where(:test_set_position => 1).reorder("created_at asc") outputs.each_with_index do |output, k| count_test = count_test + 1 sheet[current_row,10] = "第#{k+1}次评测" @@ -2069,8 +2069,8 @@ class CoursesController < ApplicationController sheet[current_row,6] = "合计" sheet[current_row,7] = games.count.to_s + "人" - sheet[current_row,8] = count_exp_score >= 0 ? "+#{count_exp_score} 经验值" : "-#{count_exp_score} 经验值" - sheet[current_row,9] = count_gold_score >= 0 ? "+#{count_gold_score} 金币" : "-#{count_gold_score} 金币" + sheet[current_row,8] = count_exp_score >= 0 ? "+#{count_exp_score}" : "-#{count_exp_score}" + sheet[current_row,9] = count_gold_score >= 0 ? "+#{count_gold_score}" : "#{count_gold_score}" sheet[current_row,10] = "共#{count_test}次评测" sheet[current_row,11] = game_spend_time((count_time == 0 ? 0 : (count_time / count_test)).to_i)+"/次" sheet.row(current_row).default_format = black From fcd09d3808d2c521ea72565f7a53634493810fe9 Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 11 Oct 2017 10:34:42 +0800 Subject: [PATCH 06/13] =?UTF-8?q?=E6=8C=87=E5=AE=9A=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=8E=88=E6=9D=83=E5=8D=95=E4=BD=8D=E7=9A=84=E6=9F=90=E4=BA=9B?= =?UTF-8?q?=E8=AF=95=E7=94=A8=E7=94=B3=E8=AF=B7=EF=BC=8C=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=8E=88=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/my_controller.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index b2ae7e65c..882f255aa 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -235,7 +235,19 @@ class MyController < ApplicationController if @user.save && @se.save reward_grade(@user, @user.id, 'Account', 500) - # 修改邮箱的时候同步修改到gitlab + + if @se.identity == 1 + school_ids = School.where(:auto_users_trial => 1).map(&:id) + if !@se.student_id.nil? && @se.student_id != "" && !@se.school.nil? && school_ids.include?(@se.school_id) + apply_action = ApplyAction.where(:user_id => @user.id, :container_type => "TrialAuthorization", :status => 0).first + + unless apply_action.blank? + @user.update_attributes(:certification => 1) + apply_action.update_attributes(:status => 1) + end + end + end + # 修改邮箱的时候同步修改到gitlab # if changed_mail || changed_login # g = Gitlab.client # s = Trustie::Gitlab::Sync.new From 1f1f30f3c328a019631294dae9949358b6345c48 Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 11 Oct 2017 11:27:26 +0800 Subject: [PATCH 07/13] =?UTF-8?q?=E8=AF=BE=E5=A0=82=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E7=9A=84=E5=B8=96=E5=AD=90=E5=8A=A8=E6=80=81=EF=BC=8C=E5=9C=A8?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E7=9A=84=E6=97=B6=E5=80=99=E6=B5=8F=E8=A7=88?= =?UTF-8?q?=E6=95=B0+1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/messages_controller.rb | 3 +++ app/controllers/users_controller.rb | 3 +++ app/views/users/reply_detail.js.erb | 4 ---- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index acd042a11..79639da1f 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -283,6 +283,9 @@ class MessagesController < ApplicationController #@replies = @replies[@page * @limit..@page * @limit + 9] @reply = Message.new() @user_activity_id = params[:user_activity_id].blank? ? @topic.id : params[:user_activity_id].to_i + if !params[:user_activity_id].blank? && params[:user_activity_id].to_i != @topic.id + @topic.update_attributes(:visits => @topic.visits + 1) + end respond_to do |format| format.js end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 2a73e648e..d684943db 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -400,6 +400,9 @@ class UsersController < ApplicationController comment.root_id = reply.root_id reply.children << comment @is_project = params[:is_project] if params[:is_project] + + redirect_to message_replies_board_message_path(@root, :board_id => @root.board_id, :user_activity_id => params[:user_activity_id]) + return when 'BlogComment' @root = reply.root comment = BlogComment.new diff --git a/app/views/users/reply_detail.js.erb b/app/views/users/reply_detail.js.erb index 3924a200e..da4d63be8 100644 --- a/app/views/users/reply_detail.js.erb +++ b/app/views/users/reply_detail.js.erb @@ -63,8 +63,4 @@ $("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(re $("#discusses_count").html("<%= @discusses_count %>"); <% end %> <% end %> -<% if @discusses_count > 0 %> -$("#discusses_count").html("<%= @discusses_count %>"); - //window.location.href = "<%#= myshixun_game_path(@challenge.current_user_game, :myshixun_id => @challenge.current_user_game.try(:myshixun)) %>"; -<% end %> sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity"); \ No newline at end of file From 82faefdb863d6d4115a4ae322ba789e93ffddb80 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Oct 2017 15:15:51 +0800 Subject: [PATCH 08/13] =?UTF-8?q?=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E7=9A=84=E5=AE=9E=E8=AE=AD=E7=BB=9F=E8=AE=A1=E5=A2=9E?= =?UTF-8?q?=E5=8A=A01=E4=B8=AA=E5=AD=A6=E7=94=9F=E5=8D=95=E4=BD=8D?= =?UTF-8?q?=E7=9A=84=E7=BB=9F=E8=AE=A1=E6=8A=A5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 75 +++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index be2443999..e243306e0 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -2007,6 +2007,81 @@ class CoursesController < ApplicationController blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10 black = Spreadsheet::Format.new :color => :black, :weight => :bold, :size => 10 current_row = 0 + sheet = book.create_worksheet :name => "学院统计" + sheet.row(0).default_format = blue + sheet.row(0).concat(["学生id","学生姓名","作业编号","作业/实训名称","关卡"," 经验值","金币","评测历史","评测时间","评测结果"]) + course.student.each_with_index do |course, i| + user = course.student + current_row += 1 + sheet[current_row, 0] = user.login + sheet[current_row, 1] = user.show_real_name + # 总统计 + count_exp_score = 0 + count_gold_score = 0 + count_test = 0 + count_time = 0 + # end + homeworks.each_with_index do |homework, j| + sheet[current_row, 2] = "# #{j + 1}" + sheet[current_row, 3] = homework.name + shixun = homework.homework_commons_shixuns.shixun if homework.homework_commons_shixuns + if shixun + shixun.challenges.each_with_index do |challenge, k| + sheet[current_row, 4] = "第#{k+1}关" + games = Game.where(:challenge_id => challenge.id, :user_id => user.id) + # 关卡统计 + count_game_exp_score = 0 + count_game_gold_score = 0 + count_game_test = 0 + count_game_time = 0 + # end + if games.count > 0 + games.each do |game| + sheet[current_row, 5] = game.final_score ? "+#{game.final_score.to_s}" : "--" + sheet[current_row, 6] = game.final_score ? (game.answer_open? ? "#{-challenge.score.to_i}" : "+#{game.final_score.to_i}") : "--" + count_exp_score += (game.final_score ? game.final_score.to_i : 0) + count_gold_score += (game.final_score ? (game.answer_open? ? -challenge.score.to_i : game.final_score.to_i) : 0) + count_game_exp_score += (game.final_score ? game.final_score.to_i : 0) + count_game_gold_score += (game.final_score ? (game.answer_open? ? -challenge.score.to_i : game.final_score.to_i) : 0) + count = game.outputs.count + if count > 0 + outputs = game.outputs.where(:test_set_position => 1).reorder("created_at asc") + outputs.each_with_index do |output, k| + count_test += 1 + count_game_test += 1 + sheet[current_row, 7] = "第#{k+1}次评测" + sheet[current_row, 8] = k == 0 ? game_spend_time((output.created_at - game.created_at).to_i) : game_spend_time((output.created_at - outputs[k-1].created_at).to_i) + count_time = count_time + (k == 0 ? (output.created_at - game.created_at).to_i : (output.created_at - outputs[k-1].created_at).to_i) + count_game_time += (k == 0 ? (output.created_at - game.created_at).to_i : (output.created_at - outputs[k-1].created_at).to_i) + sheet[current_row, 9] = game.outputs.where(:query_index => output.query_index).select{|ou| ou.result == false}.count > 0 ? "失败" : "成功" + current_row += 1 + end + else + current_row += 1 + end + end + sheet[current_row,4] = "合计" + sheet[current_row,5] = count_game_exp_score >= 0 ? "+#{count_game_exp_score}" : "-#{count_game_exp_score}" + sheet[current_row,6] = count_game_gold_score >= 0 ? "+#{count_game_gold_score}" : "#{count_game_gold_score}" + sheet[current_row,7] = "共#{count_game_test}次评测" + sheet[current_row,8] = game_spend_time((count_game_time == 0 ? 0 : (count_game_time / count_game_time)).to_i)+"/次" + sheet.row(current_row).default_format = black + current_row += 1 + else + current_row += 1 + end + end + sheet[current_row,2] = "合计" + sheet[current_row,4] = "共#{games.count}" + sheet[current_row,5] = count_exp_score >= 0 ? "+#{count_exp_score}" : "-#{count_exp_score}" + sheet[current_row,6] = count_gold_score >= 0 ? "+#{count_gold_score}" : "#{count_gold_score}" + sheet[current_row,7] = "共#{count_test}次评测" + sheet[current_row,8] = game_spend_time((count_time == 0 ? 0 : (count_time / count_test)).to_i)+"/次" + sheet.row(current_row).default_format = black + end + end + end + homeworks.each_with_index do |homework, i| sheet = book.create_worksheet :name => "第#{i+1}次作业" sheet.row(0).default_format = blue From 570258bd81f9b265395d497ad326cce87dfcb43c Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 11 Oct 2017 15:30:55 +0800 Subject: [PATCH 09/13] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index e243306e0..2a0488117 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -2020,6 +2020,7 @@ class CoursesController < ApplicationController count_gold_score = 0 count_test = 0 count_time = 0 + game_count = 0 # end homeworks.each_with_index do |homework, j| sheet[current_row, 2] = "# #{j + 1}" @@ -2029,6 +2030,7 @@ class CoursesController < ApplicationController shixun.challenges.each_with_index do |challenge, k| sheet[current_row, 4] = "第#{k+1}关" games = Game.where(:challenge_id => challenge.id, :user_id => user.id) + game_count = game_count + games.count # 关卡统计 count_game_exp_score = 0 count_game_gold_score = 0 @@ -2072,7 +2074,7 @@ class CoursesController < ApplicationController end end sheet[current_row,2] = "合计" - sheet[current_row,4] = "共#{games.count}" + sheet[current_row,4] = "共#{game_count}" sheet[current_row,5] = count_exp_score >= 0 ? "+#{count_exp_score}" : "-#{count_exp_score}" sheet[current_row,6] = count_gold_score >= 0 ? "+#{count_gold_score}" : "#{count_gold_score}" sheet[current_row,7] = "共#{count_test}次评测" From c47403efd5dc5993a9c43cc13bbd91cfa4a52d9f Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Oct 2017 16:23:45 +0800 Subject: [PATCH 10/13] =?UTF-8?q?=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E7=9A=84=E5=AE=9E=E8=AE=AD=E7=BB=9F=E8=AE=A1=E5=A2=9E?= =?UTF-8?q?=E5=8A=A01=E4=B8=AA=E5=AD=A6=E7=94=9F=E5=8D=95=E4=BD=8D?= =?UTF-8?q?=E7=9A=84=E7=BB=9F=E8=AE=A1=E6=8A=A5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 48 +++++++++++++-------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 2a0488117..2ef76daf8 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -2011,10 +2011,6 @@ class CoursesController < ApplicationController sheet.row(0).default_format = blue sheet.row(0).concat(["学生id","学生姓名","作业编号","作业/实训名称","关卡"," 经验值","金币","评测历史","评测时间","评测结果"]) course.student.each_with_index do |course, i| - user = course.student - current_row += 1 - sheet[current_row, 0] = user.login - sheet[current_row, 1] = user.show_real_name # 总统计 count_exp_score = 0 count_gold_score = 0 @@ -2022,7 +2018,17 @@ class CoursesController < ApplicationController count_time = 0 game_count = 0 # end + user = course.student + current_row += 1 + sheet[current_row, 0] = user.login + sheet[current_row, 1] = user.show_real_name homeworks.each_with_index do |homework, j| + # 关卡统计 + count_game_exp_score = 0 + count_game_gold_score = 0 + count_game_test = 0 + count_game_time = 0 + # end sheet[current_row, 2] = "# #{j + 1}" sheet[current_row, 3] = homework.name shixun = homework.homework_commons_shixuns.shixun if homework.homework_commons_shixuns @@ -2031,12 +2037,6 @@ class CoursesController < ApplicationController sheet[current_row, 4] = "第#{k+1}关" games = Game.where(:challenge_id => challenge.id, :user_id => user.id) game_count = game_count + games.count - # 关卡统计 - count_game_exp_score = 0 - count_game_gold_score = 0 - count_game_test = 0 - count_game_time = 0 - # end if games.count > 0 games.each do |game| sheet[current_row, 5] = game.final_score ? "+#{game.final_score.to_s}" : "--" @@ -2062,26 +2062,26 @@ class CoursesController < ApplicationController current_row += 1 end end - sheet[current_row,4] = "合计" - sheet[current_row,5] = count_game_exp_score >= 0 ? "+#{count_game_exp_score}" : "-#{count_game_exp_score}" - sheet[current_row,6] = count_game_gold_score >= 0 ? "+#{count_game_gold_score}" : "#{count_game_gold_score}" - sheet[current_row,7] = "共#{count_game_test}次评测" - sheet[current_row,8] = game_spend_time((count_game_time == 0 ? 0 : (count_game_time / count_game_time)).to_i)+"/次" - sheet.row(current_row).default_format = black - current_row += 1 else current_row += 1 end end - sheet[current_row,2] = "合计" - sheet[current_row,4] = "共#{game_count}" - sheet[current_row,5] = count_exp_score >= 0 ? "+#{count_exp_score}" : "-#{count_exp_score}" - sheet[current_row,6] = count_gold_score >= 0 ? "+#{count_gold_score}" : "#{count_gold_score}" - sheet[current_row,7] = "共#{count_test}次评测" - sheet[current_row,8] = game_spend_time((count_time == 0 ? 0 : (count_time / count_test)).to_i)+"/次" - sheet.row(current_row).default_format = black end + sheet[current_row,4] = "合计" + sheet[current_row,5] = count_game_exp_score >= 0 ? "+#{count_game_exp_score}" : "-#{count_game_exp_score}" + sheet[current_row,6] = count_game_gold_score >= 0 ? "+#{count_game_gold_score}" : "#{count_game_gold_score}" + sheet[current_row,7] = "共#{count_game_test}次评测" + sheet[current_row,8] = game_spend_time((count_game_time == 0 ? 0 : (count_game_time / count_test)).to_i)+"/次" + sheet.row(current_row).default_format = black + current_row += 1 end + sheet[current_row,2] = "合计" + sheet[current_row,4] = "共#{game_count}" + sheet[current_row,5] = count_exp_score >= 0 ? "+#{count_exp_score}" : "-#{count_exp_score}" + sheet[current_row,6] = count_gold_score >= 0 ? "+#{count_gold_score}" : "#{count_gold_score}" + sheet[current_row,7] = "共#{count_test}次评测" + sheet[current_row,8] = game_spend_time((count_time == 0 ? 0 : (count_time / count_test)).to_i)+"/次" + sheet.row(current_row).default_format = black end homeworks.each_with_index do |homework, i| From bbdd86b5da71b729b9456b6188f4157b93992985 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Oct 2017 17:09:42 +0800 Subject: [PATCH 11/13] =?UTF-8?q?=E5=AF=BC=E5=87=BAexcel=E7=9A=84sheet?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 2ef76daf8..bdf25d52b 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -2007,7 +2007,7 @@ class CoursesController < ApplicationController blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10 black = Spreadsheet::Format.new :color => :black, :weight => :bold, :size => 10 current_row = 0 - sheet = book.create_worksheet :name => "学院统计" + sheet = book.create_worksheet :name => "学员统计" sheet.row(0).default_format = blue sheet.row(0).concat(["学生id","学生姓名","作业编号","作业/实训名称","关卡"," 经验值","金币","评测历史","评测时间","评测结果"]) course.student.each_with_index do |course, i| From 7b62bd836f3d64618d134a9e392653210054c1b1 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Oct 2017 17:30:44 +0800 Subject: [PATCH 12/13] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/subjects/show.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/subjects/show.html.erb b/app/views/subjects/show.html.erb index 944631c62..4aea081d4 100644 --- a/app/views/subjects/show.html.erb +++ b/app/views/subjects/show.html.erb @@ -11,8 +11,8 @@ <% end %>

    -
    -
    +
    +
    From 424e8b2d34c23a788dd014bf9d1aa6e0fad9529d Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Oct 2017 17:35:10 +0800 Subject: [PATCH 13/13] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E7=95=8C=E9=9D=A2=E9=87=8D=E7=BD=AE=E7=AD=96=E7=95=A5?= =?UTF-8?q?=E6=9B=B4=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 7ee69d2e9..6b962e35d 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -1591,7 +1591,7 @@ end else #同意 shixun.update_column('status', 2) apply_action.update_attributes(:status => 1, :dealer_id => User.current.id) - shixun_modify_status_without_publish shixun, 1 + add_shixun_modify_status shixun, 1 # 实训发布后则不允许修改代码 # g = Gitlab.client # shixun.shixun_members.each do |member|