<commit_before>class WeeklyUpdateMailer < ActionMailer::Base

  def weekly_update
    @today = Date.today
    @reporting_period_in_days = 7
    @absences_threshold = 2
    @tardies_threshold = 2
    @column_width = 20
    @data = data

    @target_emails = '<EMAIL>' # ENV['WEEKLY_UPDATE_EMAILS_LIST'].split(',')
    @date_text = DateTime.now.beginning_of_day.strftime('%B %e, %Y')
    @subject = "Student Insights Weekly update for educators for #{@date_text}"

    mail(
      to: @target_emails,
      subject: @subject,
      from: "Student Insights job <<EMAIL>>"
    )
  end

  def data
    schools_for_report.map do |school_hash|
      school_hash.merge({
        absences: events_for_school(school_hash[:id], :absences, @absences_threshold),
        tardies: events_for_school(school_hash[:id], :tardies, @tardies_threshold)<commit_msg>Use real ENV variable for weekly update emails<commit_after>class WeeklyUpdateMailer < ActionMailer::Base

  def weekly_update
    @today = Date.today
    @reporting_period_in_days = 7
    @absences_threshold = 2
    @tardies_threshold = 2
    @column_width = 20
    @data = data

    @target_emails = ENV['WEEKLY_UPDATE_EMAILS_LIST'].split(',')
    @date_text = DateTime.now.beginning_of_day.strftime('%B %e, %Y')
    @subject = "Student Insights Weekly update for educators for #{@date_text}"

    mail(
      to: @target_emails,
      subject: @subject,
      from: "Student Insights job <<EMAIL>>"
    )
  end

  def data
    schools_for_report.map do |school_hash|
      school_hash.merge({
        absences: events_for_school(school_hash[:id], :absences, @absences_threshold),
        tardies: events_for_school(school_hash[:id], :tardies, @tardies_threshold)
{'fraction_non_alphanumeric': 0.11293153891164423, 'fraction_numerical': 0.005851375073142188, 'mean_word_length': 3.830508474576271, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 8, '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': '229456', 'n_tokens_mistral': 604, 'n_tokens_neox': 572, 'n_words': 121}