<commit_before>module Spree
  module Admin
    class OrdersController < BaseController
      require 'spree/core/gateway_error'
      before_filter :initialize_txn_partials
      before_filter :initialize_order_events
      before_filter :load_order, :only => [:show, :edit, :update, :fire, :resend, :history, :user]

      respond_to :html

      def index
        params[:search] ||= {}
        params[:search][:completed_at_is_not_null] ||= '1' if Spree::Config[:show_only_complete_orders_by_default]
        @show_only_completed = params[:search][:completed_at_is_not_null].present?
        params[:search][:meta_sort] ||= @show_only_completed ? 'completed_at.desc' : 'created_at.desc'

        @search = Order.metasearch(params[:search])

        if !params[:search][:created_at_greater_than].blank?
          params[:search][:created_at_greater_than] = Time.zone.parse(params[:search][:created_at_greater_than]).beginning_of_day rescue ""
        end

        if !params[:search][:created_at_less_than].blank?
          params[:search][:created_at_less_than] = Time.zone.parse(params[:search][:created_at_less_than]).end_of_day rescue ""
        end

        if @show_only_completed
          params[:search][:completed_at_greater_than] = params[:search].delete(:created_at_greater_than)
          params[:search][:completed_at_less_than] = params[:search].delete(:created_at_less_than)
        end

        @orders = Order.metasearch(params[:search]).includes([:user, :shipments, :payments]).page(params[:page]).per(Spree::Config[:orders_per_page])<commit_msg>Explicitly reference Spree::Admin::BaseController in Spree::Admin::OrdersController<commit_after>module Spree
  module Admin
    class OrdersController < Spree::Admin::BaseController
      require 'spree/core/gateway_error'
      before_filter :initialize_txn_partials
      before_filter :initialize_order_events
      before_filter :load_order, :only => [:show, :edit, :update, :fire, :resend, :history, :user]

      respond_to :html

      def index
        params[:search] ||= {}
        params[:search][:completed_at_is_not_null] ||= '1' if Spree::Config[:show_only_complete_orders_by_default]
        @show_only_completed = params[:search][:completed_at_is_not_null].present?
        params[:search][:meta_sort] ||= @show_only_completed ? 'completed_at.desc' : 'created_at.desc'

        @search = Order.metasearch(params[:search])

        if !params[:search][:created_at_greater_than].blank?
          params[:search][:created_at_greater_than] = Time.zone.parse(params[:search][:created_at_greater_than]).beginning_of_day rescue ""
        end

        if !params[:search][:created_at_less_than].blank?
          params[:search][:created_at_less_than] = Time.zone.parse(params[:search][:created_at_less_than]).end_of_day rescue ""
        end

        if @show_only_completed
          params[:search][:completed_at_greater_than] = params[:search].delete(:created_at_greater_than)
          params[:search][:completed_at_less_than] = params[:search].delete(:created_at_less_than)
        end

        @orders = Order.metasearch(params[:search]).includes([:user, :shipments, :payments]).page(params[:page]).per(Spree::Config[:orders_per_page])
{'fraction_non_alphanumeric': 0.13424487259167184, 'fraction_numerical': 0.0006215040397762585, 'mean_word_length': 4.617801047120419, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5624025', 'n_tokens_mistral': 1029, 'n_tokens_neox': 986, 'n_words': 129}