Guest User

Untitled

a guest
Oct 18th, 2019
133
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def prepare_and_send_mail(student)
  2.       return unless enabled_for?(student)
  3.  
  4.       email_params = Serializers::PremiumFiveDaysSerializer.new(student).data
  5.       return unless email_params['total_completed_cards_count'] > 10
  6.  
  7.       subj_count = 0
  8.       ['math', 'eng', 'env', 'rus'].each do |subject|
  9.         subj_count += 1 if email_params["prem5#{subject}left"].nil? || email_params["prem5#{subject}left"] > 10
  10.       end
  11.       return unless subj_count == 4
  12.  
  13.       send_mail(email_params)
  14.     end
RAW Paste Data