<commit_before>class Admin::SupplyItemsController < Admin::BaseController

  def index
    
   
    
    #@products = Product.find(:all)
    #@products = Product.paginate(:page => params[:page], :per_page => Product.per_page)
    @supplier = Supplier.find(params[:supplier_id])

      @manufacturers_array = Rails.cache.read("supplier_#{@supplier}_manufacturers")
      if @manufacturers_array.nil?
        @manufacturers_array = @supplier.supply_items.group("manufacturer").collect(&:manufacturer).compact.sort
        Rails.cache.write("supplier_#{@supplier}_manufacturers", @manufacturers_array)
      end
    
      @category01_array = Rails.cache.read("supplier_#{@supplier}_category01")
      if @category01_array.nil?
        @category01_array = @supplier.supply_items.group("category01").collect(&:category01).compact.sort
        Rails.cache.write("supplier_#{@supplier}_category01", @category01_array)
      end
         
      @category02_array = Rails.cache.read("supplier_#{@supplier}_category02")
      if @category02_array.nil?
        @category02_array = @supplier.supply_items.group("category02").collect(&:category02).compact.sort
        Rails.cache.write("supplier_#{@supplier}_category02", @category01_array)
      end
      
      @category03_array = Rails.cache.read("supplier_#{@supplier}_category03")
      if @category03_array.nil?
        @category03_array = @supplier.supply_items.group("category03").collect(&:category03).compact.sort
        Rails.cache.write("supplier_#{@supplier}_category03", @category01_array)
      end
      
    
      keyword = nil
      keyword = params[:search][:keyword] unless params[:search].blank? or params[:search][:keyword].blank?
      conditions = {}
      conditions[:category01] = params[:category01] unless params[:category01].blank?
      conditions[:category02] = params[:category02] unless params[:category02].blank?
      conditions[:category03] = params[:category03] unless params[:category03].blank?
      conditions[:manufacturer] = params[:manufacturer] unless params[:manufacturer].blank?
      
      
      @supply_items = @supplier.supply_items.sphinx_available_items.search(keyword,
                                                    :conditions => conditions,
                                                    :per_page => SupplyItem.per_page,
                                                    :page => params[:page],
                                                    :max_matches => 100000)
  end
    
end
<commit_msg>Fixing category pulldown bug.<commit_after>class Admin::SupplyItemsController < Admin::BaseController

  def index
    
   
    
    #@products = Product.find(:all)
    #@products = Product.paginate(:page => params[:page], :per_page => Product.per_page)
    @supplier = Supplier.find(params[:supplier_id])

      @manufacturers_array = Rails.cache.read("supplier_#{@supplier}_manufacturers")
      if @manufacturers_array.nil?
        @manufacturers_array = @supplier.supply_items.group("manufacturer").collect(&:manufacturer).compact.sort
        Rails.cache.write("supplier_#{@supplier}_manufacturers", @manufacturers_array)
      end
    
      @category01_array = Rails.cache.read("supplier_#{@supplier}_category01")
      if @category01_array.nil?
        @category01_array = @supplier.supply_items.group("category01").collect(&:category01).compact.sort
        Rails.cache.write("supplier_#{@supplier}_category01", @category01_array)
      end
         
      @category02_array = Rails.cache.read("supplier_#{@supplier}_category02")
      if @category02_array.nil?
        @category02_array = @supplier.supply_items.group("category02").collect(&:category02).compact.sort
        Rails.cache.write("supplier_#{@supplier}_category02", @category03_array)
      end
      
      @category03_array = Rails.cache.read("supplier_#{@supplier}_category03")
      if @category03_array.nil?
        @category03_array = @supplier.supply_items.group("category03").collect(&:category03).compact.sort
        Rails.cache.write("supplier_#{@supplier}_category03", @category03_array)
      end
      
    
      keyword = nil
      keyword = params[:search][:keyword] unless params[:search].blank? or params[:search][:keyword].blank?
      conditions = {}
      conditions[:category01] = params[:category01] unless params[:category01].blank?
      conditions[:category02] = params[:category02] unless params[:category02].blank?
      conditions[:category03] = params[:category03] unless params[:category03].blank?
      conditions[:manufacturer] = params[:manufacturer] unless params[:manufacturer].blank?
      
      
      @supply_items = @supplier.supply_items.sphinx_available_items.search(keyword,
                                                    :conditions => conditions,
                                                    :per_page => SupplyItem.per_page,
                                                    :page => params[:page],
                                                    :max_matches => 100000)
  end
    
end

{'fraction_non_alphanumeric': 0.12415574096146206, 'fraction_numerical': 0.028605482717520857, 'mean_word_length': 2.888030888030888, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6021280', 'n_tokens_mistral': 1489, 'n_tokens_neox': 1382, 'n_words': 177}