dev_aliyun
jingquan huang 5 years ago
commit 2f48e913ae

@ -17,7 +17,8 @@ class CompetitionTeamsController < ApplicationController
@team_user_ids = @team.team_members.pluck(:user_id)
shixuns = Shixun.where(user_id: @team_user_ids, status: 2).where('shixuns.created_at > ?', Time.parse('2018-06-01'))
shixuns = Shixun.where(user_id: @team_user_ids, status: 2)
.where('shixuns.created_at > ? && shixuns.created_at <= ?', Time.parse('2018-06-01'), @competition.end_time)
shixuns = shixuns.joins('left join shixuns forked_shixuns on forked_shixuns.fork_from = shixuns.id and forked_shixuns.status = 2')
shixuns = shixuns.select('shixuns.id, shixuns.identifier, shixuns.user_id, shixuns.myshixuns_count, shixuns.name, shixuns.fork_from, sum(forked_shixuns.myshixuns_count) forked_myshixun_count')
@shixuns = shixuns.group('shixuns.id').order('shixuns.myshixuns_count desc').includes(:creator)
@ -30,18 +31,30 @@ class CompetitionTeamsController < ApplicationController
forked_myshixun_count_map = get_valid_myshixun_count(forked_shixun_map.keys)
forked_myshixun_count_map.each { |k, v| @myshixun_count_map[forked_shixun_map[k]] += v }
# todo使用新版course_members
@course_count_map = get_valid_course_count(shixun_ids)
forked_map = get_valid_course_count(forked_shixun_map.keys)
@forked_course_count_map = {}
forked_map.each do |forked_id, course_count|
@forked_course_count_map[forked_shixun_map[forked_id]] ||= 0
@forked_course_count_map[forked_shixun_map[forked_id]] += course_count
end
# 课堂
course_ids = Course.where('courses.created_at > ?', Time.parse('2018-06-01'))
.where('courses.created_at <= ?', @competition.end_time)
.joins('join course_members on course_members.course_id = courses.id and course_members.role in (1,2,3)')
.where(course_members: { user_id: @team_user_ids }).pluck(:id)
courses = Course.where(id: course_ids).joins(:shixun_homework_commons).where('homework_commons.publish_time < now()')
@courses = courses.select('courses.id, courses.name, courses.members_count, count(*) shixun_homework_count')
.group('courses.id').order('shixun_homework_count desc').having('shixun_homework_count > 0')
course_ids = @courses.map(&:id)
@course_myshixun_map = Myshixun.joins(student_works: :homework_common)
.where(homework_commons: { course_id: @courses.map(&:id) })
.where(homework_commons: { course_id: course_ids })
.where('exists(select 1 from games where games.myshixun_id = myshixuns.id and games.status = 2)')
.group('homework_commons.course_id').count
@course_shixun_count_map = get_valid_shixun_count(course_ids)
end
def search_teacher
@ -345,6 +358,28 @@ class CompetitionTeamsController < ApplicationController
.group('shixun_id').count
end
def get_valid_course_count(ids)
percentage_sql = StudentWork.where('homework_common_id = homework_commons.id')
.select('count(compelete_status !=0 ) as finish, count(*) as total')
.having('finish > (total / 2)').to_sql
Course.joins(shixun_homework_commons: :homework_commons_shixuns)
.where('shixun_id in (?)', ids)
.where("exists (#{percentage_sql})")
.group('shixun_id').count
end
def get_valid_shixun_count(ids)
percentage_sql = StudentWork.where('homework_common_id = homework_commons.id')
.select('count(compelete_status !=0 ) as finish, count(*) as total')
.having('finish > (total / 2)').to_sql
Shixun.joins(homework_commons_shixuns: :homework_common)
.where(homework_commons: { homework_type: 3 })
.where('course_id in (?)', ids)
.where("exists (#{percentage_sql})")
.group('course_id').count
end
def record_agent_user_action
# 记录是否是引流用户的行为
ip = request.remote_ip

@ -1,7 +1,9 @@
class LibrariesController < ApplicationController
include ApplicationHelper
layout 'base_library'
before_filter :require_login, :except => [:index, :show]
before_filter :check_authentication, except: [:index, :show]
after_filter :increment_visit_count, only: [:show, :create, :edit, :update]
def index

@ -3,7 +3,7 @@ class ManagementsController < ApplicationController
before_filter :require_business
before_filter :require_admin, :only => [:shixun_setting_list, :mirror_repository, :mirror_picture_shixuns, :editmd_template,
:editmd_template, :subject_level_system, :subject_setting_list,
:shixun_authorization, :ec_template, :codemirror_template, :update_user,
:shixun_authorization, :ec_template, :codemirror_template,
:course_guide_template, :shixun_quality_score, :tech_system, :update_notice, :setting_banner,
:training_2018, :create_standard]
layout 'base_management'
@ -220,6 +220,9 @@ class ManagementsController < ApplicationController
@user.nickname = params[:nickname]
@user.lastname = params[:lastname]
@user.business = params[:business].to_i
if params[:admin]
@user.admin = params[:admin].to_i
end
@user.firstname = ""
@user.mail = params[:mail].strip == "" ? nil : params[:mail]
@user.phone = params[:phone].strip == "" ? nil : params[:phone]
@ -1661,7 +1664,8 @@ end
# 删除单位
def delete_school
school = School.where(:id => params[:school]).first
UserExtensions.where(:school_id => params[:school]).update_all(:school_id => nil, :department_id => nil)
UserExtensions.where(:school_id => params[:school]).update_all(school_id: nil, department_id: nil)
User.joins(:user_extension).where(user_extensions: {school_id: params[:school]}).update_all(profile_completed: false)
ApplyAddSchools.where(:school_id => params[:school]).destroy_all
ApplyAddDepartment.where(:school_id => params[:school]).destroy_all
school.destroy
@ -1752,7 +1756,7 @@ end
Tiding.create(:user_id => applied_department.user_id, :trigger_user_id => 0, :container_id => applied_department.id, :container_type =>'ApplyAddDepartment', :belong_container_id => applied_department.department.school_id, :belong_container_type=> 'School', :tiding_type => "System", :status => 2, :extra => params[:reason])
# 删除学校的用户
users = UserExtensions.where("department_id = #{applied_department.department_id}")
users.update_all(:department_id => nil)
users.update_all(department_id: nil, profile_completed: false)
applied_department.department.destroy
# 已审批删除
elsif params[:tip] == "applied"
@ -1866,6 +1870,7 @@ end
# 删除学校的用户
users = UserExtensions.where("school_id = #{applied_school.school_id}")
User.where(id: users.map(&:user_id)).update_all(profile_completed: false)
# 申请了职业认证的用户撤销申请
apply_user_auth = ApplyUserAuthentication.where(:user_id => users.map(&:user_id), :auth_type => 2, :status => 0)
@ -3692,7 +3697,7 @@ end
diskfile1 = disk_filename("UserAuthentication", apply_user.user_id) +"ID"
apply_user.update_attributes(:is_delete => true)
File.delete(diskfile1)
File.delete(diskfile1) if File.exist?(diskfile1)
=begin
begin

@ -1,10 +1,11 @@
# encoding=utf-8
# For react
class ProjectPackagesController < ApplicationController
before_filter :require_login, :except => [:index, :show]
include ApplicationHelper
before_filter :require_login, except: [:index]
before_filter :check_authentication, except: [:index]
def show
render_react
end

@ -126,21 +126,26 @@ class SchoolController < ApplicationController
chinese << char
end
end
if pinyin.size > 0
search_str = "name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'"
else
search_str = "name like '%#{chinese.join("")}%'"
end
if params[:no_school_ids]
if(condition == '')
@school = School.where("id not in #{params[:no_school_ids]}").reorder('CONVERT (name USING gbk) COLLATE gbk_chinese_ci asc').page((params[:page].to_i || 1)).per(100)
@school_count = School.count
else
@school = School.where("id not in #{params[:no_school_ids]} and name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").reorder('CONVERT (name USING gbk) COLLATE gbk_chinese_ci asc').page((params[:page].to_i || 1)).per(100)
@school_count = School.where("id not in #{params[:no_school_ids]} and name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").count
@school = School.where("id not in #{params[:no_school_ids]} and #{search_str}").reorder('CONVERT (name USING gbk) COLLATE gbk_chinese_ci asc').page((params[:page].to_i || 1)).per(100)
@school_count = School.where("id not in #{params[:no_school_ids]} and #{search_str}").count
end
else
if(condition == '')
@school = School.reorder('CONVERT (name USING gbk) COLLATE gbk_chinese_ci asc').page((params[:page].to_i || 1)).per(100)
@school_count = School.count
else
@school = School.where("name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").reorder('CONVERT (name USING gbk) COLLATE gbk_chinese_ci asc').page((params[:page].to_i || 1)).per(100)
@school_count = School.where("name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").count
@school = School.where(search_str).reorder('CONVERT (name USING gbk) COLLATE gbk_chinese_ci asc').page((params[:page].to_i || 1)).per(100)
@school_count = School.where(search_str).count
end
end

@ -54,6 +54,12 @@ class WelcomeController < ApplicationController
end
end
def join_private_courses
@invitation_code = params[:invitation_code]
respond_to do |format|
format.js
end
end
def shixun_to_local
identifiers = params[:identifiers].split(",")

@ -628,18 +628,19 @@ module ApplicationHelper
return
end
=end
user_e = UserExtensions.where(:user_id => User.current.id).first
if User.current.lastname.blank? || user_e.school_id.blank? || user_e.identity.blank? || User.current.mail.blank?
redirect_to my_account_path
Rails.logger.info("check_authentication end")
elsif User.current.certification != 1 # 系统没有授权
day_cer = UserDayCertification.where(:user_id => User.current.id).last
unless (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400
redirect_to my_account_path
Rails.logger.info("check_authentication end")
return
end
end
# 暂时不需要试用授权
# if !User.current.profile_completed?
# redirect_to my_account_path
# Rails.logger.info("check_authentication end")
# elsif User.current.certification != 1 # 系统没有授权
# day_cer = UserDayCertification.where(:user_id => User.current.id).last
# unless (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400
# redirect_to my_account_path
# Rails.logger.info("check_authentication end")
# return
# end
# end
end
def match_specific_symbol(str)

@ -26,7 +26,7 @@ module WelcomeHelper
def register_info user_agent
case user_agent.register_status
when 0
"IP未登录"
"IP未登录"
when 1
"代理之前注册"
when 2

@ -32,7 +32,7 @@ class Shixun < ActiveRecord::Base
has_many :users, :through => :shixun_members
has_many :shixun_members, :dependent => :destroy
has_one :repository, :dependent => :destroy
has_many :homework_commons_shixunses
has_many :homework_commons_shixuns, class_name: 'HomeworkCommonsShixuns'
has_many :homework_challenge_settings, :dependent => :destroy
has_many :challenges, :dependent => :destroy
has_many :myshixuns, :dependent => :destroy

@ -20,11 +20,23 @@
<%
total_myshixun_count = 0
total_forked_myshixun_count = 0
total_shixun_score = 0
%>
<% @shixuns.each do |shixun| %>
<%
total_myshixun_count += shixun.myshixuns_count
total_forked_myshixun_count += shixun['forked_myshixun_count'].to_i
valid_course_count = @course_count_map.fetch(shixun.id, 0)
valid_student_count = @myshixun_count_map.fetch(shixun.id, 0)
score =
if shixun.fork_from.blank?
500 + 50 * valid_course_count + 10 * valid_student_count
else
100 + 10 * valid_course_count + 5 * valid_student_count
end
score += @forked_course_count_map.fetch(shixun.id, 0)
total_shixun_score += score
%>
<tr>
<td width="10%"><%= shixun.creator.show_real_name %></td>
@ -39,7 +51,7 @@
<td width="10%"><%= shixun.myshixuns_count.to_i.zero? ? '--' : shixun.myshixuns_count.to_i %></td>
<td width="15%"><%= shixun['forked_myshixun_count'].to_i.zero? ? '--' : shixun['forked_myshixun_count'].to_i %></td>
<td width="10%"><%= @myshixun_count_map.fetch(shixun.id, '--') %></td>
<td width="15%">--</td>
<td width="15%"><%= score.zero? ? '--' : score %></td>
</tr>
<% end %>
</tbody>
@ -50,7 +62,7 @@
<th width="10%"><%= total_myshixun_count %></th>
<th width="15%"><%= total_forked_myshixun_count %></th>
<th width="10%"><%= @myshixun_count_map.values.reduce(:+) %></th>
<th width="15%">--</th>
<th width="15%"><%= total_shixun_score %></th>
</tr>
</tfoot>
</table>
@ -73,11 +85,15 @@
<%
total_members_count = 0
total_shixun_homework_count = 0
total_course_score = 0
%>
<% @courses.each do |course| %>
<%
total_members_count += course.members_count.to_i
total_shixun_homework_count += course['shixun_homework_count'].to_i
score = 500 + 5 * @course_shixun_count_map.fetch(course.id, 0) * @course_myshixun_map.fetch(course.id, 0)
total_course_score += score
%>
<tr>
<td width="10%"><%= course.teachers.where(user_id: @team_user_ids).first.user.show_real_name %></td>
@ -89,7 +105,7 @@
<td width="10%"><%= course.members_count %></td>
<td width="15%"><%= course['shixun_homework_count'].presence || '--' %></td>
<td width="10%"><%= @course_myshixun_map.fetch(course.id, '--') %></td>
<td width="15%">--</td>
<td width="15%"><%= score.zero? ? '--' : score %></td>
</tr>
<% end %>
</tbody>
@ -99,8 +115,8 @@
<th width="40%" class="edu-txt-left"><%= @courses.size %></th>
<th width="10%"><%= total_members_count %></th>
<th width="15%"><%= total_shixun_homework_count %></th>
<th width="10%"><%= @course_myshixun_map.values.reduce(:+) %></th>
<th width="15%">--</th>
<th width="10%"><%= @course_myshixun_map.values.reduce(:+) || 0 %></th>
<th width="15%"><%= total_course_score %></th>
</tr>
</tfoot>
</table>

@ -1,134 +1,171 @@
<% index = 0 %>
<p class="second_code_1" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<% index += 1%>
<p class="second_code_2" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<% index += 1 %>
<%
challenge_description_extra = [
"模拟赛选择了第一届标注大赛正式赛第一阶段的三个项目供大家体验熟悉平台、学习其他人的标注,模拟赛标注不计分。",
"第一阶段比赛得分占正赛总比分的30%。",
"第二阶段比赛得分占正赛总比分的70%。"
]
data = [
[
{
name: 'Java项目',
description: "Weka是基于Java的机器学习与数据挖掘平台汇集了最前沿的机器学习算法包括处理标准数据挖掘问题的几乎所有方法回归、分类、聚类、关联规则以及属性选择等是Java机器学习入门的首选平台。<br/><br/>本项目的Clusters目录中包含了K-Means、层次聚类等多种聚类算法以及相应的聚类效果评估方法的java实现",
task: '标注../weka/clusterers/目录下的所有代码文件。',
link_name: 'CSDN经典聚类算法',
link_url: 'https://blog.csdn.net/qq_30262201/article/details/78799926'
},
{
name: 'C++项目',
description: "该项目是GitHub上最受欢迎的C++语言实现经典算法与数据结构的项目之一,内容涵盖排序、链表、树结构、图搜索、贪心算法等。学习这些算法的代码实现,可以深刻理解和掌握算法的核心思想,感受算法之美,代码之美,是人工智能时代的基础入门一课。<br/><br/>本项目的sort_search_problems目录涵盖了冒泡排序、快速排序等各类经典排序算法的C++实现。",
task: '标注../sort_search_problems目录下的所有代码文件及对应引用的../include目录中自定义的头文件。',
link_name: 'CSDN十大经典排序算法',
link_url: 'https://blog.csdn.net/wfq784967698/article/details/79551476'
},
{
name: 'Python项目',
description: "该项目是GitHub上最受欢迎的Python语言实现经典算法的项目之一包含了前沿的神经网络和经典数据结构及算法的Python实现。项目具有兼顾经典和前沿的特点。学习经典算法的源码实现感受经典算法的思想之美、代码之美。<br/><br/>本项目的Sorts目录中包含了冒泡排序、快速排序等各类经典排序算法的Python实现。",
task: '标注../sorts/目录下的所有代码文件。',
link_name: 'CSDN十大经典排序算法',
link_url: 'https://blog.csdn.net/wfq784967698/article/details/79551476'
},
],
[{},{},{}],
[{},{},{}]
]
%>
<% @competition.competition_stages.includes(:competition_stage_sections).each_with_index do |stage, i| %>
<div class="second_code_<%= index + 1 %>" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;">
<%
first_section = stage.competition_stage_sections[0]
second_section = stage.competition_stage_sections[1]
%>
<div class="enter_panel" style="<%= i.zero? ? "height: 1212px" : ''%>">
<% if i.zero? %>
<p class="challenge_title"><%= stage.name %></p>
<% end %>
<ul class="clearfix challenge_sub_title">
<li class="fl">
<span class="mr20"><%= first_section.try(:name) %></span>
<span><%= format_time first_section.start_time %> ~ <%= com_end_time first_section.end_time %></span>
</li>
<li class="fr">
<span class="mr20"><%= second_section.try(:name) %></span>
<span><%= format_time second_section.try(:start_time) %> ~ <%= com_end_time second_section.try(:end_time) %></span>
</li>
</ul>
<p class="break_word font-18 challenge_describe">
标注说明:每个小组选择一种编程语言的题目,针对标注任务中指定的标注模块,要求对代码模块、模块中的代码文件, 以及文件中的函数必须进行标注,关键代码块、代码行及关键变量等由参赛者自由选择进行标注。 正式赛第一阶段的比赛在标注阶段就开放查看所有人的标注,请大家根据个人理解,写出自己的风格。我们将综合考虑标注的原创性、准确性、 完整性和多样性等不同的维度对标注质量进行评分。<%= challenge_description_extra[i] %>
</p>
<ul class="mt30">
<% first_section.competition_entries.each_with_index do |entry, j| %>
<% row_data = data[i][j] %>
<li class="challenge_box">
<p class="challenge_b_t"><%= row_data[:name] || entry.name %></p>
<p class="enter_btn mb40 clearfix">
<%
is_start = Time.now > first_section.start_time
competition_url = User.current.logged? ? "#{entry.url}?eid=#{User.current.id}" : "#{entry.url}"
btn_url = is_start ? "#{competition_url}" : "javascript:void(0);"
%>
<a class="setNewBnt <%= is_start ? 'active' : '' %>"
href="javascript:void(0);"
data-url="<%= btn_url %>"><%= entry.name %></a>
</p>
<% if row_data.present? %>
<p class="challenge_b_d">项目简介</p>
<p class="break-word challenge_b_des"><%= raw row_data[:description] %></p>
<p class="challenge_b_d">标注任务</p>
<p class="break-word challenge_b_des" style="color: #FC2F78;min-height: 60px"><%= row_data[:task] %></p>
<p class="challenge_b_d">经典算法解读:</p>
<ul class="clearfix algorithm">
<a href="<%= row_data[:link_url] %>" target="_blank"><%= row_data[:link_name] %></a>
</ul>
<p class="enter_btn clearfix">
<a href="javascript:void(0);"
data-url="<%= btn_url %>"
class="setNewBnt <%= is_start ? 'active' : '' %>">点击进入代标注模块</a>
</p>
<% end %>
</li>
<% end %>
</ul>
</div>
</div>
<% index += 1 %>
<% end %>
<p class="second_code_6" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<% index += 1 %>
<p class="second_code_7" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<% index += 1 %>
<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;
})
})
<% index = 0 %>
<p class="second_code_1" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<% index += 1%>
<p class="second_code_2" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<% index += 1 %>
<%
challenge_description_extra = [
"模拟赛选择了第一届标注大赛正式赛第一阶段的三个项目供大家体验熟悉平台、学习其他人的标注,模拟赛标注不计分。",
"第一阶段比赛得分占正赛总比分的30%。",
"第二阶段比赛得分占正赛总比分的70%。"
]
data = [
[
{
name: 'Java项目',
description: "Weka是基于Java的机器学习与数据挖掘平台汇集了最前沿的机器学习算法包括处理标准数据挖掘问题的几乎所有方法回归、分类、聚类、关联规则以及属性选择等是Java机器学习入门的首选平台。<br/><br/>本项目的Clusters目录中包含了K-Means、层次聚类等多种聚类算法以及相应的聚类效果评估方法的java实现",
task: '标注../weka/clusterers/目录下的所有代码文件。',
link_name: 'CSDN经典聚类算法',
link_url: 'https://blog.csdn.net/qq_30262201/article/details/78799926'
},
{
name: 'C++项目',
description: "该项目是GitHub上最受欢迎的C++语言实现经典算法与数据结构的项目之一,内容涵盖排序、链表、树结构、图搜索、贪心算法等。学习这些算法的代码实现,可以深刻理解和掌握算法的核心思想,感受算法之美,代码之美,是人工智能时代的基础入门一课。<br/><br/>本项目的sort_search_problems目录涵盖了冒泡排序、快速排序等各类经典排序算法的C++实现。",
task: '标注../sort_search_problems目录下的所有代码文件及对应引用的../include目录中自定义的头文件。',
link_name: 'CSDN十大经典排序算法',
link_url: 'https://blog.csdn.net/wfq784967698/article/details/79551476'
},
{
name: 'Python项目',
description: "该项目是GitHub上最受欢迎的Python语言实现经典算法的项目之一包含了前沿的神经网络和经典数据结构及算法的Python实现。项目具有兼顾经典和前沿的特点。学习经典算法的源码实现感受经典算法的思想之美、代码之美。<br/><br/>本项目的Sorts目录中包含了冒泡排序、快速排序等各类经典排序算法的Python实现。",
task: '标注../sorts/目录下的所有代码文件。',
link_name: 'CSDN十大经典排序算法',
link_url: 'https://blog.csdn.net/wfq784967698/article/details/79551476'
},
],
[{
name: 'Java项目',
description: "CoreNLP是一个Java自然语言分析库是斯坦福大学自然语言处理小组的研究成果它集成了所有的自然语言处理工具分词、词性标注、依存句法分析、命名实体识别等。<br/><br/>本项目的stanford/nlp/parser/目录中包含了Lexparser、nndep以及Shiftreduce等句法分析算法的Java实现。",
task: '标注../stanford/nlp/parser/目录下的所有代码文件(包括子目录)。',
link_name: 'CSDN, 使用Stanford Parser进行句法分析',
link_url: 'https://blog.csdn.net/u010239102/article/details/78111760'
},{
name: 'C++项目',
description: "Sentencepiece是Google公司开发的一个C++自然语言处理工具包,它实现了数据驱动、跨语言、高性能、轻量级的面向神经网络文本生成系统的无监督文本词条化工具。<br/><br/>本项目的src/目录中包含了BPE、Unigram以及Char等文本分词算法的C++实现。",
task: '标注../src/目录下的所有.cc和.h代码文件不包括子目录。',
link_name: 'CSDN, sentencePiece入门小结',
link_url: 'https://blog.csdn.net/sinat_33455447/article/details/90265938'
},{
name: 'Python项目',
description: "NLTK是宾西法尼亚大学计算机和信息科学系开发的一个Python自然语言处理工具包它提供了易于使用的接口通过这些接口可以访问超过50个语料库和词汇资源如WordNet还有一套用于分类、标记化、词干标记、解析和语义推理的文本处理库。<br/><br/>本项目的nltk/stem/目录中包含了Lancaster、Porter以及Snowball等文本分词算法的Python实现。",
task: '标注../nltk/stem/目录下的所有代码文件。',
link_name: 'CSDN, 英文分词的算法和原理',
link_url: 'https://blog.csdn.net/wisdom77/article/details/79446674'
}],
[{
name: 'Java项目',
description: "Deeplearning4j是Eclipse公司开发的支持各种深度学习算法的运算框架它可以实施的技术包括受限玻尔兹曼机、深度置信网络、深度自动编码器、堆叠式降噪自动编码器、循环神经张量网络以及word2vec、doc2vec和GloVe等。<br/><br/>本项目的nn/layers/recurrent/目录中包含了循环神经网络RNN中LSTM、Bidirectional LSTM等算法的Java实现。",
task: '标注../nn/layers/recurrent/目录下的所有代码文件。',
link_name: '官方DL4J快速入门指南',
link_url: 'https://deeplearning4j.org/cn/quickstart'
},{
name: 'C++项目',
description: "TensorFlow是谷歌人工智能团队开发的用于机器学习和深度神经网络研究的开源框架它在图形分类、音频处理、推荐系统和自然语言处理等场景下都有丰富的应用提供了丰富的API包括基本的向量矩阵计算、各种优化算法、各种卷积神经网络和循环神经网络基本单元的实现、以及可视化的辅助工具等。<br/><br/>本项目的core/kernels/rnn/目录中包含了循环神经网络RNN中卷积GEMM、LSTM以及GRU算法的C++实现。",
task: '标注../core/kernels/rnn/目录下的所有代码文件。',
link_name: 'CSDN, 深度学习之RNN(循环神经网络)',
link_url: 'https://blog.csdn.net/qq_32241189/article/details/80461635'
},{
name: 'Python项目',
description: "Keras是Google公司开发的高度模块化的神经网络学习框架它是一个高层神经网络API能够支持简易和快速的原型设计支持CNN和RNN或二者的结合且能够支持无缝CPU和GPU切换。<br/><br/>本项目的keras/layers/目录中包含了神经网络运算层中Embedding、CNN以及RNN等算法的Python实现。",
task: '标注../keras/layers/目录下的所有代码文件。',
link_name: '官方, Keras说明文档',
link_url: 'https://keras.io/layers/about-keras-layers/'
}]
]
%>
<% @competition.competition_stages.includes(:competition_stage_sections).each_with_index do |stage, i| %>
<div class="second_code_<%= index + 1 %>" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;">
<%
first_section = stage.competition_stage_sections[0]
second_section = stage.competition_stage_sections[1]
%>
<div class="enter_panel" style="<%= i.zero? ? "height: 1212px" : ''%>">
<p class="challenge_title"><%= stage.name %></p>
<ul class="clearfix challenge_sub_title">
<li class="fl">
<span class="mr20"><%= first_section.try(:name) %></span>
<span><%= format_time first_section.start_time %> ~ <%= com_end_time first_section.end_time %></span>
</li>
<li class="fr">
<span class="mr20"><%= second_section.try(:name) %></span>
<span><%= format_time second_section.try(:start_time) %> ~ <%= com_end_time second_section.try(:end_time) %></span>
</li>
</ul>
<p class="break_word font-18 challenge_describe">
标注说明:每个小组选择一种编程语言的题目,针对标注任务中指定的标注模块,要求对代码模块、模块中的代码文件, 以及文件中的函数必须进行标注,关键代码块、代码行及关键变量等由参赛者自由选择进行标注。 正式赛第一阶段的比赛在标注阶段就开放查看所有人的标注,请大家根据个人理解,写出自己的风格。我们将综合考虑标注的原创性、准确性、 完整性和多样性等不同的维度对标注质量进行评分。<%= challenge_description_extra[i] %>
</p>
<ul class="mt30">
<% first_section.competition_entries.each_with_index do |entry, j| %>
<% row_data = data[i][j] %>
<li class="challenge_box">
<p class="challenge_b_t"><%= row_data[:name] || entry.name %></p>
<p class="enter_btn mb40 clearfix">
<%
is_start = Time.now > first_section.start_time
competition_url = User.current.logged? ? "#{entry.url}?eid=#{User.current.id}" : "#{entry.url}"
btn_url = is_start ? "#{competition_url}" : "javascript:void(0);"
%>
<a class="setNewBnt <%= is_start ? 'active' : '' %>"
href="javascript:void(0);"
data-url="<%= btn_url %>"><%= entry.name %></a>
</p>
<% if row_data.present? %>
<p class="challenge_b_d">项目简介</p>
<p class="break-word challenge_b_des"><%= raw row_data[:description] %></p>
<p class="challenge_b_d">标注任务</p>
<% if index ==2 %>
<p class="break-word challenge_b_des" style="color: #FC2F78;min-height: 60px"><%= row_data[:task] %></p>
<% else %>
<p class="break-word challenge_b_des" style="color: #FC2F78;min-height: 80px"><%= row_data[:task] %></p>
<% end %>
<p class="challenge_b_d">经典算法解读:</p>
<ul class="clearfix algorithm">
<a href="<%= row_data[:link_url] %>" target="_blank"><%= row_data[:link_name] %></a>
</ul>
<p class="enter_btn clearfix">
<a href="javascript:void(0);"
data-url="<%= btn_url %>"
class="setNewBnt <%= is_start ? 'active' : '' %>">点击进入代标注模块</a>
</p>
<% end %>
</li>
<% end %>
</ul>
</div>
</div>
<% index += 1 %>
<% end %>
<p class="second_code_6" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<% index += 1 %>
<p class="second_code_7" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<% index += 1 %>
<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,6 +17,7 @@
first_stage = @competition.competition_stages.first
first_section = first_stage.competition_stage_sections.first
first_entry = first_section.competition_entries.first
second_entry = first_section.competition_entries.second
is_start = Time.now > first_section.start_time
competition_url = User.current.logged? ? "#{first_entry.url}?eid=#{User.current.id}" : "#{first_entry.url}"
btn_url = is_start ? "#{competition_url}" : "javascript:void(0);"
@ -44,8 +45,8 @@
user_enrolled = false
invite_code = nil
if first_entry.url.present?
course_id = first_entry.url.split('/')[-2, 1]
if first_entry.url.present? && second_entry.url.present?
course_id = second_entry.url
course = Course.find_by_id(course_id)
if course.present? && @user && @user.logged?
@ -56,6 +57,14 @@
%>
var userEnrolled = <%= user_enrolled %>;
var userProfileModal = function(url, str) {
var htmlvalue = '<div class="task-popup" style="width:480px;"><div class="task-popup-title clearfix">提示</div>'+
'<div class="task-popup-content"><p class="task-popup-text-center font-16">' + str + '</p></div>' +
'<div class="task-popup-submit clearfix"><a href="javascript:void(0);" onclick="hideModal();" class="task-btn fl">取消</a>'+
'<a href="'+ url +'" class="task-btn task-btn-orange fr" target="_blank" onclick="hideModal();">立即完善</a></div></div>';
pop_box_new(htmlvalue, 480, 205);
}
$(".enroll-btn.active").on("click", function(){
var url = $(this).data("url");
@ -64,6 +73,11 @@
return;
}
if (<%= !@user.profile_completed? %>) {
userProfileModal('/my/account?need_profile_completed=true', '您需要去完善您的个人资料,才能使用此功能');
return
}
if (!userEnrolled) {
$.ajax({
url: "/api/courses/apply_to_join_course.json",

@ -5,8 +5,10 @@
<% if @maximum_staff > 1 %>
<p class="sub_title"><%= @competition.sub_title %></p>
<p class="edu-txt-right inline mt20">
<% unless User.current.logged? %>
<% if !User.current.logged? %>
<%= link_to "创建战队", signin_path, :remote => true, :class => "enroll-in-b enroll-in-b-green fr" %>
<% elsif !User.current.try(:profile_completed?) %>
<%= link_to "创建战队", 'javascript:void(0)', :class => "enroll-in-b enroll-in-b-green fr", onclick: "userProfileModal()" %>
<% else %>
<% unless @competition.enroll_end_time.present? && @competition.enroll_end_time < Time.now %>
<% if !@can_enroll %>
@ -19,8 +21,10 @@
<% end %>
<% end %>
<% unless User.current.logged? %>
<% if !User.current.logged? %>
<%= link_to "加入战队", signin_path, :remote => true, :class => "enroll-in-b fr" %>
<% elsif !User.current.try(:profile_completed?) %>
<%= link_to "加入战队", 'javascript:void(0)', :class => "enroll-in-b fr", onclick: "userProfileModal()" %>
<% else %>
<% unless @competition.enroll_end_time.present? && @competition.enroll_end_time < Time.now %>
<% if !@can_enroll %>
@ -153,6 +157,14 @@
pop_box_new(htmlvalue, 500, 205);
}
function userProfileModal() {
var htmlvalue = '<div class="task-popup" style="width:480px;"><div class="task-popup-title clearfix">提示</div>'+
'<div class="task-popup-content"><p class="task-popup-text-center font-16">您需要去完善您的个人资料,才能使用此功能</p></div>' +
'<div class="task-popup-submit clearfix"><a href="javascript:void(0);" onclick="hideModal();" class="task-btn fl">取消</a>'+
'<a href="/my/account?need_profile_completed=true" class="task-btn task-btn-orange fr" onclick="hideModal();">立即完善</a></div></div>';
pop_box_new(htmlvalue, 480, 205);
}
function joinSure() {
if ($("#codeinput").val().trim() == "") {
$("#codeInput-notice").html("请输入邀请码");

@ -1,6 +1,10 @@
<div class="newFooter edu-txt-center"> <!-- 底部导航栏 -->
<div class="inner-footer_con">
<div class="footercon">
<!-- <div class="inline mt40">-->
<%#= link_to image_tag("/images/educoder/headNavLogo.png", alt:"高校智能化教学与实训平台" , width: "70px"), home_path,:class => "fl",:style => "height:70px" %>
<!-- <span class="fl color-grey-c cdefault font-28 ml30" style="line-height:74px">EduCoder.NET</span>-->
<!-- </div>-->
<ul class="clearfix inner-footernav">
<li><a href="<%= home_path %>" class="fl">网站首页</a></li>
<li><a href="<%= help_path(:index => 1) %>" class="fl">关于我们</a></li>

@ -85,8 +85,14 @@
<li><%= link_to '新建项目', new_project_path() %></li>
</ul>
<ul class="fl with50 edu-txt-center">
<li><%= link_to "加入课堂", join_private_courses_users_path, :remote => true %></li>
<li><%= link_to "加入项目", applied_join_project_path, :remote => true %></li>
<li>
<% if User.current.profile_completed? %>
<%= link_to "加入课堂", join_private_courses_path, :remote => true %>
<% else %>
<%= link_to "加入课堂", 'javascript:void(0)', onclick: 'showUserProfileModal()' %>
<% end %>
</li>
<!-- <li><%#= link_to "加入项目", applied_join_project_path, :remote => true %></li>-->
</ul>
</div>
</div>
@ -154,4 +160,12 @@
<% end %>
});
function showUserProfileModal() {
var htmlvalue = '<div class="task-popup" style="width:480px;"><div class="task-popup-title clearfix">提示</div>'+
'<div class="task-popup-content"><p class="task-popup-text-center font-16">您需要去完善您的个人资料,才能使用此功能</p></div>' +
'<div class="task-popup-submit clearfix"><a href="javascript:void(0);" onclick="hideModal();" class="task-btn fl">取消</a>'+
'<a href="/my/account?need_profile_completed=true" class="task-btn task-btn-orange fr" onclick="hideModal();">立即完善</a></div></div>';
pop_box_new(htmlvalue, 480, 205);
}
</script>

@ -51,9 +51,9 @@
</div>
<span class="font-15 fr mt15 ml15">
<a href="www.educoder.net/login" class="mr5 color-white">登录</a>
<a href="/login" class="mr5 color-white">登录</a>
<em class="vertical-line"></em>
<a href="www.educoder.net/register" class="mr5 color-white">登录</a>
<a href="/register" class="mr5 color-white">注册</a>
<%#= link_to '注册', user_join_path, :class => "ml5 color-white" %>
</span>
<div class="fr head-right">
@ -72,7 +72,7 @@
</ul>
<ul class="fl with50 edu-txt-center">
<li><%= link_to "加入课堂", signin_path, :remote => true %></li>
<li><%= link_to "加入项目", applied_join_project_path, :remote => true %></li>
<!-- <li><%#= link_to "加入项目", applied_join_project_path, :remote => true %></li>-->
</ul>
</div>
</div>

@ -190,6 +190,15 @@
<input type="checkbox" <%= @user.business? ? "checked" : "" %> name="business" value="<%= @user.business? ? "1" : "0" %>" id="person_business" class="magic-checkbox" style="float:left; margin-top: 8px;">
<label for="person_business"></label>
</span>
<% if User.current.admin? %>
<label class="panel-form-label fl mr18">管理员:</label>
<span class="fl">
<input type="checkbox" <%= @user.admin? ? "checked" : "" %> id="person_admin" class="magic-checkbox" style="float:left; margin-top: 8px;">
<label for="person_admin"></label>
</span>
<input type="hidden" id="user_admin" name="admin" value="<%= @user.admin? ? "1" : "0" %>">
<% end %>
</li>
<li class="clearfix mb10 hascontont">
<label class="panel-form-label fl mr18">职业:</label>
@ -625,7 +634,14 @@
}else{
document.getElementById('person_business').value = "0";
}
<% if User.current.admin? %>
var admin_check = document.getElementById('person_admin').checked;
if (admin_check) {
document.getElementById('user_admin').value = "1";
} else {
document.getElementById('user_admin').value = "0";
}
<% end %>
my_account_form_submit();
});
function my_account_form_submit(){

@ -0,0 +1,2 @@
var htmlvalue = "<%= escape_javascript(render :partial => 'courses/join_private_course') %>";
pop_box_new(htmlvalue,460,220);

@ -1670,7 +1670,6 @@ RedmineApp::Application.routes.draw do ## oauth相关
get 'html_show'
get 'switch_user_module'
get 'reward_grade'
match 'join_private_courses', :via => [:get, :post]
end
member do
@ -2606,6 +2605,7 @@ RedmineApp::Application.routes.draw do ## oauth相关
########################
##added by wen##########
#######confusing########
match 'welcome/join_private_courses', to: 'welcome#join_private_courses', :via => [:get, :post], :as => 'join_private_courses'
get 'welcome/search', to: 'welcome#search'
get 'school/index', to: 'school#index'
get 'school/:school_id', to:

@ -257,6 +257,23 @@ class NewHeader extends Component {
localStorage.setItem('competition_uid', true);
}
NewCoursesAndShixuns=(sum)=>{
if(this.props.current_user&&this.props.current_user.login=== ""){
window.location.href = "/login";
}else{
if(sum===1){
window.location.href = "/courses/new";
}else if(sum===2){
window.location.href = "/shixuns/new";
}else if(sum===3){
window.location.href = "/paths/new";
}else if(sum===4){
window.location.href = "/projects/new";
}
}
}
render() {
let {careerslist,isLogin,current_user,ImageUrl,ecUrl,ImageUrlType,project_packages_url} = this.state;
// const isLogin = isLogintype; // 这里不会出现未登录的情况,服务端在服务端路由时发现如果是未登录,则跳转到登录页了。
@ -291,7 +308,8 @@ class NewHeader extends Component {
// console.log(match.path)
console.log(this.props.current_user&&this.props.current_user.login=== "")
console.log(this.state.current_user)
// console.log(match.path.startsWith("/ec_courses"))
return (
<div className="newHeader" id="nHeader">
@ -459,10 +477,10 @@ class NewHeader extends Component {
<div className="edu-menu-list" style={{top: '60px',width:"240px"}}>
<div className="overPart"></div>
<ul className="fl with50 edu-txt-center pr ul-leftline">
<li><a href="/courses/new">新建课堂</a></li>
<li><a href="/shixuns/new">新建实训</a></li>
<li><a href="/paths/new">新建实践课程</a></li>
<li><a href="/projects/new">新建项目</a></li>
<li><a onClick={()=>this.NewCoursesAndShixuns(1)}>新建课堂</a></li>
<li><a onClick={()=>this.NewCoursesAndShixuns(2)}>新建实训</a></li>
<li><a onClick={()=>this.NewCoursesAndShixuns(3)}>新建实践课程</a></li>
<li><a onClick={()=>this.NewCoursesAndShixuns(4)}>新建项目</a></li>
</ul>
<ul className="fl with50 edu-txt-center">
<li>

@ -659,8 +659,8 @@ a.enterLink{cursor: pointer;color: #418CCD!important;background: none!important;
.second_code_1{min-height: 791px;}
.second_code_2{min-height: 436px;}
.second_code_3{min-height: 1460px;padding-top: 190px;box-sizing: border-box;position: relative}
.second_code_4{min-height: 724px;padding-top: 190px;box-sizing: border-box;position: relative}
.second_code_5{min-height: 718px;padding-top: 190px;box-sizing: border-box;position: relative}
.second_code_4{min-height: 1459px;padding-top: 190px;box-sizing: border-box;position: relative}
.second_code_5{min-height: 1464px;padding-top: 190px;box-sizing: border-box;position: relative}
.second_code_6{min-height: 1060px;}
.second_code_7{min-height: 1116px;}
.second_code_8{min-height: 711px;}
@ -709,16 +709,16 @@ li.challenge_box{
font-size: 30px;color: #0E8B87;line-height: 30px;margin-bottom: 30px;
}
.challenge_b_d{
color: #0B8298;font-size: 20px;line-height: 20px;text-align: left;font-weight: bold;margin-bottom: 40px;padding-left: 3px;
color: #0B8298;font-size: 20px;line-height: 20px;text-align: left;font-weight: bold;margin-bottom: 30px;padding-left: 3px;
}
.challenge_b_des{
line-height: 20px;color: #0B8298;font-size: 18px;text-align: left;text-align:justify;margin-bottom: 40px;min-height: 220px;
line-height: 20px;color: #0B8298;font-size: 18px;text-align: left;text-align:justify;margin-bottom: 30px;min-height: 240px;
}
li.challenge_box:last-child{
margin-right: 0px;
}
.algorithm{margin-bottom: 40px;}
.algorithm a{display: block;text-align: left;color: #23A8FD;position: relative;float: left;font-size: 18px;line-height: 22px;}
.algorithm a{display: block;text-align: left;color: #23A8FD;position: relative;float: left;font-size: 17px;line-height: 22px;}
.algorithm a:after{position: absolute;left: 0px;bottom: -2px;background:#23A8FD;width: 100%;height: 1px;content: ''; }

@ -192,7 +192,7 @@ input::-ms-clear{display:none;}
.newContainer{ min-height:100%; height: auto !important; height: 100%; /*IE6不识别min-height*/position: relative;}
.educontent{width: 1200px;margin:0px auto;box-sizing: border-box}/*中间部分宽度固定为1200*/
.newMain{ margin: 0 auto; padding-bottom: 235px; min-width:1200px;padding-top: 60px}/*padding-bottom根据底部的高度而定*/
.newMain{ padding-bottom: 120px !important; }
.newMain{ padding-bottom: 110px !important; }
/*高度*/
.height-100{height: 100%;}

Loading…
Cancel
Save