<commit_before>module OpenFoodNetwork
  class CartController < ApplicationController
    respond_to :json

    # before_filter :authorize_read!, :except => [:index, :search, :create]

    def new
      @cart = Cart.new(current_api_user)
      if @cart.save
        respond_with(@cart, :status => 201)
      else
        invalid_resource!(@cart)
      end
    end

    def show
      @cart = Cart.find(params[:id])
      respond_with(@cart)
    end

    def add_variant
      @cart = Cart.find(params[:cart_id])
      distributor = Enterprise.find(params[:distributor_id])
      order_cycle = OrderCycle.find(params[:order_cycle_id]) if params[:order_cycle_id]

      if @cart.add_variant params[:variant_id], params[:quantity], distributor, order_cycle, current_currency
        respond_with(@cart)
      else
        respond_with(@cart.populate_errors)
      end
    end

    private

    def current_currency
      Spree::Config[:currency]
    end
  end
end<commit_msg>Make unused cart_controller happy<commit_after>module OpenFoodNetwork
  class CartController < ApplicationController
    respond_to :json

    # before_filter :authorize_read!, :except => [:index, :search, :create]

    def new
      @cart = Cart.new(current_api_user)
      if @cart.save
        respond_with(@cart, :status => 201)
      else
        invalid_resource!(@cart)
      end
    end

    def show
      @cart = Cart.find(params[:id])
      respond_with(@cart)
    end

    def add_variant
      @cart = Cart.find(params[:cart_id])
      distributor = Enterprise.find_by_permalink(params[:distributor_id])
      order_cycle = OrderCycle.find(params[:order_cycle_id]) if params[:order_cycle_id]

      if @cart.add_variant params[:variant_id], params[:quantity], distributor, order_cycle, current_currency
        respond_with(@cart)
      else
        respond_with(@cart.populate_errors)
      end
    end

    private

    def current_currency
      Spree::Config[:currency]
    end
  end
end
{'fraction_non_alphanumeric': 0.09822784810126582, 'fraction_numerical': 0.0030379746835443038, 'mean_word_length': 3.0491803278688523, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7145283', 'n_tokens_mistral': 616, 'n_tokens_neox': 585, 'n_words': 124}