diff --git a/app/assets/javascripts/admins/shixuns/index.js b/app/assets/javascripts/admins/shixuns/index.js index 62239aa0e..849e13b5b 100644 --- a/app/assets/javascripts/admins/shixuns/index.js +++ b/app/assets/javascripts/admins/shixuns/index.js @@ -5,9 +5,10 @@ $(document).on('turbolinks:load', function() { allowClear: true }); + let search_form = $(".search-form"); + //导出 $(".shixuns-list-form").on("click","#shixuns-export",function () { - let search_form = $(".search-form"); window.location.href = "/admins/shixuns.xls?" + search_form.serialize(); - }) + }); } }); \ No newline at end of file diff --git a/app/services/homeworks_service.rb b/app/services/homeworks_service.rb index 6659ec760..f6868afba 100644 --- a/app/services/homeworks_service.rb +++ b/app/services/homeworks_service.rb @@ -298,6 +298,9 @@ class HomeworksService else 0 end + else + adjust_score = work.challenge_work_scores.select{|work_score| work_score.challenge_id == game.challenge_id}.last + final_score += adjust_score.score if adjust_score.present? end end diff --git a/app/templates/shixun_work/shixun_work.html.erb b/app/templates/shixun_work/shixun_work.html.erb index f4aec2ea6..a6ef48c3e 100644 --- a/app/templates/shixun_work/shixun_work.html.erb +++ b/app/templates/shixun_work/shixun_work.html.erb @@ -66,15 +66,19 @@ - - + + + + <% @games.each_with_index do |game, index| %> + <% challenge_score = @homework.challenge_score game.challenge_id %> + <% game_score = @work.work_challenge_score game, challenge_score %> + + <% end %> diff --git a/app/views/admins/shixun_settings/index.html.erb b/app/views/admins/shixun_settings/index.html.erb index 4aacfb22e..8fd7a2526 100644 --- a/app/views/admins/shixun_settings/index.html.erb +++ b/app/views/admins/shixun_settings/index.html.erb @@ -22,8 +22,7 @@ <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '输入关键字搜索') %> <%= submit_tag('搜索', class: 'btn btn-primary ml-3','data-disable-with': '搜索中...') %> - <%= link_to "清除",admins_shixun_settings_path(status:nil,tag:nil,search_type:nil,keyword:nil),class: "btn btn-default" %> - + <%= link_to "清除",admins_shixun_settings_path,class: "btn btn-default",'data-disable-with': '清除中...' %>
导出
diff --git a/app/views/admins/shixun_settings/shared/_list.html.erb b/app/views/admins/shixun_settings/shared/_list.html.erb index 14a97d002..0235e5ef8 100644 --- a/app/views/admins/shixun_settings/shared/_list.html.erb +++ b/app/views/admins/shixun_settings/shared/_list.html.erb @@ -1,5 +1,5 @@
关卡任务名称开启时间任务名称开启时间 评测次数 完成时间 耗时 经验值关卡得分调分
<%= index + 1 %> @@ -88,6 +92,8 @@ <%= finished_time game.end_time %> <%= ApplicationController.helpers.time_consuming game %> <%= game.final_score %> / <%= game.challenge.all_score %><%= game_score %> / <%= challenge_score %><%= game_score %>
- + @@ -19,11 +19,15 @@ - <% shixun_settings.each_with_index do |shixun,index| %> - - <% page_no = (@params_page.to_i - 1) * 20 + index + 1 %> - <%= render partial: "admins/shixun_settings/shared/td",locals: {shixun: shixun,page_no:page_no} %> - + <% if shixun_settings.present? %> + <% shixun_settings.each_with_index do |shixun,index| %> + + <% page_no = (@params_page.to_i - 1) * 20 + index + 1 %> + <%= render partial: "admins/shixun_settings/shared/td",locals: {shixun: shixun,page_no:page_no} %> + + <% end %> + <% else %> + <%= render 'admins/shared/no_data_for_table' %> <% end %>
序号 ID 实训名称
diff --git a/app/views/admins/shixuns/index.html.erb b/app/views/admins/shixuns/index.html.erb index 23f0b9400..92fa670ba 100644 --- a/app/views/admins/shixuns/index.html.erb +++ b/app/views/admins/shixuns/index.html.erb @@ -3,7 +3,7 @@ <% end %>
- <%= form_tag(admins_shixuns_path, method: :get, class: 'form-inline search-form',remote:true) do %> + <%= form_tag(admins_shixuns_path, method: :get, class: 'form-inline search-form',id:"shixuns-search-form",remote:true) do %>
<% status_options = [['全部', ''], ["编辑中(#{@editing_shixuns})", "editing"], ["待审核(#{@pending_shixuns})", 'pending'], ["已发布(#{@processed_shixuns})", 'processed'],["已关闭(#{@closed_shixuns})",'closed']] %> @@ -22,7 +22,7 @@
<%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '输入关键字搜索') %> <%= submit_tag('搜索', class: 'btn btn-primary ml-3','data-disable-with': '搜索中...') %> - <%= link_to "清除",admins_shixuns_path(status:nil,tag:nil,search_type:nil,keyword:nil),class: "btn btn-default" %> + <%= link_to "清除",admins_shixuns_path,class: "btn btn-default",id:"shixuns-clear-search",'data-disable-with': '清除中...' %> <% end %> 导出
diff --git a/app/views/admins/shixuns/shared/_list.html.erb b/app/views/admins/shixuns/shared/_list.html.erb index afa457a77..64fb32d56 100644 --- a/app/views/admins/shixuns/shared/_list.html.erb +++ b/app/views/admins/shixuns/shared/_list.html.erb @@ -14,36 +14,40 @@ 操作 - <% shixuns.each_with_index do |shixun,index| %> - - <%= (@params_page.to_i - 1) * 20 + index + 1%> - <%= shixun.identifier %> - <%= link_to overflow_hidden_span(shixun.name), "/shixuns/#{shixun.identifier}", :target => "_blank", :title => shixun.name %> - - <%= shixun.shixun_main_name.nil? ? "--" : shixun.shixun_main_name %> - - - <% if shixun.try(:fork_from).nil? %> - -- - <% else%> - <%= link_to shixun.try(:identifier), shixun_path(shixun.try(:identifier)), target: '_blank'%> - <% end%> - - <%= shixun.challenges.where(:st => 0).size %> - <%= shixun.challenges.where(:st => 1).size %> - <%= shixun_authentication_status shixun %> - <%= link_to shixun.owner.try(:show_real_name),"/users/#{shixun.owner.try(:login)}",target:'_blank' %> - <%= format_time shixun.created_at %> - - class="ml-3 mr5 magic-checkbox" id="join_teacher_homepage_<%= shixun.id %>"> - - - - <% if shixun.status == 0 %> - <%= link_to(l(:button_delete), admins_shixun_path(shixun), :method => :delete, :data => { confirm: "您确定要删除吗?" } ) %> - <% end %> - - + <% if shixuns.present? %> + <% shixuns.each_with_index do |shixun,index| %> + + <%= (@params_page.to_i - 1) * 20 + index + 1%> + <%= shixun.identifier %> + <%= link_to overflow_hidden_span(shixun.name), "/shixuns/#{shixun.identifier}", :target => "_blank", :title => shixun.name %> + + <%= shixun.shixun_main_name.nil? ? "--" : shixun.shixun_main_name %> + + + <% if shixun.try(:fork_from).nil? %> + -- + <% else%> + <%= link_to shixun.try(:identifier), shixun_path(shixun.try(:identifier)), target: '_blank'%> + <% end%> + + <%= shixun.challenges.where(:st => 0).size %> + <%= shixun.challenges.where(:st => 1).size %> + <%= shixun_authentication_status shixun %> + <%= link_to shixun.owner.try(:show_real_name),"/users/#{shixun.owner.try(:login)}",target:'_blank' %> + <%= format_time shixun.created_at %> + + class="ml-3 mr5 magic-checkbox" id="join_teacher_homepage_<%= shixun.id %>"> + + + + <% if shixun.status == 0 %> + <%= link_to(l(:button_delete), admins_shixun_path(shixun), :method => :delete, :data => { confirm: "您确定要删除吗?" } ) %> + <% end %> + + + <% end %> + <% else %> + <%= render 'admins/shared/no_data_for_table' %> <% end %>