diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 601ebb8a..0e783c74 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -61,6 +61,9 @@ class ApplicationController < ActionController::Base # rescue_from ActionController::InvalidAuthenticityToken, :with => :invalid_authenticity_token rescue_from ::Unauthorized, :with => :deny_access rescue_from ::ActionView::MissingTemplate, :with => :missing_template + rescue_from ::ActiveRecord::RecordNotFound do + render_404 + end include Redmine::Search::Controller include Redmine::MenuManager::MenuController diff --git a/app/controllers/competitions_controller.rb b/app/controllers/competitions_controller.rb index c1d918f6..c890ff6b 100644 --- a/app/controllers/competitions_controller.rb +++ b/app/controllers/competitions_controller.rb @@ -20,6 +20,8 @@ class CompetitionsController < ApplicationController def show @images = @competition.attachments + @user = current_user + @enrolled = @user && @user.logged? && @competition.team_members.exists?(user_id: @user.id) end def index diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index a850d16c..b830776b 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -2404,17 +2404,17 @@ class CoursesController < ApplicationController homeworks.where(:homework_type => 4).each do |homework| sheet1[4,current_col+=1] = "#{homework.name}" end - for i in 0 ... homeworks.where(:homework_type => 1).size - sheet1[4,current_col+=1] = "普通作业第"+(i+1).to_s+"次" + homeworks.where(:homework_type => 1).each do |homework| + sheet1[4,current_col+=1] = "#{homework.name}" end - for i in 0 ... homeworks.where(:homework_type => 3).size - sheet1[4,current_col+=1] = "分组作业第"+(i+1).to_s+"次" + homeworks.where(:homework_type => 3).each do |homework| + sheet1[4,current_col+=1] = "#{homework.name}" end - for i in 0 ... exercises.size - sheet1[4,current_col+=1] = "试卷第"+(i+1).to_s+"次" + exercises.each do |exercise| + sheet1[4,current_col+=1] = "#{exercise.exercise_name}" end - for i in 0 ... tasks.size - sheet1[4,current_col+=1] = "毕设任务第"+(i+1).to_s+"次" + tasks.each do |task| + sheet1[4,current_col+=1] = "#{task.name}" end sheet1[4,current_col+=1] = "实训作业总得分" @@ -2434,7 +2434,7 @@ class CoursesController < ApplicationController sheet1[count_row,column+=1] = member.user.login sheet1[count_row,column+=1] = member.user.mail sheet1[count_row,column+=1] = member.user.user_extensions.student_id - sheet1[count_row,column+=1] = member.course_group_id == 0 ? "暂无" : member.course_group.name + sheet1[count_row,column+=1] = member.course_group_id == 0 ? "暂无" : member.course_group.try(:name) # current_col = 5 shixun_score = 0 homeworks.where(:homework_type => 4).each do |homework| @@ -2550,7 +2550,7 @@ class CoursesController < ApplicationController sheet2[count_row,1] = act_member.user.show_real_name sheet2[count_row,2] = act_member.user.login sheet2[count_row,3] = act_member.user.user_extensions.student_id - sheet2[count_row,4] = act_member.course_group_id == 0 ? "暂无" : act_member.course_group.name + sheet2[count_row,4] = act_member.course_group_id == 0 ? "暂无" : act_member.course_group.try(:name) sheet2[count_row,5]= act_member.homework_num.to_i + act_member.graduation_num.to_i sheet2[count_row,6]= act_member.exercise_num sheet2[count_row,7]= act_member.poll_num @@ -2598,7 +2598,7 @@ class CoursesController < ApplicationController end homeworks.where(:homework_type => 1).includes(:score_student_works).each_with_index do |home, i| - sheet = book.create_worksheet :name => "普通作业第#{i+1}次" + sheet = book.create_worksheet :name => "#{home.name}" sheet[0,0] = "课程编号" sheet[0,1] = course.id sheet[1,0] = "课程名称" @@ -2645,7 +2645,7 @@ class CoursesController < ApplicationController end homeworks.where(:homework_type => 3).includes(:score_student_works).each_with_index do |home, i| - sheet = book.create_worksheet :name => "分组作业第#{i+1}次" + sheet = book.create_worksheet :name => "#{home.name}" sheet[0,0] = "课程编号" sheet[0,1] = course.id sheet[1,0] = "课程名称" @@ -2693,7 +2693,7 @@ class CoursesController < ApplicationController end exercises.includes(:score_exercise_users).each_with_index do |exercise, i| - sheet = book.create_worksheet :name => "试卷第#{i+1}次" + sheet = book.create_worksheet :name => "#{exercise.exercise_name}" sheet[0,0] = "课程编号" sheet[0,1] = course.id sheet[1,0] = "课程名称" @@ -2724,7 +2724,7 @@ class CoursesController < ApplicationController end tasks.each_with_index do |task, i| - sheet = book.create_worksheet :name => "毕设任务第#{i+1}次" + sheet = book.create_worksheet :name => "#{task.name}" sheet[0,0] = "课程编号" sheet[0,1] = course.id sheet[1,0] = "课程名称" diff --git a/app/controllers/libraries_controller.rb b/app/controllers/libraries_controller.rb index f3559b05..1d72f158 100644 --- a/app/controllers/libraries_controller.rb +++ b/app/controllers/libraries_controller.rb @@ -21,7 +21,7 @@ class LibrariesController < ApplicationController end def show - @library = Library.find(params[:id]) + @library = current_library return render_403 unless admin_or_self? || @library.published? @library_applies = @library.library_applies.where(status: :refused).order('created_at desc') @@ -40,7 +40,7 @@ class LibrariesController < ApplicationController redirect_to publish_success_libraries_path else flash[:message] = '保存成功' - render 'new' + redirect_to edit_library_path(id: @library.id) end rescue ActiveRecord::RecordInvalid => _ render 'new' @@ -50,11 +50,13 @@ class LibrariesController < ApplicationController end def edit + return render_403 unless admin_or_self? @library = current_library - redirect_to library_path(id: @library.id) unless @library.editable? end def update + return render_403 unless admin_or_self? + @library = current_library Libraries::SaveService.new(@library, current_user, form_params).call if with_publish? @@ -62,7 +64,7 @@ class LibrariesController < ApplicationController redirect_to publish_success_libraries_path else flash[:message] = '保存成功' - render 'edit' + redirect_to edit_library_path(id: @library.id) end rescue ActiveRecord::RecordInvalid => _ render 'edit' @@ -71,6 +73,24 @@ class LibrariesController < ApplicationController render 'edit' end + def destroy + if admin_or_business? + current_library.destroy + elsif current_library.user_id == current_user.id + unless current_library.pending? + render json: { status: -1, message: '只有草稿才能删除' } + return + end + + current_library.destroy + else + render_403 + return + end + + render json: { status: 0, message: 'success' } + end + def publish Libraries::SubmitService.new(current_library).call render json: { status: 0 } @@ -84,7 +104,7 @@ class LibrariesController < ApplicationController private def current_library - @_current_library ||= current_user.libraries.find(params[:id]) + @_current_library ||= Library.find(params[:id]) end def form_params @@ -100,6 +120,6 @@ class LibrariesController < ApplicationController end def admin_or_self? - @library.user_id == current_user.id || current_user.admin? + current_library.user_id == current_user.id || admin_or_business? end end \ No newline at end of file diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 672b3c66..b65a2fa8 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3015,9 +3015,9 @@ module ApplicationHelper elsif params[:controller] == "courses" && params[:action] == "index" title << ("翻转课堂") elsif params[:controller] == "competitions" && params[:action] == "index" - title << ("竞赛") + title << ("在线竞赛") elsif @competition - title << (@competition.name.nil? ? "竞赛" : @competition.name) + title << (@competition.name.nil? ? "在线竞赛" : @competition.name) elsif @contest title << (@contest.name.nil? ? "创新源于实践" : @contest.name) elsif @shixun @@ -3027,13 +3027,13 @@ module ApplicationHelper elsif params[:controller] == "shixuns" && params[:action] == "index" title << ("开发社区") elsif @subject - title << (@subject.name.nil? ? "实训课程" : @subject.name) + title << (@subject.name.nil? ? "实践课程" : @subject.name) elsif params[:controller] == "subjects" && params[:action] == "index" - title << ("实训课程") + title << ("实践课程") elsif @organization title << (@organization.name.nil? ? "创新源于实践" : @organization.name) elsif @forum || params[:controller] == "forums" - title << "讨论区" + title << "交流问答" elsif @my_syllabuses title << "我的课堂" elsif params[:controller] == 'ecs' diff --git a/app/models/library.rb b/app/models/library.rb index 78bc7fc5..63df5c91 100644 --- a/app/models/library.rb +++ b/app/models/library.rb @@ -45,8 +45,4 @@ class Library < ActiveRecord::Base def increment_visited_count! Library.connection.execute("update libraries set visited_count = COALESCE(visited_count, 0) + 1 where id = #{id}") end - - def editable? - pending? || refused? - end end \ No newline at end of file diff --git a/app/services/libraries/save_service.rb b/app/services/libraries/save_service.rb index 3a81d379..db244836 100644 --- a/app/services/libraries/save_service.rb +++ b/app/services/libraries/save_service.rb @@ -17,7 +17,7 @@ class Libraries::SaveService library.generate_uuid end - attachment_ids = params.delete(:attachment_ids) + attachment_ids = params.delete(:attachment_ids).try(:compact) ActiveRecord::Base.transaction do library.assign_attributes(params) @@ -32,6 +32,6 @@ class Libraries::SaveService private def validate_params! - raise Error, '附件不能为空' if params[:attachment_ids].blank? + raise Error, '附件不能为空' if params[:attachment_ids].try(:compact).blank? end end diff --git a/app/services/libraries/submit_service.rb b/app/services/libraries/submit_service.rb index 965ba673..0beec7de 100644 --- a/app/services/libraries/submit_service.rb +++ b/app/services/libraries/submit_service.rb @@ -8,6 +8,8 @@ class Libraries::SubmitService end def call + return if library.processing? || library.published? + raise Error, '该状态下不能提交审核' unless library.may_submit? ActiveRecord::Base.transaction do diff --git a/app/views/attachments/_from_libraries.html.erb b/app/views/attachments/_from_libraries.html.erb index 4abb3c80..a6fe347d 100644 --- a/app/views/attachments/_from_libraries.html.erb +++ b/app/views/attachments/_from_libraries.html.erb @@ -16,6 +16,7 @@ <%= number_to_human_size attachment.filesize %> <%= link_to(''.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %> <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> + <%= hidden_field_tag "attachments[p#{i}][attachment_id]", attachment.id %> <% end %> <% container.saved_attachments.each_with_index do |attachment, i| %> diff --git a/app/views/competitions/_gq_second_code_competition.html.erb b/app/views/competitions/_gq_second_code_competition.html.erb index 35c5dd17..65b0befc 100644 --- a/app/views/competitions/_gq_second_code_competition.html.erb +++ b/app/views/competitions/_gq_second_code_competition.html.erb @@ -5,6 +5,11 @@ <% index += 1 %> <% + challenge_description_extra = [ + "模拟赛选择了第一届标注大赛正式赛第一阶段的三个项目供大家体验熟悉平台、学习其他人的标注,模拟赛标注不计分。", + "第一阶段比赛得分占正赛总比分的30%。", + "第二阶段比赛得分占正赛总比分的70%。" + ] data = [ [ { @@ -12,21 +17,21 @@ description: "Weka是基于Java的机器学习与数据挖掘平台,汇集了最前沿的机器学习算法,包括处理标准数据挖掘问题的几乎所有方法:回归、分类、聚类、关联规则以及属性选择等,是Java机器学习入门的首选平台。

本项目的Clusters目录中包含了K-Means、层次聚类等多种聚类算法以及相应的聚类效果评估方法的java实现", task: '标注../weka/clusterers/目录下的所有代码文件。', link_name: 'CSDN,经典聚类算法', - link_url: 'javascript:void(0)' + link_url: 'https://blog.csdn.net/qq_30262201/article/details/78799926' }, { name: 'C++项目', description: "该项目是GitHub上最受欢迎的C++语言实现经典算法与数据结构的项目之一,内容涵盖排序、链表、树结构、图搜索、贪心算法等。学习这些算法的代码实现,可以深刻理解和掌握算法的核心思想,感受算法之美,代码之美,是人工智能时代的基础入门一课。

本项目的sort_search_problems目录涵盖了冒泡排序、快速排序等各类经典排序算法的C++实现。", task: '标注../sort_search_problems目录下的所有代码文件及对应引用的../include目录中自定义的头文件。', link_name: 'CSDN,十大经典排序算法', - link_url: 'javascript:void(0)' + link_url: 'https://blog.csdn.net/wfq784967698/article/details/79551476' }, { name: 'Python项目', description: "该项目是GitHub上最受欢迎的Python语言实现经典算法的项目之一,包含了前沿的神经网络和经典数据结构及算法的Python实现。项目具有兼顾经典和前沿的特点。学习经典算法的源码实现,感受经典算法的思想之美、代码之美。

本项目的Sorts目录中包含了冒泡排序、快速排序等各类经典排序算法的Python实现。", task: '标注../sorts/目录下的所有代码文件。', link_name: 'CSDN,十大经典排序算法', - link_url: 'javascript:void(0)' + link_url: 'https://blog.csdn.net/wfq784967698/article/details/79551476' }, ], [{},{},{}], @@ -56,7 +61,7 @@

- 标注说明:每个小组选择一种编程语言的题目,针对标注任务中指定的标注模块,要求对代码模块、模块中的代码文件, 以及文件中的函数必须进行标注,关键代码块、代码行及关键变量等由参赛者自由选择进行标注。 正式赛第一阶段的比赛在标注阶段就开放查看所有人的标注,请大家根据个人理解,写出自己的风格。我们将综合考虑标注的原创性、准确性、 完整性和多样性等不同的维度对标注质量进行评分。第一阶段比赛得分占正赛总比分的30%。 + 标注说明:每个小组选择一种编程语言的题目,针对标注任务中指定的标注模块,要求对代码模块、模块中的代码文件, 以及文件中的函数必须进行标注,关键代码块、代码行及关键变量等由参赛者自由选择进行标注。 正式赛第一阶段的比赛在标注阶段就开放查看所有人的标注,请大家根据个人理解,写出自己的风格。我们将综合考虑标注的原创性、准确性、 完整性和多样性等不同的维度对标注质量进行评分。<%= challenge_description_extra[i] %>

- 点击进入代标注模块 + 点击进入代标注模块

<% end %> @@ -99,4 +106,28 @@ <% index += 1 %>

<% index += 1 %> -

\ No newline at end of file +

+ + \ No newline at end of file diff --git a/app/views/competitions/_qg_second_competition.html.erb b/app/views/competitions/_qg_second_competition.html.erb index 7c69854b..aa45d32e 100644 --- a/app/views/competitions/_qg_second_competition.html.erb +++ b/app/views/competitions/_qg_second_competition.html.erb @@ -17,9 +17,9 @@ <% "@urls[i][j][k]表示: 第i个比赛的第j个对象,的第k个url入口" %> <% is_start = Time.now > section.start_time %> <% section.competition_entries.each_with_index do |entry| %> - " - <%= Time.now > section.start_time ? 'target="_blank"' : "" %> ><%= entry.name %> + <%= link_to entry.name, 'javascript:void(0);', + class: "li-1 #{ is_start ? 'active' : ''}", + data: { url: is_start ? entry.url : 'javascript:void(0);' } %> <% end %> @@ -34,3 +34,27 @@
<% index += 1 %>
+ + diff --git a/app/views/competitions/_qg_second_course_competition.html.erb b/app/views/competitions/_qg_second_course_competition.html.erb index b808deab..3ac9fbc0 100644 --- a/app/views/competitions/_qg_second_course_competition.html.erb +++ b/app/views/competitions/_qg_second_course_competition.html.erb @@ -17,9 +17,9 @@
<%= first_section.competition_entries[0].name %> + class="<%= is_start ? 'active' : '' %>" target="_blank"><%= first_section.competition_entries[0].name %> <%= first_section.competition_entries[1].name %> + class="<%= is_start ? 'active' : '' %>" target="_blank"><%= first_section.competition_entries[1].name %>
<%= first_section.competition_entries[2].name %> diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index 30ef0658..11a2d93d 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -2,7 +2,7 @@ <%= link_to image_tag("/images/educoder/headNavLogo.png", alt:"高校智能化教学与实训平台", class:"logoimg"), home_path %>
<% end %> -
  • "><%= link_to "竞赛", competitions_path %>
  • -
  • "><%= link_to "问答", forums_path %>
  • +
  • "><%= link_to "在线竞赛", competitions_path %>
  • +
  • "><%= link_to "交流问答", forums_path %>
  • <% if User.current.ec_school.present? %>
  • " id="ec_banner"> - <%= link_to "认证", department_ecs_path(:school_id => User.current.ec_school) %> + <%= link_to "工程认证", department_ecs_path(:school_id => User.current.ec_school) %>
  • <% end %> diff --git a/app/views/layouts/_unlogin_header.html.erb b/app/views/layouts/_unlogin_header.html.erb index f38a1dce..e787e012 100644 --- a/app/views/layouts/_unlogin_header.html.erb +++ b/app/views/layouts/_unlogin_header.html.erb @@ -3,7 +3,7 @@
      -
    • "><%= link_to "实训课程", subjects_path %>
    • +
    • "><%= link_to "实践课程", subjects_path %>
    • "><%= link_to "翻转课堂", courses_path %>
    • "><%= link_to "开发社区", shixuns_path %>
    • @@ -19,8 +19,8 @@
    <% end %> -
  • "><%= link_to "竞赛", competitions_path %>
  • -
  • "><%= link_to "问答", forums_path %>
  • +
  • "><%= link_to "在线竞赛", competitions_path %>
  • +
  • "><%= link_to "交流问答", forums_path %>
  • - <%= link_to '确认提交', 'javascript:void(0)', class: 'white-btn edu-blueback-btn changebtn mr20 fl apply-publish-btn' %> + <% unless @library.published? %> + <%= link_to '申请发布', 'javascript:void(0)', class: 'white-btn edu-blueback-btn changebtn mr20 fl apply-publish-btn' %> + <% end %> <%= link_to '保存', 'javascript:void(0)', class: 'white-btn edu-blueline-btn changebtn mr20 fl submit-btn' %>
    <% end %> @@ -86,43 +88,38 @@ imageUploadURL: "<%= upload_with_markdown_path(container_id: 0, container_type: 'MarkDown') %>" //url }); - $(function(){ - var submitForm = function(){ - var title = $("input[name='library[title]']").val(); - var content = $("textarea[name='library[content]']").val(); + var submitForm = function(){ + var title = $("input[name='library[title]']").val(); + var content = $("textarea[name='library[content]']").val(); - if (!title || title.length == 0) { - $("#title_notice").removeClass("none"); - return - }else{ - $("#title_notice").addClass("none"); - } - if (!content || content.length == 0) { - $("#des_notice").removeClass("none"); - return - }else{ - $("#des_notice").addClass("none"); - } + if (!title || title.length == 0) { + $("#title_notice").removeClass("none"); + return + }else{ + $("#title_notice").addClass("none"); + } + if (!content || content.length == 0) { + $("#des_notice").removeClass("none"); + return + }else{ + $("#des_notice").addClass("none"); + } - if($('.attachments_fields .attachment').length == 0){ - $("#file_notice").removeClass("none"); - return - }else{ - $("#file_notice").addClass("none"); - } + if($('.attachments_fields .attachment').length == 0){ + $("#file_notice").removeClass("none"); + return + }else{ + $("#file_notice").addClass("none"); + } - $('.library-form-container form').submit(); - }; + $('.library-form-container form').submit(); + }; + $(function(){ $('.apply-publish-btn').on('click', function(){ - $('input[name="apply_publish"]').val(true); + $("input[name='apply_publish']").val(true); submitForm(); }); $('.submit-btn').on('click', submitForm); - - var message = '<%= flash[:message] %>'; - if (message.length > 0) { - sure_confirm_box("提示",450,200,message); - } - }) + }); \ No newline at end of file diff --git a/app/views/libraries/index.html.erb b/app/views/libraries/index.html.erb index 84a2a9af..cc34dc81 100644 --- a/app/views/libraries/index.html.erb +++ b/app/views/libraries/index.html.erb @@ -1,3 +1,4 @@ +

    @@ -15,7 +16,7 @@

    <%= hidden_field_tag(:type, params[:type]) %> - +
    @@ -35,7 +36,7 @@ var search = $("#search_name").val(); var type = $("input[name='type']").val(); $.ajax({ - url: "/libraries", + url: "<%= libraries_path %>", dataType: 'script', data: {search: search, type: type} }); diff --git a/app/views/libraries/show.html.erb b/app/views/libraries/show.html.erb index 5b196712..f857a8ec 100644 --- a/app/views/libraries/show.html.erb +++ b/app/views/libraries/show.html.erb @@ -1,5 +1,5 @@ <% - admin_or_self = User.current.admin? || @library.user_id == User.current.id + admin_or_self = admin_or_business? || @library.user_id == User.current.id %>

    @@ -42,7 +42,11 @@

    详情 - <% if admin_or_self && @library.editable? %> + <% if admin_or_business? || @library.user_id == User.current.id && @library.pending? %> + <%= link_to '删除', 'javascript:void(0);', data: { id: @library.id }, + class: 'white-btn edu-blueline-btn fr ml20 delete-btn' %> + <% end %> + <% if admin_or_self %> <%= link_to '编辑', edit_library_path(id: @library.id), class: 'white-btn edu-blueline-btn fr' %> <% end %>

    @@ -99,13 +103,35 @@ sequenceDiagram: true // 默认不解析 }); $(function(){ + // 删除 + $('.delete-btn').on('click', function(){ + var id = $(this).data('id'); + op_confirm_tip_1("是否确认删除?", "destroyLibrary(" + id + ");") + }); + + if ($('#private_reason_ul').length != 0) { var height=document.getElementById("private_reason_ul").offsetHeight; var one=parseInt($("#private_reason_ul").find("li").eq(0).height())+10; var two=parseInt($("#private_reason_ul").find("li").eq(1).height()); var plus=one+two; if(parseInt(height)>166){ - $("#actionPanel").html('点击展开'); - $(".private_reason").css({maxHeight:plus+"px"}); + $("#actionPanel").html('点击展开'); + $(".private_reason").css({maxHeight:plus+"px"}); } + } }) + + function destroyLibrary (id) { + $.ajax({ + type: "DELETE", + url: "<%= libraries_path %>/" + id, + success: function (data) { + if(data && data.status == 0){ + notice_box_redirect("<%= libraries_path %>", "删除成功"); + } else { + notice_box(data.message); + } + } + }); + } \ No newline at end of file diff --git a/app/views/managements/schools/_data_contrast_list.html.erb b/app/views/managements/schools/_data_contrast_list.html.erb index c25a8bc4..a4a7919b 100644 --- a/app/views/managements/schools/_data_contrast_list.html.erb +++ b/app/views/managements/schools/_data_contrast_list.html.erb @@ -19,8 +19,7 @@ 序号 - ID - 单位名称 + 单位名称 时段一
    <%= "(#{params[:begin_date]} 05:00至#{(Time.zone.parse(params[:end_date]) + 1.days).strftime('%Y-%m-%d')} 05:00)" %> 时段二
    <%= "(#{params[:other_begin_date]} 05:00至#{(Time.zone.parse(params[:other_end_date]) + 1.days).strftime('%Y-%m-%d')} 05:00)" %> @@ -33,8 +32,10 @@ <% @reports.each_with_index do |report, index| %> <%= (@obj_pages.page - 1) * @obj_pages.per_page + index + 1 %> - <%= report.school_id %> - <%= report.school_name %> + + <%= link_to report.school_name, statistics_college_path(id: report.school_id), + target: '_blank', data: { tip_down: '点击查看学校统计概况'} %> + <%= report['total'] %> <%= report['other_total'] %> <% diff --git a/app/views/managements/schools/_data_grow_list.html.erb b/app/views/managements/schools/_data_grow_list.html.erb index af1fc200..708be475 100644 --- a/app/views/managements/schools/_data_grow_list.html.erb +++ b/app/views/managements/schools/_data_grow_list.html.erb @@ -20,9 +20,7 @@ 序号 - ID 单位名称 - <%= sort_tag('新增教师', name: 'teacher_increase_count', path: school_data_grow_managements_path) %> <%= sort_tag('新增学生', name: 'student_increase_count', path: school_data_grow_managements_path) %> <%= sort_tag('新增课堂', name: 'course_increase_count', path: school_data_grow_managements_path) %> @@ -36,8 +34,10 @@ <% @reports.each_with_index do |report, index| %> <%= (@obj_pages.page - 1) * @obj_pages.per_page + index + 1 %> - <%= report.school_id %> - <%= report.school_name %> + + <%= link_to report.school_name, statistics_college_path(id: report.school_id), + target: '_blank', data: { tip_down: '点击查看学校统计概况'} %> + <%= report.teacher_increase_count.to_i %> <%= report.student_increase_count.to_i %> <%= report.course_increase_count.to_i %> diff --git a/app/views/managements/schools/_statistics_list.html.erb b/app/views/managements/schools/_statistics_list.html.erb index 7fb6300d..5d21f1cc 100644 --- a/app/views/managements/schools/_statistics_list.html.erb +++ b/app/views/managements/schools/_statistics_list.html.erb @@ -2,8 +2,7 @@ 序号 - ID - 单位名称 + 单位名称 <%= sort_tag('教师总人数', name: 'teacher_count', path: school_report_managements_path) %> <%= sort_tag('学生总人数', name: 'student_count', path: school_report_managements_path) %> @@ -23,8 +22,7 @@ <% @schools.each_with_index do |school, index| %> <%= (@obj_pages.page - 1) * @obj_pages.per_page + index + 1 %> - <%= school[:id] %> - <%= school[:name] %> + <%= link_to school[:name], statistics_college_path(id: school[:id]), target: '_blank', data: { tip_down: '点击查看学校统计概况'} %> <%= school[:teacher_count].to_i %> <%= school[:student_count].to_i %> <%= school[:course_count].to_i %> diff --git a/db/migrate/20190701022644_transfer_competition_personal_enroll_data.rb b/db/migrate/20190701022644_transfer_competition_personal_enroll_data.rb new file mode 100644 index 00000000..4c59ad14 --- /dev/null +++ b/db/migrate/20190701022644_transfer_competition_personal_enroll_data.rb @@ -0,0 +1,26 @@ +class TransferCompetitionPersonalEnrollData < ActiveRecord::Migration + CODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z) + + def change + gcc_task = Competition.find_by_identifier('gcc-task-2019') + transfer_personal_enroll_data(gcc_task) + + gcc_annotation = Competition.find_by_identifier('gcc-annotation-2019') + transfer_personal_enroll_data(gcc_annotation) + end + + def transfer_personal_enroll_data(competition) + return if competition.blank? + competition.competition_teams.where('invite_code IS NULL OR invite_code = ""').each do |team| + team.update_attributes!(invite_code: generate_team_code, name: "#{team.name}战队") + end + end + + def generate_team_code + code = CODES.sample(6).join + while CompetitionTeam.exists?(invite_code: code) + code = CODES.sample(6).join + end + code + end +end diff --git a/public/images/educoder/teach_ex.png b/public/images/educoder/teach_ex.png new file mode 100644 index 00000000..a3e65c73 Binary files /dev/null and b/public/images/educoder/teach_ex.png differ diff --git a/public/react/src/modules/forums/ForumsIndex.js b/public/react/src/modules/forums/ForumsIndex.js index 14d31d69..1c446725 100644 --- a/public/react/src/modules/forums/ForumsIndex.js +++ b/public/react/src/modules/forums/ForumsIndex.js @@ -104,7 +104,7 @@ class ForumsIndex extends Component { componentDidMount() { - window.document.title = '问答' + window.document.title = '交流问答' } diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 79eccf2b..30d8572c 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -272,7 +272,7 @@ class NewHeader extends Component {
    -
  • 教学案例
  • -
  • 竞赛
  • -
  • 问答
  • -
  • {ecUrl===null||ecUrl===undefined||ecUrl===""?'':'认证'}
  • + {/*
  • 教学案例
  • */} +
  • 在线竞赛
  • +
  • 交流问答
  • +
  • {ecUrl===null||ecUrl===undefined||ecUrl===""?'':'工程认证'}