<commit_before>require 'dropbox_sdk'

class InvoiceDropboxWorker
  include Sidekiq::Worker
  sidekiq_options queue: (ENV['ARCHIVE_QUEUE'] || 'reckoning-archive').to_sym

  def perform invoice_id
    invoice = Invoice.find invoice_id

    if invoice.present?
      client = ::DropboxClient.new(invoice.user.dropbox_token)

      if File.exists?(invoice.pdf_path)
        client.put_file("#{invoice.customer.fullname}/#{invoice.project.name}/#{invoice.invoice_file}", open(invoice.pdf_path), true)
      end

      if File.exists?(invoice.timesheet_path)
        client.put_file("#{invoice.customer.fullname}/#{invoice.project.name}/#{invoice.timesheet_file}", open(invoice.timesheet_path), true)
      end
    end
  end
end<commit_msg>update path for dropbox export<commit_after>require 'dropbox_sdk'

class InvoiceDropboxWorker
  include Sidekiq::Worker
  sidekiq_options queue: (ENV['ARCHIVE_QUEUE'] || 'reckoning-archive').to_sym

  def perform invoice_id
    invoice = Invoice.find invoice_id

    if invoice.present?
      client = ::DropboxClient.new(invoice.user.dropbox_token)

      if File.exists?(invoice.pdf_path)
        client.put_file("#{invoice.customer.fullname.gsub("/", "-").strip}/#{invoice.project.name.gsub("/", "-").strip}/#{invoice.invoice_file}", open(invoice.pdf_path), true)
      end

      if File.exists?(invoice.timesheet_path)
        client.put_file("#{invoice.customer.fullname.gsub("/", "-").strip}/#{invoice.project.name.gsub("/", "-").strip}/#{invoice.timesheet_file}", open(invoice.timesheet_path), true)
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.1478648820905035, 'fraction_numerical': 0.0, 'mean_word_length': 4.250836120401337, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1993573', 'n_tokens_mistral': 532, 'n_tokens_neox': 525, 'n_words': 77}