dev_bj
caishi 6 years ago
commit 1d64505243

@ -20,6 +20,8 @@ class CompetitionsController < ApplicationController
def show def show
@images = @competition.attachments @images = @competition.attachments
@user = current_user
@enrolled = @user && @user.logged? && @competition.team_members.exists?(user_id: @user.id)
end end
def index def index

@ -1,7 +1,7 @@
class LibrariesController < ApplicationController class LibrariesController < ApplicationController
layout 'base_library' layout 'base_library'
before_filter :require_login before_filter :require_login, :except => [:index]
def index def index
libraries = Library.where(nil) libraries = Library.where(nil)

@ -3015,9 +3015,9 @@ module ApplicationHelper
elsif params[:controller] == "courses" && params[:action] == "index" elsif params[:controller] == "courses" && params[:action] == "index"
title << ("翻转课堂") title << ("翻转课堂")
elsif params[:controller] == "competitions" && params[:action] == "index" elsif params[:controller] == "competitions" && params[:action] == "index"
title << ("竞赛") title << ("在线竞赛")
elsif @competition elsif @competition
title << (@competition.name.nil? ? "竞赛" : @competition.name) title << (@competition.name.nil? ? "在线竞赛" : @competition.name)
elsif @contest elsif @contest
title << (@contest.name.nil? ? "创新源于实践" : @contest.name) title << (@contest.name.nil? ? "创新源于实践" : @contest.name)
elsif @shixun elsif @shixun
@ -3027,13 +3027,13 @@ module ApplicationHelper
elsif params[:controller] == "shixuns" && params[:action] == "index" elsif params[:controller] == "shixuns" && params[:action] == "index"
title << ("开发社区") title << ("开发社区")
elsif @subject elsif @subject
title << (@subject.name.nil? ? "课程" : @subject.name) title << (@subject.name.nil? ? "课程" : @subject.name)
elsif params[:controller] == "subjects" && params[:action] == "index" elsif params[:controller] == "subjects" && params[:action] == "index"
title << ("课程") title << ("课程")
elsif @organization elsif @organization
title << (@organization.name.nil? ? "创新源于实践" : @organization.name) title << (@organization.name.nil? ? "创新源于实践" : @organization.name)
elsif @forum || params[:controller] == "forums" elsif @forum || params[:controller] == "forums"
title << "讨论区" title << "交流问答"
elsif @my_syllabuses elsif @my_syllabuses
title << "我的课堂" title << "我的课堂"
elsif params[:controller] == 'ecs' elsif params[:controller] == 'ecs'
@ -3080,7 +3080,7 @@ module ApplicationHelper
elsif @syllabus elsif @syllabus
title << (@syllabus.title.nil? ? "课堂" : @syllabus.title) title << (@syllabus.title.nil? ? "课堂" : @syllabus.title)
else else
title << (User.current.anonymous? ? "Educoder实践教学" : User.current.show_name) title << (User.current.anonymous? ? "EduCoder实践教学" : User.current.show_name)
end end
# if first_page.nil? || first_page.web_title.nil? # if first_page.nil? || first_page.web_title.nil?
# title << Setting.app_title unless Setting.app_title == title.last # title << Setting.app_title unless Setting.app_title == title.last
@ -6490,7 +6490,7 @@ def visable_attachemnts_incourse course
member = course.members.where(:user_id => User.current.id).first member = course.members.where(:user_id => User.current.id).first
if member.try(:course_group_id).to_i == 0 && attachment.unified_setting if member.try(:course_group_id).to_i == 0 && attachment.unified_setting
result << attachment result << attachment
elsif attachment.attachment_group_settings.where("course_group_id = #{member.try(:course_group_id)} and publish_time > '#{Time.now}'").count == 0 elsif attachment.attachment_group_settings.where("course_group_id = #{member.try(:course_group_id).to_i} and publish_time > '#{Time.now}'").count == 0
result << attachment result << attachment
end end
end end
@ -6602,7 +6602,7 @@ def update_shixun_work_status homework
myshixuns.each do |myshixun| myshixuns.each do |myshixun|
work = student_works.where(:user_id => myshixun.user_id).first work = student_works.where(:user_id => myshixun.user_id).first
member = homework.course.members.find_by_user_id(work.user_id) member = homework.course.members.find_by_user_id(work.user_id)
setting_time = homework_group_setting homework, member.try(:course_group_id) setting_time = homework_group_setting homework, member.try(:course_group_id).to_i
games = myshixun.games.where(:challenge_id => challeng_ids) games = myshixun.games.where(:challenge_id => challeng_ids)
myshixun_endtime = games.select{|game| game.status == 2}.size == games.size ? games.map(&:end_time).max : nil myshixun_endtime = games.select{|game| game.status == 2}.size == games.size ? games.map(&:end_time).max : nil
compelete_status = 0 compelete_status = 0
@ -6613,7 +6613,7 @@ def update_shixun_work_status homework
compelete_status = 1 compelete_status = 1
end end
end end
if setting.publish_time && setting.publish_time < Time.now && setting_time.end_time if setting_time.publish_time && setting_time.publish_time < Time.now && setting_time.end_time
if setting_time.end_time > Time.now if setting_time.end_time > Time.now
work.update_attributes(:work_status => 1, :late_penalty => 0, :commit_time => myshixun.updated_at, :update_time => myshixun.updated_at, :myshixun_id => myshixun.id, :compelete_status => compelete_status) work.update_attributes(:work_status => 1, :late_penalty => 0, :commit_time => myshixun.updated_at, :update_time => myshixun.updated_at, :myshixun_id => myshixun.id, :compelete_status => compelete_status)
else else
@ -7254,11 +7254,9 @@ end
# 作业的分班设置时间 # 作业的分班设置时间
def homework_group_setting homework, group_id def homework_group_setting homework, group_id
setting = nil
if homework.homework_group_settings.where(:course_group_id => group_id).first
setting = homework.homework_group_settings.where(:course_group_id => group_id).first
else
setting = homework setting = homework
if homework.homework_group_settings.where(:course_group_id => group_id).first.present?
setting = homework.homework_group_settings.where(:course_group_id => group_id).first
end end
setting setting
end end

@ -30,6 +30,6 @@ class Competition < ActiveRecord::Base
end end
def member_count def member_count
self.team_members.count + 268 self.team_members.count == 0 ? 0 : self.team_members.count + 268
end end
end end

@ -5,6 +5,11 @@
<% index += 1 %> <% index += 1 %>
<% <%
challenge_description_extra = [
"模拟赛选择了第一届标注大赛正式赛第一阶段的三个项目供大家体验熟悉平台、学习其他人的标注,模拟赛标注不计分。",
"第一阶段比赛得分占正赛总比分的30%。",
"第二阶段比赛得分占正赛总比分的70%。"
]
data = [ data = [
[ [
{ {
@ -12,21 +17,21 @@
description: "Weka是基于Java的机器学习与数据挖掘平台汇集了最前沿的机器学习算法包括处理标准数据挖掘问题的几乎所有方法回归、分类、聚类、关联规则以及属性选择等是Java机器学习入门的首选平台。<br/><br/>本项目的Clusters目录中包含了K-Means、层次聚类等多种聚类算法以及相应的聚类效果评估方法的java实现", description: "Weka是基于Java的机器学习与数据挖掘平台汇集了最前沿的机器学习算法包括处理标准数据挖掘问题的几乎所有方法回归、分类、聚类、关联规则以及属性选择等是Java机器学习入门的首选平台。<br/><br/>本项目的Clusters目录中包含了K-Means、层次聚类等多种聚类算法以及相应的聚类效果评估方法的java实现",
task: '标注../weka/clusterers/目录下的所有代码文件。', task: '标注../weka/clusterers/目录下的所有代码文件。',
link_name: 'CSDN经典聚类算法', link_name: 'CSDN经典聚类算法',
link_url: 'javascript:void(0)' link_url: 'https://blog.csdn.net/qq_30262201/article/details/78799926'
}, },
{ {
name: 'C++项目', name: 'C++项目',
description: "该项目是GitHub上最受欢迎的C++语言实现经典算法与数据结构的项目之一,内容涵盖排序、链表、树结构、图搜索、贪心算法等。学习这些算法的代码实现,可以深刻理解和掌握算法的核心思想,感受算法之美,代码之美,是人工智能时代的基础入门一课。<br/><br/>本项目的sort_search_problems目录涵盖了冒泡排序、快速排序等各类经典排序算法的C++实现。", description: "该项目是GitHub上最受欢迎的C++语言实现经典算法与数据结构的项目之一,内容涵盖排序、链表、树结构、图搜索、贪心算法等。学习这些算法的代码实现,可以深刻理解和掌握算法的核心思想,感受算法之美,代码之美,是人工智能时代的基础入门一课。<br/><br/>本项目的sort_search_problems目录涵盖了冒泡排序、快速排序等各类经典排序算法的C++实现。",
task: '标注../sort_search_problems目录下的所有代码文件及对应引用的../include目录中自定义的头文件。', task: '标注../sort_search_problems目录下的所有代码文件及对应引用的../include目录中自定义的头文件。',
link_name: 'CSDN十大经典排序算法', link_name: 'CSDN十大经典排序算法',
link_url: 'javascript:void(0)' link_url: 'https://blog.csdn.net/wfq784967698/article/details/79551476'
}, },
{ {
name: 'Python项目', name: 'Python项目',
description: "该项目是GitHub上最受欢迎的Python语言实现经典算法的项目之一包含了前沿的神经网络和经典数据结构及算法的Python实现。项目具有兼顾经典和前沿的特点。学习经典算法的源码实现感受经典算法的思想之美、代码之美。<br/><br/>本项目的Sorts目录中包含了冒泡排序、快速排序等各类经典排序算法的Python实现。", description: "该项目是GitHub上最受欢迎的Python语言实现经典算法的项目之一包含了前沿的神经网络和经典数据结构及算法的Python实现。项目具有兼顾经典和前沿的特点。学习经典算法的源码实现感受经典算法的思想之美、代码之美。<br/><br/>本项目的Sorts目录中包含了冒泡排序、快速排序等各类经典排序算法的Python实现。",
task: '标注../sorts/目录下的所有代码文件。', task: '标注../sorts/目录下的所有代码文件。',
link_name: 'CSDN十大经典排序算法', link_name: 'CSDN十大经典排序算法',
link_url: 'javascript:void(0)' link_url: 'https://blog.csdn.net/wfq784967698/article/details/79551476'
}, },
], ],
[{},{},{}], [{},{},{}],
@ -56,7 +61,7 @@
</li> </li>
</ul> </ul>
<p class="break_word font-18 challenge_describe"> <p class="break_word font-18 challenge_describe">
标注说明:每个小组选择一种编程语言的题目,针对标注任务中指定的标注模块,要求对代码模块、模块中的代码文件, 以及文件中的函数必须进行标注,关键代码块、代码行及关键变量等由参赛者自由选择进行标注。 正式赛第一阶段的比赛在标注阶段就开放查看所有人的标注,请大家根据个人理解,写出自己的风格。我们将综合考虑标注的原创性、准确性、 完整性和多样性等不同的维度对标注质量进行评分。第一阶段比赛得分占正赛总比分的30%。 标注说明:每个小组选择一种编程语言的题目,针对标注任务中指定的标注模块,要求对代码模块、模块中的代码文件, 以及文件中的函数必须进行标注,关键代码块、代码行及关键变量等由参赛者自由选择进行标注。 正式赛第一阶段的比赛在标注阶段就开放查看所有人的标注,请大家根据个人理解,写出自己的风格。我们将综合考虑标注的原创性、准确性、 完整性和多样性等不同的维度对标注质量进行评分。<%= challenge_description_extra[i] %>
</p> </p>
<ul class="mt30"> <ul class="mt30">
@ -70,8 +75,8 @@
btn_url = is_start ? "#{entry.url}" : "javascript:void(0);" btn_url = is_start ? "#{entry.url}" : "javascript:void(0);"
%> %>
<a class="setNewBnt <%= is_start ? 'active' : '' %>" <a class="setNewBnt <%= is_start ? 'active' : '' %>"
href="<%= btn_url %>" href="javascript:void(0);"
<%= Time.now > first_section.start_time ? 'target="_blank"' : "" %> ><%= entry.name %></a> data-url="<%= btn_url %>"><%= entry.name %></a>
</p> </p>
<% if row_data.present? %> <% if row_data.present? %>
@ -84,7 +89,9 @@
<a href="<%= row_data[:link_url] %>" target="_blank"><%= row_data[:link_name] %></a> <a href="<%= row_data[:link_url] %>" target="_blank"><%= row_data[:link_name] %></a>
</ul> </ul>
<p class="enter_btn clearfix"> <p class="enter_btn clearfix">
<a href="<%= btn_url %>" target="_blank" class="setNewBnt <%= is_start ? 'active' : '' %>">点击进入代标注模块</a> <a href="javascript:void(0);"
data-url="<%= btn_url %>"
class="setNewBnt <%= is_start ? 'active' : '' %>">点击进入代标注模块</a>
</p> </p>
<% end %> <% end %>
</li> </li>
@ -100,3 +107,27 @@
<p class="second_code_7" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p> <p class="second_code_7" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<% index += 1 %> <% index += 1 %>
<p class="second_code_8" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p> <p class="second_code_8" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<script>
$(function(){
var userLogged = <%= @user.present? && @user.logged? %>;
var userEnrolled = <%= @enrolled %>;
$(".enter_btn .setNewBnt.active").on("click", function(){
var url = $(this).data("url");
if (!userLogged) {
location.href = "<%= signin_url(back_url: competition_path(id: params[:id])) %>";
return;
}
if (!userEnrolled) {
sure_box_redirect_without_newtab_btn("<%= enroll_competition_path(id: params[:id]) %>", "完成报名后即可参赛", "我要报名");
return;
}
var newTab = window.open("_blank");
newTab.location = url;
})
})
</script>

@ -17,9 +17,9 @@
<% "@urls[i][j][k]表示: 第i个比赛的第j个对象的第k个url入口" %> <% "@urls[i][j][k]表示: 第i个比赛的第j个对象的第k个url入口" %>
<% is_start = Time.now > section.start_time %> <% is_start = Time.now > section.start_time %>
<% section.competition_entries.each_with_index do |entry| %> <% section.competition_entries.each_with_index do |entry| %>
<a class="li-1 <%= is_start ? 'active' : '' %>" <%= link_to entry.name, 'javascript:void(0);',
href="<%= is_start ? "#{entry.url}" : "javascript:void(0);" %>" class: "li-1 #{ is_start ? 'active' : ''}",
<%= Time.now > section.start_time ? 'target="_blank"' : "" %> ><%= entry.name %></a> data: { url: is_start ? entry.url : 'javascript:void(0);' } %>
<% end %> <% end %>
</li> </li>
</ul> </ul>
@ -34,3 +34,27 @@
<div class="second_7" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></div> <div class="second_7" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></div>
<% index += 1 %> <% index += 1 %>
<div class="second_8" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></div> <div class="second_8" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></div>
<script>
$(function(){
var userLogged = <%= @user.present? && @user.logged? %>;
var userEnrolled = <%= @enrolled %>;
$(".enter_btn a.active").on("click", function(){
var url = $(this).data("url");
if (!userLogged) {
location.href = "<%= signin_url(back_url: competition_path(id: params[:id])) %>";
return;
}
if (!userEnrolled) {
sure_box_redirect_without_newtab_btn("<%= enroll_competition_path(id: params[:id]) %>", "完成报名后即可参赛", "我要报名");
return;
}
var newTab = window.open("_blank");
newTab.location = url;
})
})
</script>

@ -2,7 +2,7 @@
<%= link_to image_tag("/images/educoder/headNavLogo.png", alt:"高校智能化教学与实训平台", class:"logoimg"), home_path %> <%= link_to image_tag("/images/educoder/headNavLogo.png", alt:"高校智能化教学与实训平台", class:"logoimg"), home_path %>
<div class="head-nav pr"> <div class="head-nav pr">
<ul id="header-nav"> <ul id="header-nav">
<li class="<%= subjects_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "实课程", subjects_path %></li> <li class="<%= subjects_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "实课程", subjects_path %></li>
<li class="<%= course_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "翻转课堂", courses_path %></li> <li class="<%= course_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "翻转课堂", courses_path %></li>
<!-- 精选实训 --> <!-- 精选实训 -->
<li class="pr <%= shixuns_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "开发社区", shixuns_path %><img src="/images/educoder/hot-h.png" class="nav-img" /></li> <li class="pr <%= shixuns_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "开发社区", shixuns_path %><img src="/images/educoder/hot-h.png" class="nav-img" /></li>
@ -18,12 +18,11 @@
</ul> </ul>
</li> </li>
<% end %> <% end %>
<li class="<%= params[:controller] == "libraries" ? "active" : "" %>"><%= link_to '教学案例', libraries_path %></li> <li class="<%= params[:controller] == "competitions" ? " active" : "" %>"><%= link_to "在线竞赛", competitions_path %></li>
<li class="<%= params[:controller] == "competitions" ? " active" : "" %>"><%= link_to "竞赛", competitions_path %></li> <li class="<%= params[:controller] == "forums" ? " active" : "" %>"><%= link_to "交流问答", forums_path %></li>
<li class="<%= params[:controller] == "forums" ? " active" : "" %>"><%= link_to "问答", forums_path %></li>
<% if User.current.ec_school.present? %> <% if User.current.ec_school.present? %>
<li class="<%= ecs_controller.include?(params[:controller]) ? " active" : "" %>" id="ec_banner"> <li class="<%= ecs_controller.include?(params[:controller]) ? " active" : "" %>" 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) %>
</li> </li>
<% end %> <% end %>
</ul> </ul>

@ -3,7 +3,7 @@
<div class="head-nav pr"> <div class="head-nav pr">
<ul id="header-nav"> <ul id="header-nav">
<li class="active" style="display: none"><%= link_to "首页", home_path %></li> <li class="active" style="display: none"><%= link_to "首页", home_path %></li>
<li class="<%= subjects_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "实课程", subjects_path %></li> <li class="<%= subjects_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "实课程", subjects_path %></li>
<li class="<%= course_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "翻转课堂", courses_path %></li> <li class="<%= course_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "翻转课堂", courses_path %></li>
<li class="pr <%= shixuns_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "开发社区", shixuns_path %><img src="/images/educoder/hot-h.png" class="nav-img" /></li> <li class="pr <%= shixuns_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "开发社区", shixuns_path %><img src="/images/educoder/hot-h.png" class="nav-img" /></li>
@ -19,8 +19,8 @@
</ul> </ul>
</li> </li>
<% end %> <% end %>
<li class="<%= params[:controller] == "competitions" ? " active" : "" %>"><%= link_to "竞赛", competitions_path %></li> <li class="<%= params[:controller] == "competitions" ? " active" : "" %>"><%= link_to "在线竞赛", competitions_path %></li>
<li class="<%= params[:controller] == "forums" ? " active" : "" %>"><%= link_to "问答", forums_path %></li> <li class="<%= params[:controller] == "forums" ? " active" : "" %>"><%= link_to "交流问答", forums_path %></li>
<!--<li><%#= link_to "活动竞赛", competitions_path %></li>--> <!--<li><%#= link_to "活动竞赛", competitions_path %></li>-->
</ul> </ul>
<div class="posi-search unlogin" id="posi-search" style="display: none" > <div class="posi-search unlogin" id="posi-search" style="display: none" >

@ -11,7 +11,7 @@
<%= favicon %> <%= favicon %>
<%= javascript_heads %> <%= javascript_heads %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'educoder/edu-main', 'educoder/edu-all', 'educoder/magic-check' %> <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'educoder/edu-main', 'educoder/edu-all', 'educoder/magic-check' %>
<%= javascript_include_tag 'educoder/edu_application' %> <%= javascript_include_tag 'educoder/edu_application', 'edu/application' %>
<script type="text/javascript" <script type="text/javascript"
src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">

@ -10,12 +10,9 @@
<%= f.text_field :title, placeholder: '例如:软件工程教学案例', class: 'greyInput winput-300-35 mr20 fl' %> <%= f.text_field :title, placeholder: '例如:软件工程教学案例', class: 'greyInput winput-300-35 mr20 fl' %>
<p style="height:20px;line-height:20px;"><span class="color-red none" id="title_notice">请输入标题</span></p> <p style="height:20px;line-height:20px;"><span class="color-red none" id="title_notice">请输入标题</span></p>
</li> </li>
<span class="color-grey-c font-12 fl mt5">简明扼要介绍文档&视频所包含的主要的内容</span> <span class="color-grey-c font-12 fl mt6">简明扼要介绍文档/视频所包含的主要的内容</span>
</div>
<div>
<%= render partial: 'attachments/from_libraries', locals: { container: @library } %>
<p style="height:22px;line-height:22px;"><span class="color-red none" id="file_notice">请上传附件</span></p>
</div> </div>
</div> </div>
<div class="padding30 bor-top-greyE"> <div class="padding30 bor-top-greyE">
<div class="clearfix df"> <div class="clearfix df">
@ -27,6 +24,12 @@
<p style="height:22px;line-height:22px;"><span class="color-red none" id="des_notice">请输入描述内容</span></p> <p style="height:22px;line-height:22px;"><span class="color-red none" id="des_notice">请输入描述内容</span></p>
</div> </div>
</div> </div>
<div>
<%= render partial: 'attachments/from_libraries', locals: { container: @library } %>
<p s
tyle="height:22px;line-height:22px;"><span class="color-red none" id="file_notice">请上传附件</span></p>
</div>
</div> </div>
<div class="padding30 bor-top-greyE"> <div class="padding30 bor-top-greyE">
<li class="lineh-25 color-grey-6 font-18 mb20">审核说明</li> <li class="lineh-25 color-grey-6 font-18 mb20">审核说明</li>
@ -37,11 +40,10 @@
<div class="padding30 bor-top-greyE"> <div class="padding30 bor-top-greyE">
<li class="lineh-25 color-grey-6 font-18 mb20">温馨提示</li> <li class="lineh-25 color-grey-6 font-18 mb20">温馨提示</li>
<ul class="font-16"> <ul class="font-16">
<li>1.请勿上传已设置加密或只读的文档资源</li> <li>1.请勿上传已设置加密口令的文档资源;</li>
<li>2.可以上传教学积累和撰写的文档资料如教学案例、总结、心得等上传支持的文件最大容量100MB</li> <li>2.可以上传符合教学案例标准的文档资料,如<a class="color-blue" target="_blank" href="https://www.educoder.net/boards/5909/topics/34799">案例入库标准</a>、<a target="_blank" class="color-blue" href="https://www.educoder.net/boards/5909/topics/34798">案例使用说明书</a>以及其他资料等上传支持的文件最大容量100MB</li>
<li>3.上传涉及侵权内容的文档将会被移除。</li> <li>3.请确保上传内容无侵权或违反国家关于互联网政策的不良行为;</li>
<li>4.为营造绿色网络环境,严禁上传违反国家关于互联网相关规定的内容</li> <li>4.请使用ChromeFirefoxSafariIE11及以上版本浏览器</li>
<li>5.ChromeFirefoxSafariIE11及以上版本浏览器上传</li>
</ul> </ul>
</div> </div>
</div> </div>

@ -53,7 +53,7 @@ RedmineApp::Application.routes.draw do ## oauth相关
end end
# library # library
resources :libraries do resources :libraries, :path => "moop_cases" do
get :publish_success, on: :collection get :publish_success, on: :collection
end end

@ -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
Loading…
Cancel
Save