Merge branch 'educoder' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder

dev_local_lzdx
jingquan huang 5 years ago
commit 69be09fe3b

@ -85,7 +85,7 @@ class CollegesController < ApplicationController
homeworks = HomeworkCommon.where(:homework_type => 4, :course_id => course_ids.map(&:id)) homeworks = HomeworkCommon.where(:homework_type => 4, :course_id => course_ids.map(&:id))
un_shixun_work_count = homeworks.where("publish_time > '#{Time.now}' or publish_time is null").count un_shixun_work_count = homeworks.where("publish_time > '#{Time.now}' or publish_time is null").count
shixun_work_count = homeworks.size - un_shixun_work_count shixun_work_count = homeworks.size - un_shixun_work_count
student_count = StudentsForCourse.where(:course_id => course_ids.map(&:id)).count student_count = CourseMember.where(:course_id => course_ids.map(&:id), :role => 4).count
myshixun_ids = StudentWork.select("myshixun_id").where("homework_common_id in (#{homeworks.map(&:id).join(',').strip == "" ? -1 : homeworks.map(&:id).join(',')}) and myshixun_id is not null") myshixun_ids = StudentWork.select("myshixun_id").where("homework_common_id in (#{homeworks.map(&:id).join(',').strip == "" ? -1 : homeworks.map(&:id).join(',')}) and myshixun_id is not null")
complete_myshixun = Myshixun.select("id").where(:status => 1, :id => myshixun_ids.map(&:myshixun_id)).size complete_myshixun = Myshixun.select("id").where(:status => 1, :id => myshixun_ids.map(&:myshixun_id)).size
all_myshixun = Myshixun.select("id").where(:id => myshixun_ids.map(&:myshixun_id)).size all_myshixun = Myshixun.select("id").where(:id => myshixun_ids.map(&:myshixun_id)).size
@ -128,7 +128,7 @@ class CollegesController < ApplicationController
# 在线课堂 # 在线课堂
def course_statistics def course_statistics
@courses = Course.find_by_sql("SELECT c.id, (select concat(lastname,firstname) from users u where u.id=c.tea_id) as username, @courses = Course.find_by_sql("SELECT c.id, (select concat(lastname,firstname) from users u where u.id=c.tea_id) as username,
(select count(sfc.id) from students_for_courses sfc where c.id=sfc.course_id group by c.id) as student_count, (select count(cm.id) from course_members cm where c.id=cm.course_id and cm.role=4 group by c.id) as student_count,
(select count(hc.id) from homework_commons hc where c.id=hc.course_id and hc.homework_type=4 group by c.id) as hcm_count, (select count(hc.id) from homework_commons hc where c.id=hc.course_id and hc.homework_type=4 group by c.id) as hcm_count,
(select count(hc.id) from homework_commons hc where c.id=hc.course_id and hc.homework_type in (1,3) group by c.id) as hcm_nonshixun_count, (select count(hc.id) from homework_commons hc where c.id=hc.course_id and hc.homework_type in (1,3) group by c.id) as hcm_nonshixun_count,
(select count(e.id) from exercises e where c.id=e.course_id group by c.id) as exercises_count, (select count(e.id) from exercises e where c.id=e.course_id group by c.id) as exercises_count,

@ -18,9 +18,18 @@ class CompetitionTeamsController < ApplicationController
def shixun_detail def shixun_detail
return render_404 if @competition.identifier != 'gcc-course-2019' return render_404 if @competition.identifier != 'gcc-course-2019'
@competition_completed = false
# 竞赛正在进行,分数动态计算
@team_user_ids = @team.team_members.pluck(:user_id) @team_user_ids = @team.team_members.pluck(:user_id)
# 竞赛结束并且分数已经统计
if @competition.end_time < Time.current && CompetitionCourseRecord.exists?(competition_id: @competition.id)
@competition_completed = true
@records = CompetitionCourseRecord.where(type: 'CompetitionCourseShixunRecord', competition_team_id: @team.id)
return
end
shixuns = Shixun.where(user_id: @team_user_ids, status: 2) 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) .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.joins('left join shixuns forked_shixuns on forked_shixuns.fork_from = shixuns.id and forked_shixuns.status = 2')
@ -48,9 +57,17 @@ class CompetitionTeamsController < ApplicationController
def course_detail def course_detail
return render_404 if @competition.identifier != 'gcc-course-2019' return render_404 if @competition.identifier != 'gcc-course-2019'
@competition_completed = false
@team_user_ids = @team.team_members.pluck(:user_id) @team_user_ids = @team.team_members.pluck(:user_id)
# 竞赛结束并且分数已经统计
if @competition.end_time < Time.current && CompetitionCourseRecord.exists?(competition_id: @competition.id)
@competition_completed = true
@records = CompetitionCourseRecord.where(type: 'CompetitionCourseCourseRecord', competition_team_id: @team.id)
return
end
student_count_subquery = CourseMember.where('course_id = courses.id AND role = 4').select('count(*)').to_sql student_count_subquery = CourseMember.where('course_id = courses.id AND role = 4').select('count(*)').to_sql
subquery = StudentWork.where('homework_common_id = hcs.id') subquery = StudentWork.where('homework_common_id = hcs.id')
.select('sum(compelete_status !=0 ) as finish, count(*) as total') .select('sum(compelete_status !=0 ) as finish, count(*) as total')

@ -188,7 +188,7 @@ class CompetitionsController < ApplicationController
end end
end end
end end
if @competition.identifier == "gcc-annotation-2018" if @competition.identifier == "gcc-annotation-2018" || @competition.identifier == "gcc-course-2019"
@rule_content = @competition.chart_rules.first @rule_content = @competition.chart_rules.first
else else
@rule_content = @competition.chart_rules.where(:competition_stage_id => @stage.try(:id)).first @rule_content = @competition.chart_rules.where(:competition_stage_id => @stage.try(:id)).first
@ -305,7 +305,7 @@ class CompetitionsController < ApplicationController
end end
records_length = 97 records_length = 97
@records = @records[0..records_length] @records = @records[0..records_length]
elsif @competition.identifier == "gcc-annotation-2018" elsif @competition.identifier == "gcc-annotation-2018" || @competition.identifier == "gcc-course-2019"
@records = @competition.competition_teams.includes(:user => [:user_extensions => [:school]]) @records = @competition.competition_teams.includes(:user => [:user_extensions => [:school]])
@records.each do |team| @records.each do |team|
team[:s_score] = team.competition_scores.where(:competition_id => @competition.id).first.try(:score).to_f.try(:round, 3) team[:s_score] = team.competition_scores.where(:competition_id => @competition.id).first.try(:score).to_f.try(:round, 3)
@ -494,7 +494,7 @@ class CompetitionsController < ApplicationController
sheet1[count_row,10] = com_spend_time team[:s_spend_time].to_i sheet1[count_row,10] = com_spend_time team[:s_spend_time].to_i
count_row += 1 count_row += 1
end end
elsif @competition.identifier == "gcc-annotation-2018" elsif @competition.identifier == "gcc-annotation-2018" || @competition.identifier == "gcc-course-2019"
records = @competition.competition_teams records = @competition.competition_teams
records.each do |team| records.each do |team|
team[:s_score] = team.competition_scores.where(:competition_id => @competition.id).first.try(:score).to_f.try(:round, 3) team[:s_score] = team.competition_scores.where(:competition_id => @competition.id).first.try(:score).to_f.try(:round, 3)
@ -749,7 +749,7 @@ class CompetitionsController < ApplicationController
# rate 关卡经验值与分数的比值 # rate 关卡经验值与分数的比值
# challenge_count 每个实训的关卡数 # challenge_count 每个实训的关卡数
# 对三个实训的所有关卡循环: 找到在比赛时间内通关的最低耗时 # 对三个实训的所有关卡循环: 找到在比赛时间内通关的最低耗时
def chart_exp_score_pre user_ids, s_time, e_time, challenges, rate, challenge_count def chart_exp_score_pre user_ids, s_time, e_time, challenges, s_rate, challenge_count
total_score = 0 total_score = 0
total_time = 0 total_time = 0
length = challenge_count #每个实训的关卡数 length = challenge_count #每个实训的关卡数
@ -758,7 +758,7 @@ class CompetitionsController < ApplicationController
time = 0 time = 0
challenges.where(:position => i).each do |challenge| challenges.where(:position => i).each do |challenge|
Game.where(:challenge_id => challenge.id, :user_id => user_ids, :status => 2).select{|game| game.open_time >= s_time && game.end_time <= e_time }.each do |game| Game.where(:challenge_id => challenge.id, :user_id => user_ids, :status => 2).select{|game| game.open_time >= s_time && game.end_time <= e_time }.each do |game|
game_score = challenge.score * rate game_score = challenge.score * s_rate
cost_time = (game.end_time.to_i - s_time.to_i) > 0 ? (game.end_time.to_i - s_time.to_i) : 0 cost_time = (game.end_time.to_i - s_time.to_i) > 0 ? (game.end_time.to_i - s_time.to_i) : 0
if score < game_score if score < game_score
score = game_score score = game_score

@ -29,12 +29,21 @@ class ManagementsController < ApplicationController
end end
def user_agents def user_agents
@user_agents = UserAgent.where("user_agents.key is not order by action_status, register_status") @user_agents = UserAgent.where("user_agents.key is not null").order("action_status asc, register_status asc")
@agents_count = @user_agents.count @agents_count = @user_agents.count
limit = 20 limit = 20
@agents_pages = Paginator.new @agents_count, limit, params['page'] || 1 @agents_pages = Paginator.new @agents_count, limit, params['page'] || 1
@offset ||= @agents_pages.offset @offset ||= @agents_pages.offset
@user_agents = paginateHelper @user_agents, limit @user_agents = paginateHelper @user_agents, limit
respond_to do |format|
format.html
format.xls{
time = Time.now.strftime("%Y%m%d")
filename = "引流情况#{time}.xls"
send_data(user_agents_export(), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename))
}
end
end end
# 实训课程等级体系 # 实训课程等级体系
@ -387,7 +396,7 @@ class ManagementsController < ApplicationController
# 搜索镜像 # 搜索镜像
def mirror_search def mirror_search
@scope = [] @scope = []
if params[:q] && params[:q].lstrip.rstrip != "" if params[:q] && params[:q].strip != ""
@scope = MirrorRepository.where("name like ?", "%#{params[:q]}%").map(&:name) @scope = MirrorRepository.where("name like ?", "%#{params[:q]}%").map(&:name)
end end
respond_to do |format| respond_to do |format|
@ -2210,6 +2219,16 @@ end
end end
end end
# 讨论区邮件通知
def course_board_email_notify
if params[:course_id]
course = Course.find params[:course_id]
course.update_attributes(:email_notify => !course.email_notify)
end
end
# 课程实训 # 课程实训
def class_shixuns def class_shixuns
@menu_type = 4 @menu_type = 4
@ -4359,6 +4378,39 @@ end
return sheet.rows return sheet.rows
end end
def user_agents_export
xls_report = StringIO.new
book = Spreadsheet::Workbook.new
sheet1 = book.create_worksheet :name => "引流名单"
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
sheet1.row(0).default_format = blue
count_row = 1
sheet1.row(0).concat(["序号", "LoginId", "姓名", "学校名称", "手机号", "邮箱", "参赛人数", "参赛队伍", "访问量"])
user_agents = UserAgent.where("user_agents.key is not null").pluck(:key).uniq
user_agents.each_with_index do |agent, index|
user = User.find_by_login(agent)
next if user.blank?
# 代理用户
agents = UserAgent.where(key: agent)
agents_count = agents.count
competion_users = agents.where(action_status: 2).pluck(:ip)
rank_user_id = UserActions.where(ip: competion_users).pluck(:user_id).uniq
team_ids = TeamMember.where(user_id: rank_user_id).pluck(:competition_team_id).uniq
sheet1[count_row, 0] = index + 1
sheet1[count_row, 1] = agent
sheet1[count_row, 2] = user.show_real_name
sheet1[count_row, 3] = user.school_name
sheet1[count_row, 4] = user.phone
sheet1[count_row, 5] = user.mail
sheet1[count_row, 6] = competion_users.count
sheet1[count_row, 7] = team_ids.count
sheet1[count_row, 8] = agents_count
count_row += 1
end
book.write xls_report
xls_report.string
end
def export_subject_level_system def export_subject_level_system
xls_report = StringIO.new xls_report = StringIO.new
book = Spreadsheet::Workbook.new book = Spreadsheet::Workbook.new

@ -0,0 +1,3 @@
class CompetitionCourseCourseRecord < CompetitionCourseRecord
end

@ -0,0 +1,6 @@
class CompetitionCourseRecord < ActiveRecord::Base
belongs_to :competition
belongs_to :competition_team
serialize :snapshot, JSON
end

@ -0,0 +1,2 @@
class CompetitionCourseShixunRecord < CompetitionCourseRecord
end

@ -5,7 +5,7 @@ class CompetitionTeam < ActiveRecord::Base
has_many :team_members, :dependent => :destroy has_many :team_members, :dependent => :destroy
has_many :members, conditions: 'team_members.is_teacher = 0', class_name: 'TeamMember' has_many :members, conditions: 'team_members.is_teacher = 0', class_name: 'TeamMember'
has_many :teachers, conditions: 'team_members.is_teacher = 1', class_name: 'TeamMember' has_many :teachers, conditions: 'team_members.is_teacher = 1', class_name: 'TeamMember', :order => "team_members.role ASC"
has_many :competition_scores, :dependent => :destroy has_many :competition_scores, :dependent => :destroy
# team_type 0组队 1个人 # team_type 0组队 1个人
# attr_accessible :invite_code, :name, :team_type # attr_accessible :invite_code, :name, :team_type

@ -26,7 +26,7 @@ class Course < ActiveRecord::Base
attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public, attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,
:description,:class_period, :open_student, :enterprise_name, :is_delete, :syllabus_id, :end_time, :end_term, :description,:class_period, :open_student, :enterprise_name, :is_delete, :syllabus_id, :end_time, :end_term,
:choose_group_allow, :is_end, :homepage_show, :course_list_id, :teacher_list, :student_list, :is_hidden :choose_group_allow, :is_end, :homepage_show, :course_list_id, :teacher_list, :student_list, :is_hidden, :email_notify
#belongs_to :project, :class_name => 'Course', :foreign_key => :extra, primary_key: :identifier #belongs_to :project, :class_name => 'Course', :foreign_key => :extra, primary_key: :identifier
belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id # 定义一个方法teacher该方法通过tea_id来调用User表 belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id # 定义一个方法teacher该方法通过tea_id来调用User表
belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school该方法通过school_id来调用School表 belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school该方法通过school_id来调用School表
@ -139,7 +139,8 @@ class Course < ActiveRecord::Base
'choose_group_allow', 'choose_group_allow',
'credit', 'credit',
'homepage_show', 'homepage_show',
'show_unit' 'show_unit',
'email_notify'
acts_as_customizable acts_as_customizable

@ -72,10 +72,10 @@ class Journal < ActiveRecord::Base
where("(#{Journal.table_name}.private_notes = ? OR (#{Project.allowed_to_condition(user, :view_private_notes, *args)}))", false) where("(#{Journal.table_name}.private_notes = ? OR (#{Project.allowed_to_condition(user, :view_private_notes, *args)}))", false)
} }
def save(*args) # def save(*args)
# Do not save an empty journal # # Do not save an empty journal
(details.empty? && notes.blank?) ? false : super # (details.empty? && notes.blank?) ? false : super
end # end
# Returns the new status if the journal contains a status change, otherwise nil # Returns the new status if the journal contains a status change, otherwise nil
def new_status def new_status

@ -3,7 +3,7 @@ class Training < ActiveRecord::Base
attr_accessible :address, :email, :name, :phone, :position, :school, :sex, :openid, :training_type, attr_accessible :address, :email, :name, :phone, :position, :school, :sex, :openid, :training_type,
:major, :student_id, :job_title, :uncertified_major :major, :student_id, :job_title, :uncertified_major
# training_type 1 2018-培训会 2 警察学院大数据培训会 3 大数据和人工智能 4 工程教育认证 5 EduCoder-创源于实践 # training_type 1 2018-培训会 2 警察学院大数据培训会 3 大数据和人工智能 4 工程教育认证 5 EduCoder-创源于实践
has_one :training_payinfo has_one :training_payinfo

@ -28,7 +28,7 @@
<script> <script>
$(function(){ $(function(){
//初始化最热评测柱状图 //初始化最热评测柱状图
$.get('<%= student_hot_evaluations_college_path(@school) %>', function(data){ $.get('<%= student_hot_evaluations_college_path(@department.try(:identifier) || @school) %>', function(data){
InitHotEvaluating(data.names.reverse(), data.values.reverse()); InitHotEvaluating(data.names.reverse(), data.values.reverse());
}) })
}); });

@ -50,7 +50,7 @@
<div class="white-panel mb20 pl0 clearfix"> <div class="white-panel mb20 pl0 clearfix">
<li class="active" index="1"><a href="javascript:void(0);">课堂</a></li> <li class="active" index="1"><a href="javascript:void(0);">课堂</a></li>
<li index="2"><a href="<%= student_shixun_college_path(@school) %>" data-remote="true">学生实训</a></li> <li index="2"><a href="<%= student_shixun_college_path(@department.try(:identifier) || @school) %>" data-remote="true">学生实训</a></li>
<!--<li><a href="<%#= engineering_capability_college_path(@department) %>" data-remote="true">工程能力</a></li>--> <!--<li><a href="<%#= engineering_capability_college_path(@department) %>" data-remote="true">工程能力</a></li>-->
<!-- <li index="4"><a href="<%#= student_eval_college_path(@school) %>" data-remote="true">学生测评</a></li>--> <!-- <li index="4"><a href="<%#= student_eval_college_path(@school) %>" data-remote="true">学生测评</a></li>-->
</div> </div>
@ -139,15 +139,15 @@
}) })
}); });
$.get('<%= shixun_time_college_path(@school) %>', function(data){ $.get('<%= shixun_time_college_path(@department.try(:identifier) || @school) %>', function(data){
$('.shixun-time').html("<span data-tip-down=\"所有学员的实训耗时之和\">" + data.shixun_time + "</span>天"); $('.shixun-time').html("<span data-tip-down=\"所有学员的实训耗时之和\">" + data.shixun_time + "</span>天");
}); });
$.get('<%= shixun_report_count_college_path(@school) %>', function(data){ $.get('<%= shixun_report_count_college_path(@department.try(:identifier) || @school) %>', function(data){
$('.shixun-report-count').html("<span>" + data.shixun_report_count + "</span>个"); $('.shixun-report-count').html("<span>" + data.shixun_report_count + "</span>个");
}); });
// 教师排名 // 教师排名
$.ajax({ url: '<%= teachers_college_path(@school) %>', method: 'GET', dataType: 'script' }) $.ajax({ url: '<%= teachers_college_path(@department.try(:identifier) || @school) %>', method: 'GET', dataType: 'script' })
$(".count_student_test a").click(function(){ $(".count_student_test a").click(function(){
$(".count_student_test a").removeClass("active"); $(".count_student_test a").removeClass("active");
@ -155,7 +155,7 @@
}); });
//初始化饼状图 //初始化饼状图
$.get('<%= shixun_chart_data_college_path(@school) %>', function(data){ $.get('<%= shixun_chart_data_college_path(@department.try(:identifier) || @school) %>', function(data){
$('.pie-chart-loading').hide(); $('.pie-chart-loading').hide();
if (data.names.length > 0) { if (data.names.length > 0) {
$('.online_status .edu-tab-con-box').hide(); $('.online_status .edu-tab-con-box').hide();
@ -166,7 +166,7 @@
} }
}); });
$.get('<%= course_statistics_college_path(@school) %>'); $.get('<%= course_statistics_college_path(@department.try(:identifier) || @school) %>');
}); });
function InitPieChart(names, data){ function InitPieChart(names, data){
var Color = ['#49A9EE', '#FFD86E', '#98D87D', '#8996E6', '#F3857B', '#B97BF3','#4DE8B4','#F37BDB','#566EFF','#FF961A']; var Color = ['#49A9EE', '#FFD86E', '#98D87D', '#8996E6', '#F3857B', '#B97BF3','#4DE8B4','#F37BDB','#566EFF','#FF961A'];

@ -15,11 +15,47 @@
<% <%
total_members_count = 0 total_members_count = 0
total_shixun_homework_count = 0 total_shixun_homework_count = 0
total_valid_homework_count = 0
total_course_score = 0 total_course_score = 0
%> %>
<% if @competition_completed %>
<% @records.each do |record| %>
<%
course = record.snapshot['course']
course = Course.find(course["course"]["id"])
total_members_count += course.students.count
total_shixun_homework_count += record.snapshot['shixun_homework_count'].to_i
total_valid_homework_count += record.snapshot['valid_myshixun_count'].to_i
total_course_score += record.score.to_i
%>
<tr>
<td width="10%"><%= course.teachers.where(user_id: @team_user_ids).first.user.show_real_name %></td>
<td width="40%" class="edu-txt-left">
<%= link_to course_path(course), target: '_blank' do %>
<span class="task-hide fl" style="max-width: 480px;"><%= course.name %></span>
<% end %>
</td>
<td width="10%"><%= course.students.count %></td>
<td width="15%"><%= record.snapshot['shixun_homework_count'].to_i || '--' %></td>
<td width="10%"><%= record.snapshot['valid_myshixun_count'].to_i %></td>
<td width="15%"><%= record.score.to_i.zero? ? '--' : record.score.to_i %></td>
</tr>
<% end %>
</tbody>
<tfoot class="tfootLastPart">
<tr class="color-orange font-16">
<th width="10%" class="color-grey-6">合计</th>
<th width="40%" class="edu-txt-left"><%= @records.size %></th>
<th width="10%"><%= total_members_count %></th>
<th width="15%"><%= total_shixun_homework_count %></th>
<th width="10%"><%= total_valid_homework_count %></th>
<th width="15%"><%= total_course_score %></th>
</tr>
</tfoot>
<% else %>
<% @courses.each do |course| %> <% @courses.each do |course| %>
<% <%
total_members_count += course.members_count.to_i total_members_count += course.students.count
total_shixun_homework_count += course['shixun_homework_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) score = 500 + 5 * @course_shixun_count_map.fetch(course.id, 0) * @course_myshixun_map.fetch(course.id, 0)
@ -32,7 +68,7 @@
<span class="task-hide fl" style="max-width: 480px;"><%= course.name %></span> <span class="task-hide fl" style="max-width: 480px;"><%= course.name %></span>
<% end %> <% end %>
</td> </td>
<td width="10%"><%= course.members_count %></td> <td width="10%"><%= course.students.count %></td>
<td width="15%"><%= course['shixun_homework_count'].presence || '--' %></td> <td width="15%"><%= course['shixun_homework_count'].presence || '--' %></td>
<td width="10%"><%= @course_myshixun_map.fetch(course.id, '--') %></td> <td width="10%"><%= @course_myshixun_map.fetch(course.id, '--') %></td>
<td width="15%"><%= score.zero? ? '--' : score %></td> <td width="15%"><%= score.zero? ? '--' : score %></td>
@ -49,4 +85,5 @@
<th width="15%"><%= total_course_score %></th> <th width="15%"><%= total_course_score %></th>
</tr> </tr>
</tfoot> </tfoot>
<% end %>
</table> </table>

@ -14,8 +14,46 @@
<% <%
total_myshixun_count = 0 total_myshixun_count = 0
total_forked_myshixun_count = 0 total_forked_myshixun_count = 0
total_valid_myshixun_count = 0
total_shixun_score = 0 total_shixun_score = 0
%> %>
<% if @competition_completed %>
<% @records.each do |record| %>
<%
shixun = record.snapshot['shixun']
total_myshixun_count += record.snapshot['myshixuns_count'].to_i
total_forked_myshixun_count += record.snapshot['forked_myshixun_count'].to_i
total_valid_myshixun_count += record.snapshot['valid_myshixun_count'].to_i
total_shixun_score += record.score.to_i
%>
<tr>
<td width="10%"><%= record.username %></td>
<td width="40%" class="edu-txt-left">
<%= link_to shixun_path(shixun['identifier']), target: '_blank' do %>
<span class="task-hide fl" style="max-width: 410px;"><%= shixun['name'] %></span>
<% end %>
<% if shixun['fork_from'].blank? %>
<span class="connectTag ml10">原创</span>
<% end %>
</td>
<td width="10%"><%= record.snapshot['myshixuns_count'].to_i.zero? ? '--' : record.snapshot['myshixuns_count'].to_i %></td>
<td width="15%"><%= record.snapshot['forked_myshixun_count'].to_i.zero? ? '--' : record.snapshot['forked_myshixun_count'].to_i %></td>
<td width="10%"><%= record.snapshot['valid_myshixun_count'].to_i.zero? ? '--' : record.snapshot['valid_myshixun_count'].to_i %></td>
<td width="15%"><%= record.score.zero? ? '--' : record.score %></td>
</tr>
<% end %>
</tbody>
<tfoot class="tfootLastPart">
<tr class="color-orange font-16">
<th width="10%" class="color-grey-6">合计</th>
<th width="40%" class="edu-txt-left"><%= @records.size %></th>
<th width="10%"><%= total_myshixun_count %></th>
<th width="15%"><%= total_forked_myshixun_count %></th>
<th width="10%"><%= total_valid_myshixun_count %></th>
<th width="15%"><%= total_shixun_score %></th>
</tr>
</tfoot>
<% else %>
<% @shixuns.each do |shixun| %> <% @shixuns.each do |shixun| %>
<% <%
total_myshixun_count += shixun.myshixuns_count total_myshixun_count += shixun.myshixuns_count
@ -65,4 +103,5 @@
<th width="15%"><%= total_shixun_score %></th> <th width="15%"><%= total_shixun_score %></th>
</tr> </tr>
</tfoot> </tfoot>
<% end %>
</table> </table>

@ -14,7 +14,7 @@
<ul class="team-ranking inline mb10"> <ul class="team-ranking inline mb10">
<li class="edu-txt-left">当前排名 <%= rank.rank == 0 ? "--" : rank.rank %></li> <li class="edu-txt-left">当前排名 <%= rank.rank == 0 ? "--" : rank.rank %></li>
<li class="edu-txt-left task-hide"><%= rank.name %></li> <li class="edu-txt-left task-hide"><%= rank.name %></li>
<% if @competition.identifier != "gcc-annotation-2018" %> <% if @competition.identifier != "gcc-annotation-2018" && @competition.identifier != "gcc-course-2019" %>
<li class="color-grey-9"><%= rank.rank == 0 ? "--" : com_spend_time(rank.s_spend_time) %></li> <li class="color-grey-9"><%= rank.rank == 0 ? "--" : com_spend_time(rank.s_spend_time) %></li>
<% end %> <% end %>
<li class="color-orange-tip"><%= rank.rank == 0 ? "--" : "#{rank.s_score}分" %></li> <li class="color-orange-tip"><%= rank.rank == 0 ? "--" : "#{rank.s_score}分" %></li>
@ -44,7 +44,7 @@
<% @records.each_with_index do |record, index| %> <% @records.each_with_index do |record, index| %>
<% record_user = record.user %> <% record_user = record.user %>
<div class="rankingList-line clearfix"> <div class="rankingList-line clearfix">
<% if @competition.identifier == "gcc-annotation-2018" %> <% if @competition.identifier == "gcc-annotation-2018" || @competition.identifier == "gcc-course-2019" %>
<li class="with40"> <li class="with40">
<% if index == 0 %> <% if index == 0 %>
<img src="/images/educoder/competition/1.png" class="fl ranking-img"> <img src="/images/educoder/competition/1.png" class="fl ranking-img">

@ -1,9 +1,11 @@
<% if @competition.identifier == 'hn' || @competition.identifier == 'gcc-dev-2018' || @competition.identifier == "gcc-annotation-2018" || @competition.identifier == "gcc-task-2019" %> <% if @competition.identifier == 'hn' || @competition.identifier == 'gcc-dev-2018' || @competition.identifier == "gcc-annotation-2018" || @competition.identifier == "gcc-task-2019" || @competition.identifier == "gcc-course-2019" %>
<div class="competion-ranking"> <div class="competion-ranking">
<div class="ranking-nav edu-txt-center clearfix"> <div class="ranking-nav edu-txt-center clearfix">
<div class="inline"> <div class="inline">
<% if @competition.identifier == "gcc-annotation-2018" %> <% if @competition.identifier == "gcc-annotation-2018" %>
<li class="active"><a href="<%= charts_competition_path(@competition) %>" data-remote="true">开源标注正赛排行榜</a></li> <li class="active"><a href="<%= charts_competition_path(@competition) %>" data-remote="true">开源标注正赛排行榜</a></li>
<% elsif @competition.identifier == "gcc-course-2019" %>
<li class="active"><a href="<%= charts_competition_path(@competition) %>" data-remote="true">排行榜</a></li>
<% else %> <% else %>
<% if @max_min_stage.count == 1 %> <% if @max_min_stage.count == 1 %>
<li class="active"><a href="<%= charts_competition_path(@competition) %>" data-remote="true">排行榜</a></li> <li class="active"><a href="<%= charts_competition_path(@competition) %>" data-remote="true">排行榜</a></li>

@ -22,7 +22,7 @@
<% end %> <% end %>
<li class="<%= params[:controller] == "competitions" ? " active" : "" %>"> <li class="<%= params[:controller] == "competitions" ? " active" : "" %>">
<%= link_to "在线竞赛", competitions_path %> <%= link_to "在线竞赛", competitions_path %>
<img class="roundedRectangles" src="/images/educoder/roundedRectangle.png"/> <!-- <img class="roundedRectangles" src="/images/educoder/roundedRectangle.png"/>-->
</li> </li>
<li class="<%= params[:controller] == "libraries" ? " active" : "" %>"><%= link_to "教学案例", libraries_path %></li> <li class="<%= params[:controller] == "libraries" ? " active" : "" %>"><%= link_to "教学案例", libraries_path %></li>
<!-- <li class="<%#= params[:controller] == "project_packages" ? " active" : "" %>"><%#= link_to "众包创新", project_packages_path %></li>--> <!-- <li class="<%#= params[:controller] == "project_packages" ? " active" : "" %>"><%#= link_to "众包创新", project_packages_path %></li>-->
@ -63,7 +63,6 @@ display: none; right:110px;">
<li><%= link_to '我的实训项目', user_path(User.current, :type => 'a_shixun') %></li> <li><%= link_to '我的实训项目', user_path(User.current, :type => 'a_shixun') %></li>
<li><%= link_to '我的实践课程', user_path(User.current, :type => 'a_path') %></li> <li><%= link_to '我的实践课程', user_path(User.current, :type => 'a_path') %></li>
<li><%= link_to '我的开发项目', user_path(User.current, :type => 'a_project') %></li> <li><%= link_to '我的开发项目', user_path(User.current, :type => 'a_project') %></li>
<li><%= link_to '我的众包', user_path(User.current, :type => 'a_package') %></li>
<% if User.current.partner.present? %> <% if User.current.partner.present? %>
<li><%= link_to '客户管理', partner_list_cooperate_path(User.current.partner) %></li> <li><%= link_to '客户管理', partner_list_cooperate_path(User.current.partner) %></li>
<% end %> <% end %>
@ -139,21 +138,6 @@ display: none; right:110px;">
<% end %> <% end %>
<% end %> <% end %>
var begin_time = new Date();
var end_time = new Date("2019-10-10");
if (begin_time < end_time) {
if (window.localStorage) {
var uid = localStorage.getItem('competition_uid');
} else {
var uid = false
}
if (!uid) {
var htmlvalue = "<%= escape_javascript(render :partial => 'competitions/competitions_name')%>";
pop_box_new(htmlvalue, 500, 380);
}
}
<% notice = SystemUpdateNotice.last %> <% notice = SystemUpdateNotice.last %>
<% if @noticed_update || ((User.current.certification == 1 || params[:controller] != "welcome") && notice.present? && notice.end_time > Time.now && notice.start_time >= (Time.now - 21600) && User.current.user_system_notices.where(:notice_type => notice.notice_type).count == 0) %> <% if @noticed_update || ((User.current.certification == 1 || params[:controller] != "welcome") && notice.present? && notice.end_time > Time.now && notice.start_time >= (Time.now - 21600) && User.current.user_system_notices.where(:notice_type => notice.notice_type).count == 0) %>
var htmlvalue = "<%= escape_javascript(render :partial => 'account/user_update_notice', :locals => {:notice => notice})%>"; var htmlvalue = "<%= escape_javascript(render :partial => 'account/user_update_notice', :locals => {:notice => notice})%>";

@ -24,7 +24,7 @@
<% end %> <% end %>
<li class="<%= params[:controller] == "competitions" ? " active" : "" %>"> <li class="<%= params[:controller] == "competitions" ? " active" : "" %>">
<%= link_to "在线竞赛", competitions_path %> <%= link_to "在线竞赛", competitions_path %>
<img class="roundedRectangles" src="/images/educoder/roundedRectangle.png"/> <!-- <img class="roundedRectangles" src="/images/educoder/roundedRectangle.png"/>-->
</li> </li>
<li class="<%= params[:controller] == "libraries" ? " active" : "" %>"><%= link_to "教学案例", libraries_path %></li> <li class="<%= params[:controller] == "libraries" ? " active" : "" %>"><%= link_to "教学案例", libraries_path %></li>
<!-- <li class="<%#= params[:controller] == "project_packages" ? " active" : "" %>"><%#= link_to "众包创新", project_packages_path %></li>--> <!-- <li class="<%#= params[:controller] == "project_packages" ? " active" : "" %>"><%#= link_to "众包创新", project_packages_path %></li>-->
@ -99,16 +99,4 @@
document.getElementById('nHeader').style.left=sl+'px'; document.getElementById('nHeader').style.left=sl+'px';
}; };
$(function() {
if (window.localStorage) {
var uid = localStorage.getItem('competition_uid');
} else {
var uid = false
}
if(!uid){
var htmlvalue = "<%= escape_javascript(render :partial => 'competitions/competitions_name')%>";
pop_box_new(htmlvalue, 500, 380);
}
})
</script> </script>

@ -114,8 +114,8 @@
</li> </li>
<li class="fl edu-admin-nav-li edu-position <%= 'active' if @menu_type == 10 %>"><a href="javascript:void(0);" class="edu-admin-nav-a">审批</a> <li class="fl edu-admin-nav-li edu-position <%= 'active' if @menu_type == 10 %>"><a href="javascript:void(0);" class="edu-admin-nav-a">审批</a>
<ul class="edu-admin-nav-inner"> <ul class="edu-admin-nav-inner">
<li><%= link_to "实名认证", identity_authentication_managements_path %></li> <!-- <li><%#= link_to "实名认证", identity_authentication_managements_path %></li>-->
<li><%= link_to "职业认证", professional_authentication_managements_path %></li> <!-- <li><%#= link_to "职业认证", professional_authentication_managements_path %></li>-->
<li><%= link_to "试用授权", trial_authorization_managements_path %></li> <li><%= link_to "试用授权", trial_authorization_managements_path %></li>
<li><%= link_to "部门审批", depart_managements_path %></li> <li><%= link_to "部门审批", depart_managements_path %></li>
<li><%= link_to '单位审批', unit_managements_path %></li> <li><%= link_to '单位审批', unit_managements_path %></li>

@ -5,8 +5,8 @@
<title> <title>
<%= <%=
case "#{params[:controller]}-#{params[:action]}" case "#{params[:controller]}-#{params[:action]}"
when 'trainings-show' then '报名信息' when 'trainings-show' then 'EduCoder-IT专业教学与实战平台'
when 'trainings-enroll' then '报名' when 'trainings-enroll' then 'EduCoder-IT专业教学与实战平台'
when 'trainings-pay' then '费用支付和发票信息' when 'trainings-pay' then '费用支付和发票信息'
when 'trainings-result' then '支付信息' when 'trainings-result' then '支付信息'
end end

@ -40,6 +40,8 @@
<a href="<%= hidden_course_managements_path(:course_id => course.id) %>" class="mr5 fr" data-remote="true" id="hidden_course_<%= course.id %>"><%= course.is_hidden ? "显示" : "隐藏" %></a> <a href="<%= hidden_course_managements_path(:course_id => course.id) %>" class="mr5 fr" data-remote="true" id="hidden_course_<%= course.id %>"><%= course.is_hidden ? "显示" : "隐藏" %></a>
<input type="checkbox" name="homepage_show" value="<%= course.id %>" <%= course.homepage_show ? "checked" : "" %> class="ml-3 mr5 magic-checkbox" id="join_course_role_<%= course.id %>"> <input type="checkbox" name="homepage_show" value="<%= course.id %>" <%= course.homepage_show ? "checked" : "" %> class="ml-3 mr5 magic-checkbox" id="join_course_role_<%= course.id %>">
<label style="top:0px;padding-left: 25px;float:right; margin-right: 10px" for="join_course_role_<%= course.id %>">首页显示</label> <label style="top:0px;padding-left: 25px;float:right; margin-right: 10px" for="join_course_role_<%= course.id %>">首页显示</label>
<input type="checkbox" name="email_notify" value="<%= course.id %>" <%= course.email_notify ? "checked" : "" %> class="ml-3 mr5 magic-checkbox" id="email_notify_<%= course.id %>">
<label style="top:0px;padding-left: 25px;float:right; margin-right: 10px" for="email_notify_<%= course.id %>">邮件通知</label>
</td> </td>
</tr> </tr>
<% end %> <% end %>
@ -74,4 +76,13 @@
dateType: "script" dateType: "script"
}); });
}) })
$("input[name='email_notify']").click(function(){
var course_id = $(this).val();
$.ajax({
url:"<%= course_board_email_notify_managements_path %>",
data: {course_id: course_id},
type: 'post',
dateType: "script"
});
})
</script> </script>

@ -8,6 +8,7 @@
<th width="10%">竞赛报名状态</th> <th width="10%">竞赛报名状态</th>
<th width="10%">ip</th> <th width="10%">ip</th>
<th width="20%">负责人</th> <th width="20%">负责人</th>
<a href="<%= user_agents_managements_path(:format => "xls") %>" class="task-btn mr10 task-btn-orange fr">导出</a>
</thead> </thead>
<tbody> <tbody>
<% @user_agents.each do |ua| %> <% @user_agents.each do |ua| %>

@ -7,7 +7,7 @@
<option value="2">2019湖南警察学院大数据培训</option> <option value="2">2019湖南警察学院大数据培训</option>
<option value="3">信息技术新工科产学研联盟师资培训班</option> <option value="3">信息技术新工科产学研联盟师资培训班</option>
<option value="4">工程教育认证</option> <option value="4">工程教育认证</option>
<option value="5">EduCoder-创源于实践</option> <option value="5">EduCoder-创源于实践</option>
</select> </select>
<select class="fl mr10 winput-120-30" name="pay_type"> <select class="fl mr10 winput-120-30" name="pay_type">
<option value="-1">选择支付方式</option> <option value="-1">选择支付方式</option>

@ -284,7 +284,7 @@
<% end %> <% end %>
<% if @training_type == 5 %> <% if @training_type == 5 %>
<div> <div>
<p class="collegeInfo">EduCoder-创先源于实践</p> <!-- <p class="collegeInfo">EduCoder-创新源于实践</p>-->
<%= form_for @training do |f| %> <%= form_for @training do |f| %>
<%= hidden_field_tag(:friendly_id, @friendly_id) %> <%= hidden_field_tag(:friendly_id, @friendly_id) %>

@ -30,35 +30,3 @@
</div> </div>
<div id="trophyreturn" class="-task-sidebars" style="right: 65px !important;width: 154px;">
<a onclick="trophyreturnfun();" id="closeIcon" style="position: absolute;right: 12px;top: 10px; color: #000;">
<i class="iconfont icon-shanchudiao"></i>
</a>
<a href="/competitions">
<img src="/images/educoder/competition/lvmeng.png" width="150px" height="150px">
</a>
</div>
<script>
function trophyreturnfun(){
$("#trophyreturn").hide()
localStorage.setItem('trophy_uid', true);
}
$(function() {
var trophy_uid = false;
if (window.localStorage) {
trophy_uid = localStorage.getItem('trophy_uid');
} else {
trophy_uid = false
}
if(trophy_uid==="true"||trophy_uid===true){
$("#trophyreturn").hide()
}
})
</script>

@ -69,9 +69,9 @@
<% @issues.each do |issue| %> <% @issues.each do |issue| %>
<tr> <tr>
<td>#<%= issue.id %></td> <td>#<%= issue.id %></td>
<td><a href="<%= issue_path(issue) %>" class="new_roadmap_info_title color-grey3" title="<%= issue.subject %>" target="_blank"><%= issue.subject %></a> </td> <td><a href="<%= issue_path(issue) %>" class="new_roadmap_info_title color-grey3" data-tip-down="<%= issue.subject %>" target="_blank"><%= issue.subject %></a> </td>
<td> <%= issue.tracker %> </td> <td> <%= issue.tracker %> </td>
<td><a href="<%= issue.assigned_to_id.nil? ? "" : user_path(issue.assigned_to) %>" class="new_roadmap_info_name" target="_blank"> <td><a href="<%= issue.assigned_to_id.nil? ? "" : user_path(issue.assigned_to) %>" style="max-width: 200px;text-align: center;margin-left: 0px;" data-tip-down="<%= User.find(issue.try(:assigned_to_id)).nil? ? "" : User.find(issue.try(:assigned_to_id)).show_name %>" class="new_roadmap_info_name" target="_blank">
<%= User.find(issue.try(:assigned_to_id)).nil? ? "" : User.find(issue.try(:assigned_to_id)).show_name %></a> <%= User.find(issue.try(:assigned_to_id)).nil? ? "" : User.find(issue.try(:assigned_to_id)).show_name %></a>
</td> </td>
<td><%= format_time issue.updated_on %></td> <td><%= format_time issue.updated_on %></td>

@ -77,105 +77,4 @@
<%= render :partial => "shixuns/shixun_item", :locals => {:shixuns => @shixuns} %> <%= render :partial => "shixuns/shixun_item", :locals => {:shixuns => @shixuns} %>
</div> </div>
</div> </div>
<!--导师排行榜-->
<div class="pt60 pb60 mb30 mentor-ranking">
<div class="educontent">
<div class="edu-txt-center">
<p class="color-dark edu-txt-center font-24" style="line-height: 30px">导师排行榜</p>
<p class="color-grey-cd font-12">MENTOR RANKING</p>
</div>
<div class="ranking clearfix">
<ul class="grade color-dark">
<% if @tea_users[1] %>
<li class="mt35 pr">
<img src="/images/educoder/huangguan-two.png" class="huangguan"/>
<a href="/users/<%= (@tea_users[1].try(:login)) %>" class="color-dark"><%= image_tag(url_to_avatar(@tea_users[1])) %>
<span class="task-hide rankName"><%= @tea_users[1].try(:show_name) %></span>
</a>
</li>
<% end %>
<% if @tea_users[0] %>
<li class="pr">
<img src="/images/educoder/huangguan.png" class="huangguan"/>
<a href="/users/<%= (@tea_users[0].try(:login)) %>" class="color-dark"><%= image_tag(url_to_avatar(@tea_users[0])) %>
<span class="task-hide rankName"><%= @tea_users[0].try(:show_name) %></span>
</a>
</li>
<% end %>
<% if @tea_users[2] %>
<li class="mt35 pr">
<img src="/images/educoder/huangguan-three.png" class="huangguan"/>
<a href="/users/<%=(@tea_users[2].try(:login)) %>" class="color-dark"><%= image_tag(url_to_avatar(@tea_users[2])) %>
<span class="task-hide rankName"><%= @tea_users[2].try(:show_name) %></span>
</a>
</li>
<% end %>
</ul>
<br/>
<ul class="grade mt30">
<% if @tea_users.size > 3 %>
<% @tea_users[3..@tea_users.size].each do |t_u| %>
<li>
<a href="/users/<%= t_u.try(:login) %>" class="color-dark"><%= image_tag(url_to_avatar(t_u)) %>
<span class="task-hide rankName"><%= t_u.try(:show_name) %></span>
</a>
</li>
<% end %>
<% end %>
</ul>
</div>
</div>
</div>
<!--程序员排行榜-->
<div class="pt60 pb60 mb30 pro-ranking">
<div class="educontent">
<div class="edu-txt-center">
<p class="color-dark edu-txt-center font-24" style="line-height: 30px">程序员排行榜</p>
<p class="color-grey-cd font-12">PROGRAMMER RANKING</p>
</div>
<div class="ranking clearfix">
<ul class="grade color-dark">
<% if @stu_users[1] %>
<li class="mt35 pr">
<img src="/images/educoder/huangguan-two.png" class="huangguan"/>
<a href="/users/<%= @stu_users[1].try(:login) %>" class="color-dark"><%= image_tag(url_to_avatar(@stu_users[1])) %>
<span class="task-hide rankName"><%= @stu_users[1].try(:show_name) %></span>
</a>
</li>
<% end %>
<% if @stu_users[0] %>
<li class="pr">
<img src="/images/educoder/huangguan.png" class="huangguan"/>
<a href="/users/<%= @stu_users[0].try(:login) %>" class="color-dark"><%= image_tag(url_to_avatar(@stu_users[0])) %>
<span class="task-hide rankName"><%= @stu_users[0].try(:show_name) %></span>
</a>
</li>
<% end %>
<% if @stu_users[2] %>
<li class="mt35 pr">
<img src="/images/educoder/huangguan-three.png" class="huangguan"/>
<a href="/users/<%= (@stu_users[2].try(:login)) %>" class="color-dark"><%= image_tag(url_to_avatar(@stu_users[2])) %>
<span class="task-hide rankName"><%= @stu_users[2].try(:show_name) %></span>
</a>
</li>
<% end %>
</ul>
<br/>
<ul class="grade mt30">
<% if @stu_users.size > 3 %>
<% @stu_users[3..@stu_users.size].each do |e_u| %>
<li>
<a href="/users/<%= e_u.try(:login) %>" class="color-dark"><%= image_tag(url_to_avatar(e_u)) %>
<span class="task-hide rankName"><%= e_u.try(:show_name) %></span>
</a>
</li>
<% end %>
<% end %>
</ul>
</div>
</div>
</div>
</div> </div>

@ -609,22 +609,23 @@ RedmineApp::Application.routes.draw do ## oauth相关
get 'batch_authorization', :as => 'batch_authorization' get 'batch_authorization', :as => 'batch_authorization'
match 'search_user', :via => [:get, :post] match 'search_user', :via => [:get, :post]
match 'affirm_cancel_auth', :via => [:get, :post] match 'affirm_cancel_auth', :via => [:get, :post]
get 'identity_authentication', :as => 'identity_authentication' # get 'identity_authentication', :as => 'identity_authentication'
match 'trial_authorization_operation', :as => 'trial_authorization_operation' match 'trial_authorization_operation', :as => 'trial_authorization_operation'
get 'reject_authentication' # get 'reject_authentication'
get 'agree_authentication' # get 'agree_authentication'
match 'users', :via => [:get, :post] match 'users', :via => [:get, :post]
get 'users_trial' get 'users_trial'
get 'auto_users_trial' get 'auto_users_trial'
match 'users_authorization_agree' match 'users_authorization_agree'
match 'users_authorization_cancel' match 'users_authorization_cancel'
get 'update_webssh' get 'update_webssh'
get 'professional_authentication', :as => 'professional_authentication' # get 'professional_authentication', :as => 'professional_authentication'
get 'agree_authentication_pro' # get 'agree_authentication_pro'
post 'reject_authentication_pro' # post 'reject_authentication_pro'
get 'update_shixun_hidden' get 'update_shixun_hidden'
get 'update_subject_hidden' get 'update_subject_hidden'
post 'course_homepage_show' post 'course_homepage_show'
post 'course_board_email_notify'
post 'shixun_homepage_show' post 'shixun_homepage_show'
post 'update_shixun_task_pass' post 'update_shixun_task_pass'
post 'update_shixun_code_hidden' post 'update_shixun_code_hidden'
@ -2382,9 +2383,9 @@ RedmineApp::Application.routes.draw do ## oauth相关
get 'admin/code_work_tests' get 'admin/code_work_tests'
post 'admin/select_course_syllabus' post 'admin/select_course_syllabus'
post 'admin/create_syllabus' post 'admin/create_syllabus'
get 'admin/identity_authentication' # get 'admin/identity_authentication'
get 'admin/reject_authentication' # get 'admin/reject_authentication'
get 'admin/agree_authentication' # get 'admin/agree_authentication'
resources :auth_sources do resources :auth_sources do
member do member do

@ -0,0 +1,15 @@
class CreateCompetitionCourseRecords < ActiveRecord::Migration
def change
create_table :competition_course_records do |t|
t.references :competition
t.references :competition_team
t.string :type
t.integer :user_id
t.string :username
t.integer :score
t.text :snapshot
end
end
end

@ -0,0 +1,164 @@
namespace :competition do
desc "statistic gcc_course competition score"
task :gcc_course_statistic, [:competition_id] => :environment do |_, args|
competition = Competition.find args[:competition_id]
custom_logger("Start Statistic Competition Score: #{competition.id}|#{competition.identifier}|#{competition.name} ~")
custom_logger("Clear Old Competition Scores ~")
CompetitionScore.where(competition_id: competition.id).delete_all
CompetitionCourseRecord.where(competition_id: competition.id).delete_all
custom_logger("Clear Old Competition Scores Completed!")
competition.competition_teams.each do |team|
custom_logger("Start Statistic Competition Team: #{team.id}|#{team.name} ~")
team_user_ids = team.team_members.pluck(:user_id)
total_score = 0
# =========== Shixun ===========
shixuns = Shixun.where(user_id: team_user_ids, status: 2)
.where('shixuns.created_at > ? && shixuns.created_at <= ?', Time.parse('2018-06-01'), Time.now)
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)
shixun_ids = shixuns.map(&:id)
myshixun_count_map = get_valid_myshixun_count(shixun_ids)
original_myshixun_count_map = myshixun_count_map.clone
# forked shixun valid myshixun count
forked_shixun_map = Shixun.where(status: 2, fork_from: shixun_ids).select('id, fork_from')
forked_shixun_map = forked_shixun_map.each_with_object({}) { |sx, obj| obj[sx.id] = sx.fork_from }
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 }
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
custom_logger("Start Shixun Score ~")
shixuns.each do |shixun|
valid_course_count = course_count_map.fetch(shixun.id, 0)
valid_student_count = original_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
forked_shixun_map.each do |shixun_id, fork_from_id|
next if fork_from_id != shixun.id
score += 100 + 10 * forked_map.fetch(shixun_id, 0) + 5 * forked_myshixun_count_map.fetch(shixun_id, 0)
end
total_score += score
attr = {
competition_id: competition.id,
competition_team_id: team.id,
user_id: shixun.creator.id,
username: shixun.creator.show_real_name,
score: score,
snapshot: {
shixun: shixun.as_json(only: [:id, :name, :identifier, :fork_from])['shixun'],
myshixuns_count: shixun.myshixuns_count.to_i,
forked_myshixun_count: shixun['forked_myshixun_count'].to_i,
valid_myshixun_count: myshixun_count_map.fetch(shixun.id, 0),
}
}
CompetitionCourseShixunRecord.create(attr)
end
custom_logger("Shixun Score Completed!")
# =========== Course ===========
student_count_subquery = CourseMember.where('course_id = courses.id AND role = 4').select('count(*)').to_sql
subquery = StudentWork.where('homework_common_id = hcs.id')
.select('sum(compelete_status !=0 ) as finish, count(*) as total')
.having('total != 0 and finish >= (total / 2)').to_sql
course_ids = Course.where('courses.created_at > ?', Time.parse('2018-06-01'))
.where('courses.created_at <= ?', Time.now)
.where("(#{student_count_subquery}) >= 3")
.where("exists(select 1 from homework_commons hcs where hcs.course_id = courses.id and hcs.publish_time is not null and hcs.publish_time < NOW() and hcs.homework_type = 4 and exists(#{subquery}))")
.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: 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)
custom_logger("Start Course Score ~")
courses.each do |course|
user = course.teachers.where(user_id: team_user_ids).first.user
score = 500 + 5 * course_shixun_count_map.fetch(course.id, 0) * course_myshixun_map.fetch(course.id, 0)
total_score += score
attr = {
competition_id: competition.id,
competition_team_id: team.id,
user_id: user.id,
username: user.show_real_name,
score: score,
snapshot: {
course: course.as_json(only: [:id, :name]),
members_count: course.members_count.to_i,
shixun_homework_count: course['shixun_homework_count'].to_i,
valid_myshixun_count: course_myshixun_map.fetch(course.id, 0),
}
}
CompetitionCourseCourseRecord.create(attr)
end
custom_logger("Course Score Completed!")
custom_logger('Create Competition Score ~')
CompetitionScore.create(user_id: team.user_id, competition_team_id: team.id, competition_id: competition.id, score: total_score)
custom_logger("Statistic Competition Team: #{team.id}|#{team.name} Completed!")
end
end
def custom_logger(msg)
Rails.logger.info(msg)
p msg
end
def get_valid_myshixun_count(ids)
Myshixun.where(shixun_id: ids)
.where('exists(select 1 from games where games.myshixun_id = myshixuns.id and games.status = 2)')
.group('shixun_id').count
end
def get_valid_course_count(ids)
percentage_sql = StudentWork.where('homework_common_id = homework_commons.id and homework_commons.publish_time is not null and homework_commons.publish_time < NOW()')
.select('sum(compelete_status !=0 ) as finish, count(*) as total')
.having('total != 0 and 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 and homework_commons.publish_time is not null and homework_commons.publish_time < NOW()')
.select('sum(compelete_status !=0 ) as finish, count(*) as total')
.having('total != 0 and finish >= (total / 2)').to_sql
Shixun.joins(homework_commons_shixuns: :homework_common)
.where(homework_commons: { homework_type: 4 })
.where('course_id in (?)', ids)
.where("exists (#{percentage_sql})")
.group('course_id').count
end
end

@ -36,7 +36,8 @@ function sd_create_editor(params){
} }
//params.toolbar_container.hide(); //params.toolbar_container.hide();
$('#reply_image_' + id).addClass('imageFuzzy'); $('#reply_image_' + id).addClass('imageFuzzy');
if(/^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(this.edit.html())){ // /^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(this.edit.html()))
if(/^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(this.edit.html()) && $(".upload_filename").length == 0 ){
params.submit_btn.hide(); params.submit_btn.hide();
params.toolbar_container.hide(); params.toolbar_container.hide();
this.resize("100%", null); this.resize("100%", null);
@ -209,13 +210,17 @@ function sd_check_editor_form_field(params){
if(params.content.html()!=params.textarea.html() || params.issubmit==true){ if(params.content.html()!=params.textarea.html() || params.issubmit==true){
params.textarea.html(params.content.html()); params.textarea.html(params.content.html());
params.content.sync(); params.content.sync();
if(params.content.isEmpty() || /^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(params.textarea.html())){ if(
params.contentmsg.html('内容不能为空'); (params.content.isEmpty() && $(".upload_filename").length == 0)
||
(/^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(params.textarea.html())&& $(".upload_filename").length == 0)){
params.contentmsg.html('请填写评论内容或者上传附件!');
params.contentmsg.css({color:'#ff0000'}); params.contentmsg.css({color:'#ff0000'});
}else{
params.contentmsg.html('填写正确');
params.contentmsg.css({color:'#008000'});
} }
// else{
// params.contentmsg.html('填写正确');
// params.contentmsg.css({color:'#008000'});
// }
params.contentmsg.show(); params.contentmsg.show();
} }
} }
@ -281,6 +286,7 @@ function sd_create_editor_from_data(id){
}); });
params.submit_btn.click(function () { params.submit_btn.click(function () {
var tContents = $("#comment_news_" + id).val(); var tContents = $("#comment_news_" + id).val();
console.log("tcontrnet"+tContents);
if(tContents != undefined){ if(tContents != undefined){
var beforeImage = tContents.split("<img"); var beforeImage = tContents.split("<img");
var afterImage = tContents.split("/>"); var afterImage = tContents.split("/>");

@ -684,7 +684,9 @@ class EcCompletionCalculation extends Component {
// }) // })
} }
{ {
Spintype===false?<li className={"clearfix newtarget_scoreclass lipadding10im bordereaeaea"} style={{width: 113*(total_rate_data+4)>1200?(113*(total_rate_data+4.5))+63:1200+"px"}}> Spintype===false?<li className={"clearfix newtarget_scoreclass lipadding10im bordereaeaea"} style={{width: total_rate_data > 5 ? (180 * total_rate_data+226+16) : 1200 + "px"}}
// style={{width: 113*(total_rate_data+4)>1200?(113*(total_rate_data+4.5))+63:1200+"px"}}
>
{/*<span className="column-1 color-05101A mr16 width86">{k+1}</span>*/} {/*<span className="column-1 color-05101A mr16 width86">{k+1}</span>*/}
<span className="column-1 color-05101A mr16 width86">平均分</span> <span className="column-1 color-05101A mr16 width86">平均分</span>
{/*<span className="column-1 color-05101A ec_graduation_name mr16">{i.student_scores.name}</span>*/} {/*<span className="column-1 color-05101A ec_graduation_name mr16">{i.student_scores.name}</span>*/}

@ -238,11 +238,11 @@ class NewHeader extends Component {
} else { } else {
var uid = false var uid = false
} }
if(!uid){ // if(!uid){
this.setState({ // this.setState({
competitiontype:true // competitiontype:true
}) // })
} // }
} }
setcompetitionfun=()=>{ setcompetitionfun=()=>{
@ -398,7 +398,7 @@ class NewHeader extends Component {
<li className={`${competitions === true ? 'active' : ''}`} > <li className={`${competitions === true ? 'active' : ''}`} >
<a href="/competitions">在线竞赛</a> <a href="/competitions">在线竞赛</a>
<img className="roundedRectangles" src="/images/educoder/roundedRectangle.png"/> {/*<img className="roundedRectangles" src="/images/educoder/roundedRectangle.png"/>*/}
</li> </li>
<li><a href="/moop_cases">教学案例</a></li> <li><a href="/moop_cases">教学案例</a></li>

@ -13,26 +13,26 @@ class SiderBar extends Component {
} }
componentDidMount() { componentDidMount() {
window._initSider(); // window._initSider();
var trophy_uid = false; // var trophy_uid = false;
if (window.localStorage) { // if (window.localStorage) {
trophy_uid = localStorage.getItem('trophy_uid'); // trophy_uid = localStorage.getItem('trophy_uid');
} else { // } else {
trophy_uid = false // trophy_uid = false
} // }
if(trophy_uid==="true"||trophy_uid===true){ // if(trophy_uid==="true"||trophy_uid===true){
this.setState({ // this.setState({
trophyreturn:true // trophyreturn:true
}) // })
} // }
} }
trophyreturnfun=()=>{ trophyreturnfun=()=>{
this.setState({ // this.setState({
trophyreturn:true // trophyreturn:true
}) // })
localStorage.setItem('trophy_uid', true); // localStorage.setItem('trophy_uid', true);
} }
render() { render() {
return ( return (
@ -70,15 +70,15 @@ class SiderBar extends Component {
</div> </div>
</div> </div>
{this.state.trophyreturn===true?"":<div className="-task-sidebars" style={{right: "65x",width: "154px"}}> {/*{this.state.trophyreturn===true?"":<div className="-task-sidebars" style={{right: "65x",width: "154px"}}>*/}
<a onClick={this.trophyreturnfun} id="closeIcon" {/* <a onClick={this.trophyreturnfun} id="closeIcon"*/}
style={{position: "absolute", right: "12px",top:"10px",color: "#000"}}> {/* style={{position: "absolute", right: "12px",top:"10px",color: "#000"}}>*/}
<i className="iconfont icon-shanchudiao"></i> {/* <i className="iconfont icon-shanchudiao"></i>*/}
</a> {/* </a>*/}
<a href="/competitions"> {/* <a href="/competitions">*/}
<img src={getImageUrl("images/educoder/competition/lvmeng.png")} width="150px" height="150px" /> {/* <img src={getImageUrl("images/educoder/competition/lvmeng.png")} width="150px" height="150px" />*/}
</a> {/* </a>*/}
</div>} {/*</div>}*/}
</div> </div>
); );

Loading…
Cancel
Save