You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/app/views/competitions/competitions/charts.json.jbuilder

23 lines
972 B

json.user_ranks @user_ranks.each do |user_rank|
rank = @record_ids.index(user_rank.id)
rank = rank.present? ? (rank+1) : 0
json.rank rank == 0 ? "--" : rank
json.team_name user_rank.name
json.user_name user_rank.user.real_name
json.cost_time rank == 0 || !user_rank.cost_time ? "--" : com_spend_time(user_rank.cost_time)
json.score rank == 0 ? "--" : user_rank.score.round(2)
json.competition_prize user_rank.competition_prize
end
json.teams @records.each do |record|
record_user = record.user
json.team_name record.name
json.record_user_name record_user.real_name
json.user_image url_to_avatar(record_user)
json.user_login record_user.login
school_name = chart_school_str record.team_members.select{|member| !member.is_teacher}.pluck(:user_id)
json.school_name school_name
json.score record&.score&.round(2)
json.spend_time record.cost_time ? com_spend_time(record.cost_time) : "--"
json.competition_prize record.competition_prize
end