<commit_before>require 'open_food_network/spree_api_key_loader'

Spree::Admin::OrdersController.class_eval do
  include OpenFoodNetwork::SpreeApiKeyLoader
  helper CheckoutHelper
  before_filter :load_spree_api_key, :only => :bulk_management
  before_filter :load_order, only: %i[show edit update fire resend invoice print]

  before_filter :load_distribution_choices, only: [:new, :edit, :update]

  # Ensure that the distributor is set for an order when
  before_filter :ensure_distribution, only: :new

  # After updating an order, the fees should be updated as well
  # Currently, adding or deleting line items does not trigger updating the
  # fees! This is a quick fix for that.
  # TODO: update fees when adding/removing line items
  # instead of the update_distribution_charge method.
  after_filter :update_distribution_charge, :only => :update

  before_filter :require_distributor_abn, only: :invoice
<commit_msg>Load order also on open and close adjustments<commit_after>require 'open_food_network/spree_api_key_loader'

Spree::Admin::OrdersController.class_eval do
  include OpenFoodNetwork::SpreeApiKeyLoader
  helper CheckoutHelper
  before_filter :load_spree_api_key, :only => :bulk_management
  before_filter :load_order, only: %i[show edit update fire resend invoice print open_adjustments close_adjustments]

  before_filter :load_distribution_choices, only: [:new, :edit, :update]

  # Ensure that the distributor is set for an order when
  before_filter :ensure_distribution, only: :new

  # After updating an order, the fees should be updated as well
  # Currently, adding or deleting line items does not trigger updating the
  # fees! This is a quick fix for that.
  # TODO: update fees when adding/removing line items
  # instead of the update_distribution_charge method.
  after_filter :update_distribution_charge, :only => :update

  before_filter :require_distributor_abn, only: :invoice

{'fraction_non_alphanumeric': 0.06475195822454308, 'fraction_numerical': 0.0, 'mean_word_length': 5.699300699300699, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '254129', 'n_tokens_mistral': 571, 'n_tokens_neox': 545, 'n_words': 193}