<commit_before>require 'mailer_environment'

class RunChapterPdfWorker
  include Sidekiq::Worker

  sidekiq_options retry: 2

  def perform(currencies = ['EUR'])
    currencies.each do |currency|
      batch = Sidekiq::Batch.new
      batch.description = "Produces PDFs for all chapters (in #{currency})"
      chapter_ids = Section.all.map(&:chapters).flatten.map(&:goods_nomenclature_sid)
      # chapter_ids = %w[47137 32338 54748] # <- short chapters
      ENV["MX_RATE_EUR_#{currency}"] ||= MonetaryExchangeRate.latest(currency).to_s<commit_msg>Do not look up the exchange rate for EUR (it's always 1.0!)<commit_after>require 'mailer_environment'

class RunChapterPdfWorker
  include Sidekiq::Worker

  sidekiq_options retry: 2

  def perform(currencies = ['EUR'])
    currencies.each do |currency|
      batch = Sidekiq::Batch.new
      batch.description = "Produces PDFs for all chapters (in #{currency})"
      chapter_ids = Section.all.map(&:chapters).flatten.map(&:goods_nomenclature_sid)
      # chapter_ids = %w[47137 32338 54748] # <- short chapters
      if currency === 'EUR'
        ENV["MX_RATE_EUR_EUR"] = '1.0'
      else
        ENV["MX_RATE_EUR_#{currency}"] ||= MonetaryExchangeRate.latest(currency).to_s
      end
{'fraction_non_alphanumeric': 0.12135922330097088, 'fraction_numerical': 0.02912621359223301, 'mean_word_length': 4.090534979423868, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '2475955', 'n_tokens_mistral': 448, 'n_tokens_neox': 403, 'n_words': 87}