<commit_before>class Api::SerialsController < Api::BaseController
  before_action :authenticate_user!, only: [:show, :confirm_action]

  def show
    @serial = Serial.find_by(id: params[:id])
  end

  def confirm_action
    serial = Serial.find_by(serial_no: params["serial_no"])
    shop_store = ShopStore.find_by(code: params["decode"])
    if serial && shop_store
      @order = Order.new(
        shop_store_id: shop_store.id,
        serial_id: serial.id,
        order_date: Time.now)
      if @order.save
        render json: {:result => true}, status: 200
      end
    else
      render json: {:result => false}, status: 422
    end
  end

  private
    def serial_params
     params.require(:serial).permit(:open_id, :phone, :user_id, :serial_no, :product_id, :state, :store_assistant_id)
    end
end
<commit_msg>commit<commit_after>class Api::SerialsController < Api::BaseController
  before_action :authenticate_user!, only: [:show, :confirm_action]

  def show
    @serial = Serial.find_by(id: params[:id])
  end

  def confirm_action
    serial = Serial.find_by(serial_no: params["serial_no"])
    shop_store = ShopStore.find_by(code: params["decode"])
    if serial && shop_store
      @order = Order.new(
        shop_store_id: shop_store.id,
        serial_id: serial.id,
        order_date: Time.now)
      if @order.save
        render json: {:result => true}, status: 200
      end
    else
      render json: {:result => false}, status: 200
    end
  end

  private
    def serial_params
     params.require(:serial).permit(:open_id, :phone, :user_id, :serial_no, :product_id, :state, :store_assistant_id)
    end
end

{'fraction_non_alphanumeric': 0.11836485661989017, 'fraction_numerical': 0.007321537522879805, 'mean_word_length': 3.3271767810026387, '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': '3300383', 'n_tokens_mistral': 557, 'n_tokens_neox': 534, 'n_words': 126}