提交信息

dev_bj
daiao 6 years ago
commit 23a51c80b7

@ -145,7 +145,7 @@ class CompetitionTeamsController < ApplicationController
# 老师身份加入战队 # 老师身份加入战队
if User.current.user_extensions.identity == 0 if User.current.user_extensions.identity == 0
teacher_staff = @competition.where(category: 'teacher').first teacher_staff = @competition.competition_staffs.where(category: 'teacher').first
if teacher_staff.blank? if teacher_staff.blank?
@status, @message = -1, '该竞赛不能配备导师' @status, @message = -1, '该竞赛不能配备导师'
@ -158,7 +158,7 @@ class CompetitionTeamsController < ApplicationController
end end
team.team_members.create!(user_id: User.current.id, role: 3, competition_id: @competition.id, is_teacher: true) team.team_members.create!(user_id: User.current.id, role: 3, competition_id: @competition.id, is_teacher: true)
else else
max_member_count = @competition.where('category != "teacher"').sum(:maximum) max_member_count = @competition.competition_staffs.where('category != "teacher"').sum(:maximum)
if team.members.count + 1 > max_member_count if team.members.count + 1 > max_member_count
@status, @message = -1, '该战队成员人数已满' @status, @message = -1, '该战队成员人数已满'
return return

@ -34,11 +34,11 @@
] ]
%> %>
<% @competition.competition_stages.each_with_index do |stage, i| %> <% @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;"> <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.first first_section = stage.competition_stage_sections[0]
second_section = stage.competition_stage_sections.second second_section = stage.competition_stage_sections[1]
%> %>
<div class="enter_panel" style="<%= i.zero? ? "height: 1212px" : ''%>"> <div class="enter_panel" style="<%= i.zero? ? "height: 1212px" : ''%>">
<% if i.zero? %> <% if i.zero? %>

@ -1,14 +1,30 @@
<p class="second_course_1" style="background: url('/images/educoder/competition/qg/qg_teach_1.png') no-repeat top center;"></p> <% index = 0 %>
<p class="second_course_2" style="background: url('/images/educoder/competition/qg/qg_teach_2.png') no-repeat top center;"></p> <p class="second_course_1" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"></p>
<p class="second_course_3" style="background: url('/images/educoder/competition/qg/qg_teach_3.png') no-repeat top center;"></p> <% index += 1 %>
<p class="second_course_4" style="background: url('/images/educoder/competition/qg/qg_teach_4.png') no-repeat top center;"></p> <p class="second_course_2" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"></p>
<div class="second_course_5" style="background: url('/images/educoder/competition/qg/qg_teach_5.png') no-repeat top center;"> <% index += 1 %>
<p class="second_course_3" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"></p>
<% index += 1 %>
<p class="second_course_4" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"></p>
<% index += 1 %>
<%
stage = @competition.competition_stages.first
first_section = stage.competition_stage_sections.first
is_start = Time.now > first_section.start_time
%>
<div class="second_course_5" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;">
<div class="enter_panel" style="height: 500px"> <div class="enter_panel" style="height: 500px">
<div class="course_competition_panel"> <div class="course_competition_panel">
<a href="javascript:void(0)" class="active">未知</a> <a href="<%= is_start ? first_section.competition_entries[0].url : 'javascript:void(0)'%>"
<a href="javascript:void(0)">未知</a> class="<%= is_start ? 'active' : '' %>"><%= first_section.competition_entries[0].name %></a>
<a href="<%= is_start ? first_section.competition_entries[1].url : 'javascript:void(0)'%>"
class="<%= is_start ? 'active' : '' %>"><%= first_section.competition_entries[1].name %></a>
</div> </div>
<a href="javascript:void(0)" class="ex_submit">案例提交</a> <a href="<%= is_start ? first_section.competition_entries[2].url : 'javascript:void(0)'%>"
class="ex_submit"><%= first_section.competition_entries[2].name %></a>
</div> </div>
</div> </div>
<p class="second_course_6" style="background: url('/images/educoder/competition/qg/qg_teach_6.png') no-repeat top center;"></p> <% index += 1 %>
<p class="second_course_6" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"></p>

@ -11,5 +11,7 @@
<%= render :partial => "qg_second_competition" %> <%= render :partial => "qg_second_competition" %>
<% elsif @competition.identifier == "gcc-annotation-2019" %> <% elsif @competition.identifier == "gcc-annotation-2019" %>
<%= render :partial => "gq_second_code_competition" %> <%= render :partial => "gq_second_code_competition" %>
<% elsif @competition.identifier == "gcc-course-2019" %>
<%= render :partial => "qg_second_course_competition" %>
<% end %> <% end %>
</div> </div>
Loading…
Cancel
Save