<commit_before>= render( partial: 'teams/tabs_and_title' )

.col-xs-12.goggles-category-gap#pageTop
  - if @team_supermaster_scores.count == 0
    %b= I18n.t('team_management.no_supermaster')

  - else
    - tot_individual_score = 0
    - tot_team_score = 0
    - tot_considered = [@full_events_swimmers, @ranking_context].min

    %ul.col-xs-offset-10.col-xs-2.col-sm-offset-11.col-sm-1.col-md-offset-11.col-md-1.nav.nav-pills.nav-stacked.navbar-fixed-bottom.goggles-divlist-odd.navpill_side
      %li
        = link_to("#pageTop", {'data-turbolinks'=>'false', 'data-toggle'=>'tooltip', 'title'=>I18n.t('top_of_page')}) do
          = I18n.t('team_management.detail_nav')
        %li
          = link_to("#summary", {'data-turbolinks'=>'false', 'data-toggle'=>'tooltip', 'title'=>I18n.t('top_of_page')}) do
            = I18n.t('team_management.summary_nav')

    %table.table.table-striped.table-bordered.table-hover.table-condensed
      %tbody
        %tr{'class'=>'info'}
          %td.text-right
            %b= I18n.t('team_management.number')
          %td
            %b= I18n.t('team_management.swimmer')
          %td.text-center
            %b= I18n.t('team_management.events')
          %td.text-right
            %b= I18n.t('team_management.tot_points')
          %td.text-right
            %b= I18n.t('team_management.everage')
          %td.text-center{id:"goggles-border-rx-thick"}
            %b= ""
          %td.text-center{'colspan'=>'9', id:"goggles-border-rx-thick"}
            %b= I18n.t('team_management.details')

        - count = 0
        - @team_supermaster_scores.each do |supermaster|
          - count += 1
          - is_considered = ( count <= tot_considered )
          - tot_individual_score += supermaster.get_total_score if is_considered
          %tr
            %td.text-right
              = count
            %td
              %a{ href: "#{ swimmer_supermaster_path(:id=>supermaster.swimmer_id) }", 'data-toggle' => 'tooltip', title: I18n.t('team_management.swimmer_supermaster_link') }
                = supermaster.complete_name
            %td.text-center{'class'=> supermaster.get_results_count == 3 ? 'success' : supermaster.get_results_count == 2 ? 'warning' : ''}
              = supermaster.get_results_count
            %td.text-right
              = sprintf( "%02.2f", supermaster.get_total_score)
            %td.text-right
              = sprintf( "%02.2f", supermaster.get_everage_score)
            %td.text-center{id:"goggles-border-rx-thick"}
              = show_tag( is_considered )
            - supermaster.results.each do |swimmer_result|
              %td.text-center
                = swimmer_result.event_type_code
              %td.text-right
                = swimmer_result.time_swam.to_s
              %td.text-right{id:"goggles-border-rx-thick"}
                = sprintf( "%02.2f", swimmer_result.standard_points)
            - if supermaster.get_results_count < 3
              - num_empty_col = (3 - supermaster.get_results_count) * 3
              %td{'colspan'=>num_empty_col, id:"goggles-border-rx-thick"}
                = ""

    .col-xs-12.goggles-category-gap#summary
      .col-xs-7
        - tot_team_score += tot_individual_score
        - ind_everage = tot_individual_score / tot_considered
        %table.table.table-striped.table-bordered.table-hover.table-condensed
          %tbody
            %tr.text-center{'class'=>'info'}
              %td{'class'=>'success'}
                %b= I18n.t('team_management.range') + @ranking_range + " #{@ranking_min}-#{@ranking_context}"
              %td.text-right
                %b= I18n.t('team_management.tot_points')
              %td.text-right
                %b= I18n.t('team_management.number')
              %td.text-right
                %b= I18n.t('team_management.everage_swimmer')
              %td.text-right
                %b= I18n.t('team_management.everage_event')
            %tr
              %td{'class'=>'info'}
                %b= I18n.t('team_management.tot_individuals')
              %td.text-right
                %b= sprintf( "%02.2f", tot_individual_score)
              %td.text-right
                %b= tot_considered
              %td.text-right
                = sprintf( "%02.2f", ind_everage.round(2) )
              %td.text-right
                = sprintf( "%02.2f", (ind_everage / 3).round(2) )
            %tr
              %td{'class'=>'info'}
                %b= I18n.t('team_management.tot_winter_relays')
              %td.text-right
              %td.text-right
              %td.text-right
              %td.text-right
            %tr
              %td{'class'=>'info'}
                %b= I18n.t('team_management.tot_summer_relays')
              %td.text-right
              %td.text-right
              %td.text-right
              %td.text-right

      .col-xs-5
        .col-xs-6
          .div{'align' => 'center', 'id' => 'num_masters_chart' }
        .col-xs-6
          .div{'align' => 'center', 'id' => 'everage_score_chart' }

.col-xs-12.goggles-category-gap#pageBottom

:javascript
  google.charts.load('current', {'packages':['gauge']});
  google.charts.setOnLoadCallback(drawChart);

  function drawChart() {
    var num_masters = Number.parseFloat( "#{@full_events_swimmers}" );
    var gf = Number.parseFloat( "#{@ranking_context - 10}" );
    var gt = Number.parseFloat( "#{@ranking_context}" );
    var yf = Number.parseFloat( "#{@ranking_context}" );
    var yt = Number.parseFloat( "#{@ranking_context + 3}" );
    var rf = Number.parseFloat( "#{@ranking_context + 3}" );
    var rt = Number.parseFloat( "#{@ranking_context + 5}" );
    var rmin = Number.parseFloat( "#{@ranking_min}" );
    var rmax = Number.parseFloat( "#{@ranking_max}" );
    var ind_everage = Number.parseFloat( "#{ind_everage.round(2)}" );

    var dataNM = google.visualization.arrayToDataTable([
      ['Label', 'Value'],
      ['Nuotatori', num_masters]
    ]);
    var dataSE = google.visualization.arrayToDataTable([
      ['Label', 'Value'],
      ['Media', ind_everage]
    ]);

    var optionsNM = {
      greenFrom: gf, greenTo: gt,
      yellowFrom:yf, yellowTo: yt,
      redFrom: rf, redTo: rt,
      min: rmin, max: rmax,
      majorTicks: [rmin, '', '', gf, '', '', rmax],
      minorTicks: 5
    };
    var optionsSE = {
      greenFrom: 2100, greenTo: 2400,
      yellowFrom: 2400, yellowTo: 2700,
      redFrom: 2700, redTo: 3000,
      min: 1500, max: 3000,
      majorTicks: [1500, 1800, 210, 2400, 2700, 3000],
      minorTicks: 5
    };

    var chartNM = new google.visualization.Gauge(document.getElementById('num_masters_chart'));
    var chartSE = new google.visualization.Gauge(document.getElementById('everage_score_chart'));

    chartNM.draw(dataNM, optionsNM);
    chartSE.draw(dataSE, optionsSE);
  };<commit_msg>Some cosmetics<commit_after>= render( partial: 'teams/tabs_and_title' )

.col-xs-12.goggles-category-gap#pageTop
  - if @team_supermaster_scores.count == 0
    %b= I18n.t('team_management.no_supermaster')

  - else
    - tot_individual_score = 0
    - tot_team_score = 0
    - tot_considered = [@full_events_swimmers, @ranking_context].min

    %ul.col-xs-offset-10.col-xs-2.col-sm-offset-11.col-sm-1.col-md-offset-11.col-md-1.nav.nav-pills.nav-stacked.navbar-fixed-bottom.goggles-divlist-odd.navpill_side
      %li
        = link_to("#pageTop", {'data-turbolinks'=>'false', 'data-toggle'=>'tooltip', 'title'=>I18n.t('top_of_page')}) do
          = I18n.t('team_management.detail_nav')
        %li
          = link_to("#summary", {'data-turbolinks'=>'false', 'data-toggle'=>'tooltip', 'title'=>I18n.t('top_of_page')}) do
            = I18n.t('team_management.summary_nav')

    %table.table.table-striped.table-bordered.table-hover.table-condensed
      %tbody
        %tr{'class'=>'info'}
          %td.text-right
            %b= I18n.t('team_management.number')
          %td
            %b= I18n.t('team_management.swimmer')
          %td.text-center
            %b= I18n.t('team_management.events')
          %td.text-right
            %b= I18n.t('team_management.tot_points')
          %td.text-right
            %b= I18n.t('team_management.everage')
          %td.text-center{id:"goggles-border-rx-thick"}
            %b= ""
          %td.text-center{'colspan'=>'9', id:"goggles-border-rx-thick"}
            %b= I18n.t('team_management.details')

        - count = 0
        - @team_supermaster_scores.each do |supermaster|
          - count += 1
          - is_considered = ( count <= tot_considered )
          - tot_individual_score += supermaster.get_total_score if is_considered
          %tr
            %td.text-right
              = count
            %td
              %a{ href: "#{ swimmer_supermaster_path(:id=>supermaster.swimmer_id) }", 'data-toggle' => 'tooltip', title: I18n.t('team_management.swimmer_supermaster_link') }
                = supermaster.complete_name
            %td.text-center{'class'=> supermaster.get_results_count == 3 ? 'success' : supermaster.get_results_count == 2 ? 'warning' : ''}
              = supermaster.get_results_count
            %td.text-right
              = sprintf( "%02.2f", supermaster.get_total_score)
            %td.text-right
              = sprintf( "%02.2f", supermaster.get_everage_score)
            %td.text-center{id:"goggles-border-rx-thick"}
              = show_tag( is_considered )
            - supermaster.results.each do |swimmer_result|
              %td.text-center
                = swimmer_result.event_type_code
              %td.text-right
                = swimmer_result.time_swam.to_s
              %td.text-right{id:"goggles-border-rx-thick"}
                = sprintf( "%02.2f", swimmer_result.standard_points)
            - if supermaster.get_results_count < 3
              - num_empty_col = (3 - supermaster.get_results_count) * 3
              %td{'colspan'=>num_empty_col, id:"goggles-border-rx-thick"}
                = ""

    .col-xs-12.goggles-category-gap#summary
      .col-xs-7
        - tot_team_score += tot_individual_score
        - ind_everage = tot_individual_score / tot_considered
        %table.table.table-striped.table-bordered.table-hover.table-condensed
          %tbody
            %tr.text-center{'class'=>'info'}
              %td{'class'=>'success'}
                %b= I18n.t('team_management.range') + @ranking_range + " #{@ranking_min}-#{@ranking_context}"
              %td.text-right
                %b= I18n.t('team_management.tot_points')
              %td.text-right
                %b= I18n.t('team_management.number')
              %td.text-right
                %b= I18n.t('team_management.everage_swimmer')
              %td.text-right
                %b= I18n.t('team_management.everage_event')
            %tr
              %td{'class'=>'info'}
                %b= I18n.t('team_management.tot_individuals')
              %td.text-right
                %b= sprintf( "%02.2f", tot_individual_score)
              %td.text-right
                %b= tot_considered
              %td.text-right
                = sprintf( "%02.2f", ind_everage.round(2) )
              %td.text-right
                = sprintf( "%02.2f", (ind_everage / 3).round(2) )
            %tr
              %td{'class'=>'info'}
                %b= I18n.t('team_management.tot_winter_relays')
              %td.text-right
              %td.text-right
              %td.text-right
              %td.text-right
            %tr
              %td{'class'=>'info'}
                %b= I18n.t('team_management.tot_summer_relays')
              %td.text-right
              %td.text-right
              %td.text-right
              %td.text-right

      .col-xs-5
        .col-xs-6
          .div{'align' => 'center', 'id' => 'num_masters_chart' }
        .col-xs-6
          .div{'align' => 'center', 'id' => 'everage_score_chart' }

.col-xs-12.goggles-category-gap#pageBottom

:javascript
  google.charts.load('current', {'packages':['gauge']});
  google.charts.setOnLoadCallback(drawChart);

  function drawChart() {
    var num_masters = Number.parseFloat( "#{@full_events_swimmers}" );
    var gf = Number.parseFloat( "#{@ranking_context - 10}" );
    var gt = Number.parseFloat( "#{@ranking_context}" );
    var yf = Number.parseFloat( "#{@ranking_context}" );
    var yt = Number.parseFloat( "#{@ranking_context + 3}" );
    var rf = Number.parseFloat( "#{@ranking_context + 3}" );
    var rt = Number.parseFloat( "#{@ranking_context + 5}" );
    var rmin = Number.parseFloat( "#{@ranking_min}" );
    var rmax = Number.parseFloat( "#{@ranking_max}" );
    var ind_everage = Number.parseFloat( "#{ind_everage.round(2)}" );

    var dataNM = google.visualization.arrayToDataTable([
      ['Label', 'Value'],
      ['Nuotatori', num_masters]
    ]);
    var dataSE = google.visualization.arrayToDataTable([
      ['Label', 'Value'],
      ['Media', ind_everage]
    ]);

    var optionsNM = {
      greenFrom: gf, greenTo: gt,
      yellowFrom:yf, yellowTo: yt,
      redFrom: rf, redTo: rt,
      min: rmin, max: rmax,
      majorTicks: [rmin, '', '', gf, '', gt, rmax],
      minorTicks: 5
    };
    var optionsSE = {
      greenFrom: 2100, greenTo: 2400,
      yellowFrom: 2400, yellowTo: 2700,
      redFrom: 2700, redTo: 3000,
      min: 1800, max: 3000,
      majorTicks: [1800, 2100, 2400, 2700, 3000],
      minorTicks: 5
    };

    var chartNM = new google.visualization.Gauge(document.getElementById('num_masters_chart'));
    var chartSE = new google.visualization.Gauge(document.getElementById('everage_score_chart'));

    chartNM.draw(dataNM, optionsNM);
    chartSE.draw(dataSE, optionsSE);
  };
{'fraction_non_alphanumeric': 0.15186435701702877, 'fraction_numerical': 0.02238696418085731, 'mean_word_length': 2.1430219146482123, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4034832', 'n_tokens_mistral': 4829, 'n_tokens_neox': 4505, 'n_words': 649}