<commit_before>=partial :form
%table.report.nojs
  %tr.header
    %th
      Manager
    %th
      Centers
    %th
      Borrower clients
    %th{:colspan => 3}
      Loan
    %th
      Average Per Client
    %th
      Average Per Center
  %tr.header
    %th
    %th
    %th
    %th
      Applied
    %th
      Approved
    %th
      Disbursed
    %th
    %th
  - length = 8
  - org_total = []
  - summable_columns = [0, 1, 2, 3, 4]
  - average_columns  = [5, 6]
  - @data.sort_by{|b,m| b.name}.each do |branch, managers|   
    %tr.branch
      %td{:colspan => length}
        %b
          =branch.name
    - branch_total = Array.new(summable_columns.length, 0)
    - managers.sort_by{|manager, data| manager.name}.each do |manager, data|
      %tr.staff
        %td.text
          %b
            =manager.name
        - data.each_with_index do |value, i|
          %td.number
            =value.to_i
            - if summable_columns.include?(i)
              - if i==3
                - branch_total[summable_columns.index(i)]+=(data[1]||0)*(value||0)
              - else
                - branch_total[summable_columns.index(i)]+=value.to_f
    -org_total.push([managers.length, *branch_total])
    %tr.branch_total
      %td
        %b
          Total (
          =managers.length
          )
      - 0.upto(length-2) do |idx|
        %td
          - if summable_columns.include?(idx)
            - if idx==3
              = branch_total[1] and branch_total[1]>0 ? (branch_total[idx]/branch_total[1]).to_i : 0
            -else
              = branch_total[idx].to_currency
  %tr.org_total
    -org_total.transpose.collect{|x| x.inject(0){|sum, x| sum+=x}}.each do |ele|    
      %td.number
        %b        
          =ele.to_currency<commit_msg>Correction in aggregate numbers<commit_after>=partial :form
%table.report.nojs
  %tr.header
    %th
      Manager
    %th
      Centers
    %th
      Borrower clients
    %th{:colspan => 3}
      Loan
    %th
      Average Per Client
    %th
      Average Per Center
  %tr.header
    %th
    %th
    %th
    %th
      Applied
    %th
      Approved
    %th
      Disbursed
    %th
    %th
  - length = 8
  - org_total = []
  - summable_columns = [0, 1, 2, 3, 4]
  - average_columns  = [5, 6]
  - @data.sort_by{|b,m| b.name}.each do |branch, managers|   
    %tr.branch
      %td{:colspan => length}
        %b
          =branch.name
    - branch_total = Array.new(summable_columns.length, 0)
    - managers.sort_by{|manager, data| manager.name}.each do |manager, data|
      %tr.staff
        %td.text
          %b
            =manager.name
        - data.each_with_index do |value, i|
          %td.number
            =value.to_i
            - if summable_columns.include?(i)
              - branch_total[summable_columns.index(i)]+=value.to_f
    -org_total.push([managers.length, *branch_total])
    %tr.branch_total
      %td
        %b
          Total (
          =managers.length
          )
      - 0.upto(length-2) do |idx|
        %td
          - if summable_columns.include?(idx)
            = branch_total[idx].to_currency
          -elsif idx==5
            = branch_total[1] and branch_total[1]>0 ? (branch_total[4]/branch_total[1]).to_i.to_currency : 0
          -elsif idx==6
            = branch_total[0] and branch_total[0]>0 ? (branch_total[4]/branch_total[0]).to_i.to_currency : 0
  %tr.org_total
    - org_total = org_total.transpose.collect{|x| x.inject(0){|sum, x| sum+=x}}
    - org_total.each do |ele|
      %td.number
        %b
          =ele.to_currency
    %td.number
      %b
        =org_total[2] and org_total[2]>0 ? (org_total[5]/org_total[2]).to_i.to_currency : 0
    %td.number
      %b
        =org_total[1] and org_total[1]>0 ? (org_total[5]/org_total[1]).to_i.to_currency : 0
{'fraction_non_alphanumeric': 0.13090812533191715, 'fraction_numerical': 0.016463090812533193, 'mean_word_length': 1.7436270939548435, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '1788584', 'n_tokens_mistral': 1388, 'n_tokens_neox': 1338, 'n_words': 248}