<commit_before>namespace :netsuite do

  def generate_options
    opts = {
      skip_existing: ENV['SKIP_EXISTING'].present? && ENV['SKIP_EXISTING'] == "true"
    }

    if ENV['RECORD_MODELS'].present?
      opts[:record_models] = ENV['RECORD_MODELS'].split(',').map(&:constantize)
    end

    if ENV['LIST_MODELS'].present?
      opts[:list_models] = ENV['LIST_MODELS'].split(',').map(&:constantize)
    end

    # field values might change on import because of remote data structure changes
    # stop all pushes on sync & fresh_sync to avoid pushing up data that really hasn't
    # changed for each record

    # TODO make push disabled configurable
    NetSuiteRails::Configuration.netsuite_push_disabled true

    opts
  end

  desc "Sync all NetSuite records using import_all"
  task :fresh_sync => :environment do
    NetSuiteRails::PollTimestamp.delete_all<commit_msg>Accept empty RECORD_MODELS & LIST_MODELS netsuite:sync args<commit_after>namespace :netsuite do

  def generate_options
    opts = {
      skip_existing: ENV['SKIP_EXISTING'].present? && ENV['SKIP_EXISTING'] == "true"
    }

    if !ENV['RECORD_MODELS'].nil?
      opts[:record_models] = ENV['RECORD_MODELS'].split(',').map(&:constantize)
    end

    if !ENV['LIST_MODELS'].nil?
      opts[:list_models] = ENV['LIST_MODELS'].split(',').map(&:constantize)
    end

    # field values might change on import because of remote data structure changes
    # stop all pushes on sync & fresh_sync to avoid pushing up data that really hasn't
    # changed for each record

    # TODO make push disabled configurable
    NetSuiteRails::Configuration.netsuite_push_disabled true

    opts
  end

  desc "Sync all NetSuite records using import_all"
  task :fresh_sync => :environment do
    NetSuiteRails::PollTimestamp.delete_all
{'fraction_non_alphanumeric': 0.10444444444444445, 'fraction_numerical': 0.0, 'mean_word_length': 3.988919667590028, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5091104', 'n_tokens_mistral': 571, 'n_tokens_neox': 544, 'n_words': 146}