<commit_before># encoding: utf-8

class NoisyWorkflow < ActionMailer::Base
  default :from => "Winston (Gov.UK Publisher) <<EMAIL>>"
  
  def make_noise(publication, action)
    @publication = publication
    @action = action
                                                  
    case Plek.current.environment
    when 'preview' 
      email_address = '<EMAIL>'                   
    else
      email_address = case action.request_type
      when Action::PUBLISH then "<EMAIL>, <EMAIL>"
      when Action::REQUEST_REVIEW then "<EMAIL>, <EMAIL>, <EMAIL>"
      else "<EMAIL>, <EMAIL>"
      end
    end                                           
    
    mail(:to => email_address,
         :subject => "[PUBLISHER] #{@action.friendly_description}") 
  end
  
  def request_fact_check(edition, details)
    @edition = edition
    fact_check_address = edition.fact_check_email_address 
    mail(:to => details[:email_addresses], :reply_to => fact_check_address, 
      :from => "Beta Editorial Team <#{fact_check_address}>", 
      :subject => "[FACT CHECK REQUESTED] #{edition.title}") do |format|
     format.text { render :text => details[:customised_message] }
   end
         
  end
  
  def report_errors(error_list)
    @errors = error_list
    mail(:to => '<EMAIL>', :subject => 'Errors in fact check email processing')
  end
  
end
<commit_msg>Make it easier to update the email addresses for different noisy workflow recipients. Update team/dev/eds to use new digital.cabinet-office addresses<commit_after># encoding: utf-8

class NoisyWorkflow < ActionMailer::Base
  default :from => "Winston (Gov.UK Publisher) <<EMAIL>>"
  
  EMAIL_GROUPS = {
    'team' => '<EMAIL>',
    'dev' => '<EMAIL>',
    'freds' => '<EMAIL>',
    'seo' => '<EMAIL>',
    'eds' => '<EMAIL>'
  }

  def make_noise(publication, action)
    @publication = publication
    @action = action
                                                  
    case Plek.current.environment
    when 'preview' 
      email_address = EMAIL_GROUPS['dev']
    else
      email_address = case action.request_type
      when Action::PUBLISH then "#{EMAIL_GROUPS['team']}, #{EMAIL_GROUPS['freds']}"
      when Action::REQUEST_REVIEW then "#{EMAIL_GROUPS['eds']}, #{EMAIL_GROUPS['seo']}, #{EMAIL_GROUPS['freds']}"
      else "#{EMAIL_GROUPS['eds']}, #{EMAIL_GROUPS['freds']}"
      end
    end                                           
    
    mail(:to => email_address,
         :subject => "[PUBLISHER] #{@action.friendly_description}") 
  end
  
  def request_fact_check(edition, details)
    @edition = edition
    fact_check_address = edition.fact_check_email_address 
    mail(:to => details[:email_addresses], :reply_to => fact_check_address, 
      :from => "Beta Editorial Team <#{fact_check_address}>", 
      :subject => "[FACT CHECK REQUESTED] #{edition.title}") do |format|
     format.text { render :text => details[:customised_message] }
   end
         
  end
  
  def report_errors(error_list)
    @errors = error_list
    mail(:to => EMAIL_GROUPS['dev'], :subject => 'Errors in fact check email processing')
  end
  
end

{'fraction_non_alphanumeric': 0.1293131247984521, 'fraction_numerical': 0.0006449532408900354, 'mean_word_length': 2.675355450236967, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 48, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5778062', 'n_tokens_mistral': 963, 'n_tokens_neox': 950, 'n_words': 220}