<commit_before>require 'barby'
require 'barby/barcode/code_128'
require 'barby/outputter/png_outputter'

module Spree
  module Admin
    class StockBoxesController < ResourceController #Spree::Admin::BaseController
      
      # GET /stock_boxes
      # GET /stock_boxes.json
      def index
        if params[:non_empty]
          @stock_boxes = StockBox.all
        elsif params[:p_first]
          @stock_boxes = StockBox.all.sort { |box1, box2| box1.quantity <=> box2.quantity}
        elsif params[:p_last]
           @stock_boxes = StockBox.all.sort { |box1, box2| box1.quantity * -1 <=> box2.quantity * -1}
        else
          @stock_boxes = StockBox.where("quantity > ?", 0).order("quantity ASC")
        end
        respond_to do |format|
          format.html # index.html.erb
          format.json { render json: @stock_boxes }
        end
      end
      
      # GET /stock_boxes/1
      # GET /stock_boxes/1.json
      def show
        @stock_box = StockBox.find(params[:id])
        @variants = @stock_box.variants<commit_msg>Further debug of queries<commit_after>require 'barby'
require 'barby/barcode/code_128'
require 'barby/outputter/png_outputter'

module Spree
  module Admin
    class StockBoxesController < ResourceController #Spree::Admin::BaseController
      
      # GET /stock_boxes
      # GET /stock_boxes.json
      def index
        if params[:non_empty]
          @stock_boxes = StockBox.all
        elsif params[:p_first]
          @stock_boxes = StockBox.order(quantity: :desc)
        elsif params[:p_last]
           @stock_boxes = StockBox.order(quantity: :asc)
        else
          @stock_boxes = StockBox.where("quantity > ?", 0).order("quantity ASC")
        end
        respond_to do |format|
          format.html # index.html.erb
          format.json { render json: @stock_boxes }
        end
      end
      
      # GET /stock_boxes/1
      # GET /stock_boxes/1.json
      def show
        @stock_box = StockBox.find(params[:id])
        @variants = @stock_box.variants
{'fraction_non_alphanumeric': 0.10286844708209693, 'fraction_numerical': 0.010880316518298714, 'mean_word_length': 2.284090909090909, 'pattern_counts': {'":': 0, '<': 7, '<?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': '1212165', 'n_tokens_mistral': 644, 'n_tokens_neox': 623, 'n_words': 132}