mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
28 lines
1.1 KiB
Plaintext
28 lines
1.1 KiB
Plaintext
{
|
|
"tournament": {
|
|
"attributes": <%= @tournament.attributes.to_json %>,
|
|
"schools": <%= @tournament.schools.map(&:attributes).to_json %>,
|
|
"weights": <%= @tournament.weights.map(&:attributes).to_json %>,
|
|
"mats": <%= @tournament.mats.map { |mat| mat.attributes.merge(
|
|
{
|
|
"queue_bout_numbers": mat.queue_matches.map { |match| match&.bout_number }
|
|
}
|
|
) }.to_json %>,
|
|
"wrestlers": <%= @tournament.wrestlers.map { |wrestler| wrestler.attributes.merge(
|
|
{
|
|
"school": wrestler.school&.attributes,
|
|
"weight": wrestler.weight&.attributes
|
|
}
|
|
) }.to_json %>,
|
|
"matches": <%= @tournament.matches.sort_by(&:bout_number).map { |match| match.attributes.merge(
|
|
{
|
|
"w1_name": Wrestler.find_by(id: match.w1)&.name,
|
|
"w2_name": Wrestler.find_by(id: match.w2)&.name,
|
|
"winner_name": Wrestler.find_by(id: match.winner_id)&.name,
|
|
"weight": Weight.find_by(id: match.weight_id)&.attributes,
|
|
"mat": Mat.find_by(id: match.mat_id)&.attributes
|
|
}
|
|
) }.to_json %>
|
|
}
|
|
}
|