<commit_before>ordered_tasks = %w[distance speed time]
russia_restricted = @event.is_official && [2020, 2021].include?(@event.starts_at.year)

xml.instruct!
xml.EventResult do
  xml.UniqueCode "skyderby-ws-performance-#{@event.id}"

  @scoreboard.sections.each do |section|
    rank = 0
    previous_total = 0
    section.competitors.each_with_index do |competitor, index|
      rank = competitor.total_points == previous_total && total_points.positive? ? rank : index + 1

      xml.Entrant do
        xml.CompetitionNo competitor.assigned_number
        xml.Name competitor.name

        if russia_restricted && competitor.country_code == 'RUS'
          xml.Nation 'RPF'
        else
          xml.Nation competitor.country_code
        end

        xml.Rank rank
        xml.Total format('%.1f', competitor.total_points)

        ordered_tasks.each do |discipline|
          xml.tag! discipline.capitalize do
            rounds = @scoreboard.rounds.select { |round| round.discipline == discipline && round.completed }
            rounds.each do |round|
              result = @scoreboard.results.for(competitor: competitor, round: round)
              next unless result

              xml.Flight(No: round.number) do
                xml.tag! discipline.to_s.capitalize, result.formated
                xml.Percentage result.formated_points
                xml.Notes(<<~HTML)
                  <iframe src=\"#{event_result_url(@event, result)}" height="700px" width="500px" />
                HTML
              end
            end

            xml.TaskPercentage competitor.points_in_discipline(discipline).round(1)
          end
        end
      end
    end
  end
end
<commit_msg>Fix error in xml template<commit_after>ordered_tasks = %w[distance speed time]
russia_restricted = @event.is_official && [2020, 2021].include?(@event.starts_at.year)

xml.instruct!
xml.EventResult do
  xml.UniqueCode "skyderby-ws-performance-#{@event.id}"

  @scoreboard.sections.each do |section|
    rank = 0
    previous_total = 0
    section.competitors.each_with_index do |competitor, index|
      rank = competitor.total_points == previous_total && competitor.total_points.positive? ? rank : index + 1

      xml.Entrant do
        xml.CompetitionNo competitor.assigned_number
        xml.Name competitor.name

        if russia_restricted && competitor.country_code == 'RUS'
          xml.Nation 'RPF'
        else
          xml.Nation competitor.country_code
        end

        xml.Rank rank
        xml.Total format('%.1f', competitor.total_points)

        ordered_tasks.each do |discipline|
          xml.tag! discipline.capitalize do
            rounds = @scoreboard.rounds.select { |round| round.discipline == discipline && round.completed }
            rounds.each do |round|
              result = @scoreboard.results.for(competitor: competitor, round: round)
              next unless result

              xml.Flight(No: round.number) do
                xml.tag! discipline.to_s.capitalize, result.formated
                xml.Percentage result.formated_points
                xml.Notes(<<~HTML)
                  <iframe src=\"#{event_result_url(@event, result)}" height="700px" width="500px" />
                HTML
              end
            end

            xml.TaskPercentage competitor.points_in_discipline(discipline).round(1)
          end
        end
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.0968501619075655, 'fraction_numerical': 0.011186340889019724, 'mean_word_length': 2.248565965583174, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 33}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4220249', 'n_tokens_mistral': 1048, 'n_tokens_neox': 956, 'n_words': 204}