json.count @all_count json.members_count @all_member_count json.personal @personal json.competition_name @competition.name json.competition_teams do json.array! @all_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.created_at team.created_at.strftime("%Y-%m-%d %H:%M") 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 json.my_teams @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.created_at team.created_at.strftime("%Y-%m-%d %H:%M") 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