modify competition apig

dev_forum
p31729568 5 years ago
parent 77c0791d62
commit 8c841b95b6

@ -54,13 +54,13 @@ class Competitions::CompetitionTeamsController < Competitions::BaseController
end
@count = teams.count
@teams = paginate(teams.includes(:user, users: :user_extension))
@teams = paginate(teams.includes(:user, users: { user_extension: :school }))
end
def user_competition_teams
teams = current_competition.competition_teams
teams = teams.joins(:team_members).where(team_members: { user_id: current_user.id })
@teams = teams.includes(:user, users: :user_extension).to_a
@teams = teams.includes(:user, users: { user_extension: :school }).to_a
@count = @teams.size
end

@ -10,7 +10,7 @@ module Searchable::Dependents::ChallengeTag
def check_searchable_dependents
if new_record? || name_previously_changed?
challenge.shixun.reindex(:searchable_challenge_data)
challenge.shixun.reindex
end
end
end

@ -9,7 +9,7 @@ module Searchable::Dependents::Stage
def check_searchable_dependents
if name_previously_changed? || description_previously_changed?
subject.reindex(:searchable_stages_data)
subject.reindex
end
end
end

@ -10,13 +10,13 @@ module Searchable::Dependents::User
def check_searchable_dependents
if firstname_previously_changed? || lastname_previously_changed? || user_extension.school_id_previously_changed?
# reindex shixun
created_shixuns.each{ |shixun| shixun.reindex(:searchable_user_data) }
created_shixuns.each{ |shixun| shixun.reindex }
# reindex course
manage_courses.each(&:reindex)
# reindex subject
created_subjects.each { |subject| subject.reindex(:searchable_user_data) }
created_subjects.each { |subject| subject.reindex }
end
end
end

@ -1,5 +1,6 @@
competition = current_competition
json.personal competition.personal?
json.enroll_ended competition.enroll_ended?
json.enrolled competition.enrolled?(current_user)

@ -17,6 +17,9 @@ json.competition_teams do
json.partial! 'users/user_simple', user: member.user
json.user_id member.user_id
json.role member.en_role
json.identity member.user.identity
json.school_name member.user.school_name
json.student_id member.user.student_id
end
end
end

Loading…
Cancel
Save