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

dev_aliyun
jingquan huang 5 years ago
commit 9005cf0bef

@ -28,6 +28,8 @@ class CompetitionsController < ApplicationController
competitions = Competition.where('status = 1 or published_at is not null')
case params[:category]
when 'nearly_published' then
competitions = competitions.where('published_at is not null AND status = 0')
when 'progressing' then
competitions = competitions.where('end_time > NOW()')
when 'ended' then

@ -1087,7 +1087,7 @@ end
@only_teacher = @competition.competition_staffs.count == 1 && @competition.competition_staffs.first.category == 'teacher'
@team_members = @competition.team_members
@team_members = @team_members.where(is_teacher: false) unless @only_teacher # 只有老师报名时才显示老师,此时老师作为队员
@team_members = @team_members.where("team_members.is_teacher = 0") unless @only_teacher # 只有老师报名时才显示老师,此时老师作为队员
if params[:school] || params[:location]
school_ids = School.where("schools.name like '%#{params[:school]}%'").pluck(:id)

@ -4,8 +4,8 @@ class CompetitionTeam < ActiveRecord::Base
belongs_to :competition
has_many :team_members, :dependent => :destroy
has_many :members, conditions: 'is_teacher = 0', class_name: 'TeamMember'
has_many :teachers, conditions: 'is_teacher = 1', 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 :competition_scores, :dependent => :destroy
# team_type 0组队 1个人
# attr_accessible :invite_code, :name, :team_type

@ -846,7 +846,7 @@ class GamesService
experience = 0
game_status = game.status
had_done = game.had_done
game_challenge = Challenge.select([:id, :score, :position, :shixun_id, :web_route, :picture_path]).find(game.challenge_id)
game_challenge = Challenge.select([:id, :score, :position, :shixun_id, :web_route, :show_type]).find(game.challenge_id)
shixun = Shixun.select([:id, :status, :user_id, :test_set_permission]).find(game_challenge.shixun_id)
if params[:resubmit].blank? # 非重新评测

@ -3,6 +3,8 @@
<div class="mt20 mb20 clearfix">
<%= link_to '全部', competitions_path(category: ''), remote: true,
class: "fl mr20 font-16 bestChoose shixun_repertoire #{params[:category].blank? ? 'active' : ''}" %>
<%= link_to '即将发布', competitions_path(category: 'nearly_published'), remote: true,
class: "fl mr20 font-16 bestChoose shixun_repertoire #{params[:category] == 'nearly_published' ? 'active' : ''}" %>
<%= link_to '进行中', competitions_path(category: 'progressing'), remote: true,
class: "fl mr20 font-16 bestChoose shixun_repertoire #{params[:category] == 'progressing' ? 'active' : ''}" %>
<%= link_to '往期比赛', competitions_path(category: 'ended'), remote: true,

Loading…
Cancel
Save