dev_aliyun
daiao 6 years ago
commit 520680cf8a

@ -316,6 +316,92 @@ class CompetitionsController < ApplicationController
rank = @records.map(&:id).index(team.id) rank = @records.map(&:id).index(team.id)
team[:rank] = rank.present? ? (rank+1) : 0 team[:rank] = rank.present? ? (rank+1) : 0
end end
elsif @competition.identifier == 'gcc-task-2019'
if @type == "预赛" || @type == "决赛"
if @type == "预赛"
# 'nyog9r7c','yugrij4n','48flws5g','bfgau7s6','mfv6zrj7','f398leqr','qwaffs2p','ose7482b','y5wh2ofx'
# 预赛的实训id 第一阶段118511971195 第二阶段1202, 1210, 1207 第三阶段125412551243
shixun1_id = [2303]
shixun2_id = [2994, 3012, 3014]
shixun3_id = [2944, 2938, 2943]
elsif @type == "决赛"
# '92b7vt8x','a7fxenvc','wt2xfzny','xa4m9cng','tng6heyf','am5o73er','9fla2zry','fzp3iu4w','qlsy6xb4'
# 预赛的实训id 第一阶段128913731256 第二阶段1488, 1453, 1487 第三阶段1470, 1473, 1408
shixun1_id = Shixun.where(:identifier => ['92b7vt8x','a7fxenvc','wt2xfzny']).pluck(:id)
shixun2_id = Shixun.where(:identifier => ['xa4m9cng','tng6heyf','am5o73er']).pluck(:id)
shixun3_id = Shixun.where(:identifier => ['9fla2zry','fzp3iu4w','qlsy6xb4']).pluck(:id)
end
if @competition.competition_scores.where(:competition_stage_id => @stage.id).count == 0
# 三个阶段的开始时间和结束时间
s1_time = @stage.competition_stage_sections[0].start_time
e1_time = @stage.competition_stage_sections[0].end_time
s2_time = @stage.competition_stage_sections[1].start_time
e2_time = @stage.competition_stage_sections[1].end_time
s3_time = @stage.competition_stage_sections[2].start_time
e3_time = @stage.competition_stage_sections[2].end_time
@records = @competition.competition_teams.includes(:user => [:user_extensions => [:school]])
@records.each do |team|
user_ids = team.team_members.where(:is_teacher => 0).pluck(:user_id)
# 第一阶段的得分和耗时
challenges_1 = Challenge.where(:shixun_id => shixun1_id)
challenge_rate1 = 0.5
result1 = chart_exp_score_pre user_ids, s1_time, e1_time, challenges_1, challenge_rate1
score1 = result1[0]
time1 = result1[1]
# 第二阶段的得分和耗时
challenge_rate2 = 1.0
challenges_2 = Challenge.where(:shixun_id => shixun2_id)
result2 = chart_exp_score_pre user_ids, s2_time, e2_time, challenges_2, challenge_rate2
score2 = result2[0]
time2 = result2[1]
# 第三阶段的得分和耗时
challenges_3 = Challenge.where(:shixun_id => shixun3_id)
result3 = chart_exp_score_third user_ids, s3_time, e3_time, challenges_3
score3 = result3[0]
time3 = result3[1]
team[:s_score] = (score1 + score2 + score3).try(:round, 2)
team[:s_spend_time] = time1 + time2 + time3
# 比赛已截止且未有分数纪录 则创建
if Time.now > e3_time && team.competition_scores.where(:competition_id => @competition.id, :competition_stage_id => @stage.id).count == 0
CompetitionScore.create(:user_id => team.user_id, :competition_team_id => team.id, :competition_id => @competition.id, :competition_stage_id => @stage.id, :score => team[:s_score], :cost_time => team[:s_spend_time])
end
end
else
@records = CompetitionTeam.find_by_sql("SELECT teams.*, cs.score AS s_score, cs.cost_time AS s_spend_time FROM competition_teams teams, competition_scores cs WHERE cs.competition_team_id = teams.`id` AND cs.competition_stage_id = '#{@stage.id}'")
end
elsif @type == "总排行榜"
pre_stage = @competition.competition_stages.where(:name => "预赛").first
final_stage = @competition.competition_stages.where(:name => "决赛").first
@records = @competition.competition_teams.includes(:user => [:user_extensions => [:school]])
@records.each do |team|
# 决赛记录
f_score = team.competition_scores.where(:competition_stage_id => final_stage.try(:id)).first
# 预赛记录
p_score = team.competition_scores.where(:competition_stage_id => pre_stage.try(:id)).first
team[:s_score] = (f_score.try(:score).to_f * 0.85 + p_score.try(:score).to_f * 0.15).try(:round, 2)
team[:s_spend_time] = f_score.try(:cost_time).to_i + p_score.try(:cost_time).to_i
end
end
@records = @records.sort do |a, b|
[b[:s_score], a[:s_spend_time]] <=> [a[:s_score], b[:s_spend_time]]
end
current_team_ids = @competition.team_members.where(:user_id => User.current.id).pluck(:competition_team_id).uniq
@user_ranks = @records.select{|com_team| current_team_ids.include?(com_team.id)}
@records = @records.select{|record| record[:s_score] > 0}
@user_ranks.each do |team|
rank = @records.map(&:id).index(team.id)
team[:rank] = rank.present? ? (rank+1) : 0
end
records_length = 97
@records = @records[0..records_length]
end end
else else
render_403 render_403

@ -1,7 +1,7 @@
<div id="competition-header" class="clearfix"> <div id="competition-header" class="clearfix">
<a href="/" style="margin: 10px 20px; display: inline-block;"> <a href="/" style="margin: 10px 0; display: inline-block;">
<img alt="高校智能化教学与实训平台" class="logoimg" <img alt="高校智能化教学与实训平台" class="logoimg"
src="/images/educoder/headNavLogo.png?1526520218" style="width:40px"> src="/images/educoder/headNavLogo.png?1526520218" style="margin-top:6px">
</a> </a>
<div class="inline fr"> <div class="inline fr">
<ul class="nav-game fl"> <ul class="nav-game fl">

@ -1,7 +1,9 @@
<div class="educontent clearfix"> <%= link_to image_tag("/images/educoder/headNavLogo.png", alt:"高校智能化教学与实训平台", class:"logoimg fl"), home_path %>
<%= link_to image_tag("/images/educoder/headNavLogo.png", alt:"高校智能化教学与实训平台", class:"logoimg"), home_path %> <div class="educontent">
<div class="head-nav pr"> <div class="head-nav pr">
<ul id="header-nav"> <ul id="header-nav">
<li class="<%= params[:controller] == "welcome" ? 'active' : '' %>"><%= link_to "首页", home_path %></li>
<li class="<%= subjects_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "实践课程", subjects_path %></li> <li class="<%= subjects_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "实践课程", subjects_path %></li>
<li class="<%= course_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "翻转课堂", courses_path %></li> <li class="<%= course_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "翻转课堂", courses_path %></li>
<!-- 精选实训 --> <!-- 精选实训 -->
@ -31,7 +33,8 @@
</li> </li>
<% end %> <% end %>
</ul> </ul>
<div class="posi-search" id="posi-search" style="display: none"> <div class="posi-search mrf40" id="posi-search" style="
display: none">
<div class="search-all clearfix"> <div class="search-all clearfix">
<div class="fl pr search-clear edu-menu-panel" style="display: none"> <div class="fl pr search-clear edu-menu-panel" style="display: none">
<input type="hidden" id="search_type" value="1"> <input type="hidden" id="search_type" value="1">
@ -70,7 +73,7 @@
<li class="bor-top-greyE"><%= link_to '退出', signout_path %></li> <li class="bor-top-greyE"><%= link_to '退出', signout_path %></li>
</ul> </ul>
</div> </div>
<div class="fr head-right"> <div class="fr head-right mr10">
<a href="javascript:void(0)" id="search-open" class="fl headIcon pointer"> <a href="javascript:void(0)" id="search-open" class="fl headIcon pointer">
<i class="iconfont icon-sousuo color-white"></i> <i class="iconfont icon-sousuo color-white"></i>
</a> </a>

@ -1,8 +1,11 @@
<div class="educontent clearfix">
<%= link_to image_tag("/images/educoder/headNavLogo.png", alt:"高校智能化教学与实训平台", class:"logoimg"), home_path %> <%= link_to image_tag("/images/educoder/headNavLogo.png", alt:"高校智能化教学与实训平台", class:"logoimg fl"), home_path %>
<div class="educontent">
<div class="head-nav pr"> <div class="head-nav pr">
<ul id="header-nav"> <ul id="header-nav">
<li class="active" style="display: none"><%= link_to "首页", home_path %></li> <li class="<%= params[:controller] == "welcome" ? 'active' : '' %>"><%= link_to "首页", home_path %></li>
<li class="<%= subjects_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "实践课程", subjects_path %></li> <li class="<%= subjects_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "实践课程", subjects_path %></li>
<li class="<%= course_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "翻转课堂", courses_path %></li> <li class="<%= course_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "翻转课堂", courses_path %></li>
@ -28,7 +31,7 @@
<li class="<%= params[:controller] == "forums" ? " active" : "" %>"><%= link_to "交流问答", forums_path %></li> <li class="<%= params[:controller] == "forums" ? " active" : "" %>"><%= link_to "交流问答", forums_path %></li>
<!--<li><%#= link_to "活动竞赛", competitions_path %></li>--> <!--<li><%#= link_to "活动竞赛", competitions_path %></li>-->
</ul> </ul>
<div class="posi-search unlogin" id="posi-search" style="display: none" > <div class="posi-search unlogin mrf40" id="posi-search" style="display: none" >
<div class="search-all clearfix"> <div class="search-all clearfix">
<!--<a href="javascript:void(0)" class="search-clear fl" onclick="closeSearch();">×</a>--> <!--<a href="javascript:void(0)" class="search-clear fl" onclick="closeSearch();">×</a>-->
<div class="fl pr search-clear edu-menu-panel" style="display: none"> <div class="fl pr search-clear edu-menu-panel" style="display: none">
@ -56,7 +59,7 @@
<a href="/register" class="mr5 color-white">注册</a> <a href="/register" class="mr5 color-white">注册</a>
<%#= link_to '注册', user_join_path, :class => "ml5 color-white" %> <%#= link_to '注册', user_join_path, :class => "ml5 color-white" %>
</span> </span>
<div class="fr head-right"> <div class="fr head-right mr10">
<a href="javascript:void(0)" id="search-open" class="fl headIcon"> <a href="javascript:void(0)" id="search-open" class="fl headIcon">
<i class="iconfont icon-sousuo color-white"></i> <i class="iconfont icon-sousuo color-white"></i>
</a> </a>
@ -66,12 +69,12 @@
<div class="edu-menu-list" style="top:60px;width: 240px;"> <div class="edu-menu-list" style="top:60px;width: 240px;">
<div class="overPart"></div> <div class="overPart"></div>
<ul class="fl with50 edu-txt-center pr ul-leftline"> <ul class="fl with50 edu-txt-center pr ul-leftline">
<li><%= link_to "新建实训", signin_path, :remote => true %></li> <li><%= link_to "新建实训", signin_path %></li>
<li><%= link_to "新建实践课程", signin_path, :remote => true %></li> <li><%= link_to "新建实践课程", signin_path %></li>
<li><%= link_to "新建项目", signin_path, :remote => true %></li> <li><%= link_to "新建项目", signin_path %></li>
</ul> </ul>
<ul class="fl with50 edu-txt-center"> <ul class="fl with50 edu-txt-center">
<li><%= link_to "加入课堂", signin_path, :remote => true %></li> <li><%= link_to "加入课堂", signin_path %></li>
<!-- <li><%#= link_to "加入项目", applied_join_project_path, :remote => true %></li>--> <!-- <li><%#= link_to "加入项目", applied_join_project_path, :remote => true %></li>-->
</ul> </ul>
</div> </div>

@ -352,15 +352,17 @@ class NewHeader extends Component {
</div> </div>
</div> </div>
</Modal> </Modal>
<div className="educontent clearfix"> <a href="/" className={" fl"}>
{ImageUrlType===true?<img alt="高校智能化教学与实训平台" className="fl" src={getImageUrl(ImageUrl)} style={{height:'60px'}} />:<img alt="高校智能化教学与实训平台" className="logoimg" src={getImageUrl(ImageUrl)}/>}
</a>
<div className="educontent">
{/*<%= link_to image_tag("/images/educoder/logo.png", alt:"高校智能化教学与实训平台", className:"logoimg"), home_path %>*/} {/*<%= link_to image_tag("/images/educoder/logo.png", alt:"高校智能化教学与实训平台", className:"logoimg"), home_path %>*/}
<a href="/">
{ImageUrlType===true?<img alt="高校智能化教学与实训平台" className="fl" src={getImageUrl(ImageUrl)} style={{height:'60px'}} />:<img alt="高校智能化教学与实训平台" className="logoimg" src={getImageUrl(ImageUrl)}/>}
</a>
<div className="head-nav pr"> <div className="head-nav pr">
<ul id="header-nav"> <ul id="header-nav">
{/*<li className={`${activeIndex === true ? 'active' : ''}`}><a href="/">首页</a></li>*/} {/*<li className={`${activeIndex === true ? 'active' : ''}`}><a href="/">首页</a></li>*/}
<li><a href="/">首页</a></li>
<li><a href="/paths">实践课程</a></li> <li><a href="/paths">实践课程</a></li>
<li><a href="/courses">翻转课堂</a></li> <li><a href="/courses">翻转课堂</a></li>
@ -399,7 +401,16 @@ class NewHeader extends Component {
<li className={`${activeForums === true ? 'active' : ''}`}><a href="/forums">交流问答</a></li> <li className={`${activeForums === true ? 'active' : ''}`}><a href="/forums">交流问答</a></li>
<li className={`${activeCourses === true ? 'active' : ''}`} style={{display:ecUrl===null||ecUrl===undefined||ecUrl===""?'none':'block'}}><a href={ecUrl}>{ecUrl===null||ecUrl===undefined||ecUrl===""?'':'工程认证'}</a></li> <li className={`${activeCourses === true ? 'active' : ''}`} style={{display:ecUrl===null||ecUrl===undefined||ecUrl===""?'none':'block'}}><a href={ecUrl}>{ecUrl===null||ecUrl===undefined||ecUrl===""?'':'工程认证'}</a></li>
</ul> </ul>
<div className="posi-search" id="posi-search" style={{display: 'none'}}> <style>
{
`
.mar55{
margin-right: 55px;
}
`
}
</style>
<div className="posi-search mar55" id="posi-search" style={{display: 'none'}}>
<div className="search-all clearfix"> <div className="search-all clearfix">
{/*<!--<a href="javascript:void(0)" className="search-clear fl" onclick="closeSearch();">×</a>-->*/} {/*<!--<a href="javascript:void(0)" className="search-clear fl" onclick="closeSearch();">×</a>-->*/}
<div className="fl pr search-clear edu-menu-panel" style={{display: 'none'}}> <div className="fl pr search-clear edu-menu-panel" style={{display: 'none'}}>
@ -464,7 +475,7 @@ class NewHeader extends Component {
</div> </div>
<div className="fr head-right"> <div className="fr head-right mr10">
<a href="javascript:void(0)" id="search-open" className="fl mr30 headIcon"> <a href="javascript:void(0)" id="search-open" className="fl mr30 headIcon">
{/*"/images/educoder/icon/search.svg" {/*"/images/educoder/icon/search.svg"
<img src={getImageUrl(`images/educoder/icon/search.svg`)} /> */} <img src={getImageUrl(`images/educoder/icon/search.svg`)} /> */}

@ -6,8 +6,8 @@
float: left; float: left;
width: 97px; width: 97px;
} }
.head-nav{float: left;width: 920px;text-align: center;height: 60px;box-sizing: border-box; min-width: 400px;} .head-nav{float: left;width: 915px;text-align: center;height: 60px;box-sizing: border-box; min-width: 400px;}
.head-nav ul#header-nav{position: absolute;top: 0px;z-index: 3;height: 60px;box-sizing: border-box;padding-left: 30px;} .head-nav ul#header-nav{position: absolute;top: 0px;z-index: 3;height: 60px;box-sizing: border-box;}
.head-nav ul#header-nav li{float: left;height: 60px;line-height: 60px;margin-right: 30px;cursor: pointer;position: relative;font-size: 16px} .head-nav ul#header-nav li{float: left;height: 60px;line-height: 60px;margin-right: 30px;cursor: pointer;position: relative;font-size: 16px}
.head-nav ul#header-nav li a{display: block;height: 100%;width: 100%;color: #fff} .head-nav ul#header-nav li a{display: block;height: 100%;width: 100%;color: #fff}
.head-nav ul#header-nav li a:hover{color: #cccccc;} .head-nav ul#header-nav li a:hover{color: #cccccc;}
@ -611,6 +611,11 @@ p .activity-item:first-child{border-top: 1px solid #eee;}
#hnpage1{background: url('/images/educoder/competition/logo_1.jpg') no-repeat top center;min-height: 820px;} #hnpage1{background: url('/images/educoder/competition/logo_1.jpg') no-repeat top center;min-height: 820px;}
#competition-header{background:#24292D;height: 60px;width: 100%;padding-right: 40px;box-sizing: border-box;position: fixed;top: 0px;left: 0px;width: 100%;z-index: 1000;} #competition-header{background:#24292D;height: 60px;width: 100%;padding-right: 40px;box-sizing: border-box;position: fixed;top: 0px;left: 0px;width: 100%;z-index: 1000;}
#competition-header .logoimg{
margin-top: 5px;
float: left;
width: 97px;}
.nav-game{position: relative;} .nav-game{position: relative;}
.nav-game li{position: relative;float: left;width: 110px;height: 60px;line-height: 60px;text-align: center;box-sizing: border-box} .nav-game li{position: relative;float: left;width: 110px;height: 60px;line-height: 60px;text-align: center;box-sizing: border-box}
.nav-game li a{color:#fff;font-size: 16px;} .nav-game li a{color:#fff;font-size: 16px;}
@ -3526,3 +3531,7 @@ line-height: 16px;display: inline-block;color: rgba(65, 140, 205, 1) !important;
vertical-align: -4px; vertical-align: -4px;
margin-right: 0px !important; margin-right: 0px !important;
} }
.mrf40{
margin-right: -40px;
}
Loading…
Cancel
Save