From 8c841b95b66ff522ec77a760b63bb423a336e50b Mon Sep 17 00:00:00 2001 From: p31729568 Date: Thu, 18 Jul 2019 15:23:37 +0800 Subject: [PATCH] modify competition apig --- app/controllers/competitions/competition_teams_controller.rb | 4 ++-- app/models/searchable/dependents/challenge_tag.rb | 2 +- app/models/searchable/dependents/stage.rb | 2 +- app/models/searchable/dependents/user.rb | 4 ++-- app/views/competitions/competition_staffs/show.json.jbuilder | 1 + app/views/competitions/competition_teams/index.json.jbuilder | 3 +++ 6 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/controllers/competitions/competition_teams_controller.rb b/app/controllers/competitions/competition_teams_controller.rb index b4861c4d3..e03810b61 100644 --- a/app/controllers/competitions/competition_teams_controller.rb +++ b/app/controllers/competitions/competition_teams_controller.rb @@ -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 diff --git a/app/models/searchable/dependents/challenge_tag.rb b/app/models/searchable/dependents/challenge_tag.rb index fdec79d1b..51ef804dd 100644 --- a/app/models/searchable/dependents/challenge_tag.rb +++ b/app/models/searchable/dependents/challenge_tag.rb @@ -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 \ No newline at end of file diff --git a/app/models/searchable/dependents/stage.rb b/app/models/searchable/dependents/stage.rb index 262ddd36f..d4207fec8 100644 --- a/app/models/searchable/dependents/stage.rb +++ b/app/models/searchable/dependents/stage.rb @@ -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 \ No newline at end of file diff --git a/app/models/searchable/dependents/user.rb b/app/models/searchable/dependents/user.rb index 761704d06..103131ed6 100644 --- a/app/models/searchable/dependents/user.rb +++ b/app/models/searchable/dependents/user.rb @@ -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 \ No newline at end of file diff --git a/app/views/competitions/competition_staffs/show.json.jbuilder b/app/views/competitions/competition_staffs/show.json.jbuilder index 2cba22d2f..c490aaf5f 100644 --- a/app/views/competitions/competition_staffs/show.json.jbuilder +++ b/app/views/competitions/competition_staffs/show.json.jbuilder @@ -1,5 +1,6 @@ competition = current_competition +json.personal competition.personal? json.enroll_ended competition.enroll_ended? json.enrolled competition.enrolled?(current_user) diff --git a/app/views/competitions/competition_teams/index.json.jbuilder b/app/views/competitions/competition_teams/index.json.jbuilder index 86bb86a1c..b641b28e6 100644 --- a/app/views/competitions/competition_teams/index.json.jbuilder +++ b/app/views/competitions/competition_teams/index.json.jbuilder @@ -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