<commit_before>- title t('title.attendees_summary')

%p= t('registration.status', :date => I18n.l(Time.zone.now))
  
%table.summary
  %tr
    %th{:rowspan=>2}= t('formtastic.labels.attendee.status')
    %th{:colspan=>2}= t("attendee.status.pending")
    %th{:colspan=>2}= t("attendee.status.paid")
    %th{:colspan=>2}= t("attendee.status.confirmed")
    %th{:colspan=>2}= t("registration_total.total")
  %tr
    %th= t('registration.amount')
    %th= t('formtastic.labels.attendee.total')
    %th= t('registration.amount')
    %th= t('formtastic.labels.attendee.total')
    %th= t('registration.amount')
    %th= t('formtastic.labels.attendee.total')
    %th= t('registration.amount')
    %th= t('formtastic.labels.attendee.total')
  %tr.total
    %td Evento
    %td= @attendees.select{|a| a.pending?}.size
    %td= number_to_currency(@attendees.select{|a| a.pending?}.inject(0){|s,a| s+=a.base_price})
    %td= @attendees.select{|a| a.paid?}.size
    %td= number_to_currency(@attendees.select{|a| a.paid?}.inject(0){|s,a| s+=a.base_price})
    %td= @attendees.select{|a| a.confirmed?}.size
    %td= number_to_currency(@attendees.select{|a| a.confirmed?}.inject(0){|s,a| s+=a.base_price})
    %td= @attendees.size
    %td= number_to_currency(@attendees.inject(0){|s,a| s+=a.base_price})
  - RegistrationType.all.each do |registration_type|
    %tr
      %td= t(registration_type.title)
      %td= @attendees.select{|a| a.registration_type == registration_type && a.pending?}.size
      %td= number_to_currency(@attendees.select{|a| a.registration_type == registration_type && a.pending?}.inject(0){|s,a| s+=a.base_price})
      %td= @attendees.select{|a| a.registration_type == registration_type && a.paid?}.size
      %td= number_to_currency(@attendees.select{|a| a.registration_type == registration_type && a.paid?}.inject(0){|s,a| s+=a.base_price})
      %td= @attendees.select{|a| a.registration_type == registration_type && a.confirmed?}.size
      %td= number_to_currency(@attendees.select{|a| a.registration_type == registration_type && a.confirmed?}.inject(0){|s,a| s+=a.base_price})
      %td= @attendees.select{|a| a.registration_type == registration_type}.size
      %td= number_to_currency(@attendees.select{|a| a.registration_type.title == "registration_type.student"}.inject(0){|s,a| s+=a.base_price})
  %tr.total
    %td= t('registration_total.courses')
    %td= @attendees.select{|a| a.pending? && a.courses.size > 0}.map{|a| a.courses}.size
    %td= number_to_currency(@attendees.select{|a| a.pending? && a.courses.size > 0}.inject(0){|s,a| s+=(a.registration_fee-a.base_price)})
    %td= @attendees.select{|a| a.paid? && a.courses.size > 0}.size
    %td= number_to_currency(@attendees.select{|a| a.paid? && a.courses.size > 0}.inject(0){|s,a| s+=(a.registration_fee-a.base_price)})
    %td= @attendees.select{|a| a.confirmed? && a.courses.size > 0}.size
    %td= number_to_currency(@attendees.select{|a| a.confirmed? && a.courses.size > 0}.inject(0){|s,a| s+=(a.registration_fee-a.base_price)})
    %td= @attendees.select{|a| a.courses.size > 0}.size
    %td= number_to_currency(@attendees.inject(0){|s,a| s+=(a.registration_fee-a.base_price)})
  - Course.all.each do |course|
    %tr
      %td= t(course.name)
      %td= @attendees.select{|a| a.pending? && a.courses.include?(course) }.size
      %td= number_to_currency( @attendees.select{|a| a.pending? && a.courses.include?(course)}.inject(0){|s,a| s+=RegistrationPeriod.for(a.registration_date).first.price_for_course(course) })
      %td= @attendees.select{|a| a.paid? && a.courses.include?(course)}.size
      %td= number_to_currency(@attendees.select{|a| a.paid?  && a.courses.include?(course)}.inject(0){|s,a| s+=RegistrationPeriod.for(a.registration_date).first.price_for_course(course) })
      %td= @attendees.select{|a| a.confirmed? && a.courses.include?(course)}.size
      %td= number_to_currency(@attendees.select{|a| a.confirmed?  && a.courses.include?(course)}.inject(0){|s,a| s+=RegistrationPeriod.for(a.registration_date).first.price_for_course(course) })
      %td= @attendees.select{|a| a.courses.include?(course)}.size
      %td= number_to_currency(@attendees.select{|a| a.courses.include?(course)}.inject(0){|s,a| s+=RegistrationPeriod.for(a.registration_date).first.price_for_course(course) })
  %tr.total
    %td= t("registration_total.total")
    %td
    %td= number_to_currency(@attendees.select{|a| a.pending?}.inject(0){|s,a| s+=a.registration_fee})
    %td<commit_msg>A little refactor to avoid some long selecting repetition. Hugo<commit_after>- title t('title.attendees_summary')

%p= t('registration.status', :date => I18n.l(Time.zone.now))
  
%table.summary
  %tr
    %th{:rowspan=>2}= t('formtastic.labels.attendee.status')
    %th{:colspan=>2}= t("attendee.status.pending")
    %th{:colspan=>2}= t("attendee.status.paid")
    %th{:colspan=>2}= t("attendee.status.confirmed")
    %th{:colspan=>2}= t("registration_total.total")
  %tr
    %th= t('registration.amount')
    %th= t('formtastic.labels.attendee.total')
    %th= t('registration.amount')
    %th= t('formtastic.labels.attendee.total')
    %th= t('registration.amount')
    %th= t('formtastic.labels.attendee.total')
    %th= t('registration.amount')
    %th= t('formtastic.labels.attendee.total')
  %tr.total
    %td Evento
    %td= @attendees.select{|a| a.pending?}.size
    %td= number_to_currency(@attendees.select{|a| a.pending?}.inject(0){|s,a| s+=a.base_price})
    %td= @attendees.select{|a| a.paid?}.size
    %td= number_to_currency(@attendees.select{|a| a.paid?}.inject(0){|s,a| s+=a.base_price})
    %td= @attendees.select{|a| a.confirmed?}.size
    %td= number_to_currency(@attendees.select{|a| a.confirmed?}.inject(0){|s,a| s+=a.base_price})
    %td= @attendees.size
    %td= number_to_currency(@attendees.inject(0){|s,a| s+=a.base_price})
  - RegistrationType.all.each do |registration_type|
    - atendeees_for_type = @attendees.select{|a| a.registration_type == registration_type}
    %tr
      %td= t(registration_type.title)
      %td= atendeees_for_type.select{|a| a.pending?}.size
      %td= number_to_currency(atendeees_for_type.select{|a| a.pending?}.inject(0){|s,a| s+=a.base_price})
      %td= atendeees_for_type.select{|a| a.paid?}.size
      %td= number_to_currency(atendeees_for_type.select{|a| a.paid?}.inject(0){|s,a| s+=a.base_price})
      %td= atendeees_for_type.select{|a| a.confirmed?}.size
      %td= number_to_currency(atendeees_for_type.select{|a| a.confirmed?}.inject(0){|s,a| s+=a.base_price})
      %td= atendeees_for_type.size
      %td= number_to_currency(atendeees_for_type.inject(0){|s,a| s+=a.base_price})
  %tr.total
    %td= t('registration_total.courses')
    %td= @attendees.select{|a| a.pending? && a.courses.size > 0}.map{|a| a.courses}.size
    %td= number_to_currency(@attendees.select{|a| a.pending? && a.courses.size > 0}.inject(0){|s,a| s+=(a.registration_fee-a.base_price)})
    %td= @attendees.select{|a| a.paid? && a.courses.size > 0}.size
    %td= number_to_currency(@attendees.select{|a| a.paid? && a.courses.size > 0}.inject(0){|s,a| s+=(a.registration_fee-a.base_price)})
    %td= @attendees.select{|a| a.confirmed? && a.courses.size > 0}.size
    %td= number_to_currency(@attendees.select{|a| a.confirmed? && a.courses.size > 0}.inject(0){|s,a| s+=(a.registration_fee-a.base_price)})
    %td= @attendees.select{|a| a.courses.size > 0}.size
    %td= number_to_currency(@attendees.inject(0){|s,a| s+=(a.registration_fee-a.base_price)})
  - Course.all.each do |course|
    - atendeees_for_course = @attendees.select{|a| a.courses.include?(course)}
    %tr
      %td= t(course.name)
      %td= atendeees_for_course.select{|a| a.pending? }.size
      %td= number_to_currency( atendeees_for_course.select{|a| a.pending? }.inject(0){|s,a| s+=RegistrationPeriod.for(a.registration_date).first.price_for_course(course) })
      %td= atendeees_for_course.select{|a| a.paid?}.size
      %td= number_to_currency(atendeees_for_course.select{|a| a.paid? }.inject(0){|s,a| s+=RegistrationPeriod.for(a.registration_date).first.price_for_course(course) })
      %td= atendeees_for_course.select{|a| a.confirmed? }.size
      %td= number_to_currency(atendeees_for_course.select{|a| a.confirmed?}.inject(0){|s,a| s+=RegistrationPeriod.for(a.registration_date).first.price_for_course(course) })
      %td= atendeees_for_course.size
      %td= number_to_currency(atendeees_for_course.inject(0){|s,a| s+=RegistrationPeriod.for(a.registration_date).first.price_for_course(course) })
  %tr.total
    %td= t("registration_total.total")
    %td
    %td= number_to_currency(@attendees.select{|a| a.pending?}.inject(0){|s,a| s+=a.registration_fee})
    %td
{'fraction_non_alphanumeric': 0.1992607138731662, 'fraction_numerical': 0.007161834353702206, 'mean_word_length': 5.025052192066806, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 29, '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': '7372657', 'n_tokens_mistral': 3526, 'n_tokens_neox': 3378, 'n_words': 410}