json.count @count json.competition_teams do json.array! @teams.each do |team| json.extract! team, :id, :name, :invite_code json.team_type team.en_team_type json.school_name team.user.school_name json.manage_permission current_user.id == team.user_id json.creator do json.partial! 'users/user_simple', user: team.user json.role team.team_members.find(&:creator?).en_role end json.team_members do json.array! team.team_members.each do |member| 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 end