add migration
This commit is contained in:
@@ -81,7 +81,9 @@ class Api::BatchLineItemsController < ApplicationController
|
||||
client_id=""
|
||||
qty = params[:qty]
|
||||
total_count=0
|
||||
|
||||
puts batch_id
|
||||
puts 'ello'
|
||||
puts params[:id]
|
||||
# check_member= Member.authenticate_session_token(session_token)
|
||||
# if !check_member.nil?
|
||||
encrypt_key=""
|
||||
@@ -89,6 +91,8 @@ class Api::BatchLineItemsController < ApplicationController
|
||||
|
||||
find_batch = Batch.find_by_id(batch_id)
|
||||
if !find_batch.nil?
|
||||
find_batch.generated_qty = qty
|
||||
find_batch.save
|
||||
card_type=find_batch.adult_or_child.upcase
|
||||
product_category_id=find_batch.product_category_id
|
||||
find_product_category=ProductCategory.find_by_id(product_category_id)
|
||||
@@ -141,9 +145,17 @@ class Api::BatchLineItemsController < ApplicationController
|
||||
manufacture_uid = params[:manufacture_uid]
|
||||
batch_line_item = BatchLineItem.find_by_asset_identity(account_no)
|
||||
if !batch_line_item.nil?
|
||||
puts 'he'
|
||||
batch_line_item.manufacture_uid = manufacture_uid
|
||||
batch_line_item.save
|
||||
|
||||
# update batch
|
||||
batch = Batch.find_by_id(batch_line_item.batch_id)
|
||||
card_qty=batch.qty_processing.to_i
|
||||
success_qty=batch.qty_success
|
||||
|
||||
batch.qty_processing=card_qty+1
|
||||
batch.qty_success=success_qty+1
|
||||
batch.save
|
||||
|
||||
@out = true,"success"
|
||||
else
|
||||
|
||||
5
db/migrate/20180627041112_add_generated_qty.rb
Normal file
5
db/migrate/20180627041112_add_generated_qty.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class AddGeneratedQty < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
add_column :batches, :generated_qty, :integer
|
||||
end
|
||||
end
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20180226100816) do
|
||||
ActiveRecord::Schema.define(version: 20180627041112) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@@ -49,6 +49,7 @@ ActiveRecord::Schema.define(version: 20180226100816) do
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "adult_or_child", default: "CHILD"
|
||||
t.integer "product_category_id"
|
||||
t.integer "generated_qty"
|
||||
t.index ["client_id"], name: "index_batches_on_client_id", using: :btree
|
||||
t.index ["product_category_id"], name: "index_batches_on_product_category_id", using: :btree
|
||||
t.index ["user_id"], name: "index_batches_on_user_id", using: :btree
|
||||
|
||||
Reference in New Issue
Block a user