cats_core 1.4.35 → 1.4.36
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/cats/core/dispatch_plan_items_controller.rb +1 -1
- data/app/controllers/cats/core/locations_controller.rb +6 -0
- data/app/models/cats/core/dispatch_plan_item.rb +3 -0
- data/app/serializers/cats/core/dispatch_plan_item_serializer.rb +2 -1
- data/config/routes.rb +1 -0
- data/db/migrate/20210718043401_create_cats_core_dispatch_plan_items.rb +4 -0
- data/lib/cats/core/version.rb +1 -1
- data/spec/factories/cats/core/dispatch_plan_items.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b1a42d7b3cdd50ebcdcb1636aadeeeda8ecc3e9103f2ddf073c991f254d6fc5
|
4
|
+
data.tar.gz: 5bbee2e2655b3cb7d8d1f907ff941d4652e4e9058c9b7864dce87f0ad46cfef2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a9b2a00fa941cabd75a6b0dccc6ed2eb0aa8402315759d27a76786a25070193eab2ffc20c43dfe195d5353b914f9cf765578aaed6895257efb2a8360a6c2a7b
|
7
|
+
data.tar.gz: '09237ecb718238ad54943cdd534c99afce076e6afdaedfaf116c87ba68f5b0a81e6a9a6f1086504986c3f89411266ef2d0bb82c353b87ce76c23598eb93039cc'
|
@@ -18,7 +18,7 @@ module Cats
|
|
18
18
|
|
19
19
|
def model_params
|
20
20
|
params.require(:payload).permit(:reference_no, :dispatch_plan_id, :source_id, :destination_id, :quantity,
|
21
|
-
:commodity_status, :status, :commodity_id)
|
21
|
+
:unit_id, :commodity_status, :status, :commodity_id)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -19,6 +19,12 @@ module Cats
|
|
19
19
|
render json: { success: true, data: serialize(query.result) }
|
20
20
|
end
|
21
21
|
|
22
|
+
def woredas
|
23
|
+
region = Location.find(params[:id])
|
24
|
+
woredas = Location.where(id: region.descendant_ids, location_type: Location::WOREDA)
|
25
|
+
render json: { success: true, data: serialize(woredas) }
|
26
|
+
end
|
27
|
+
|
22
28
|
private
|
23
29
|
|
24
30
|
def model_params
|
@@ -11,6 +11,7 @@ module Cats
|
|
11
11
|
belongs_to :destination, class_name: 'Cats::Core::Location'
|
12
12
|
belongs_to :dispatch_plan
|
13
13
|
belongs_to :commodity
|
14
|
+
belongs_to :unit, class_name: 'Cats::Core::UnitOfMeasure'
|
14
15
|
|
15
16
|
has_many :dispatches
|
16
17
|
has_many :hub_authorizations
|
@@ -26,6 +27,8 @@ module Cats
|
|
26
27
|
delegate(:name, to: :destination, prefix: true)
|
27
28
|
delegate(:location_type, to: :source, prefix: true)
|
28
29
|
delegate(:location_type, to: :destination, prefix: true)
|
30
|
+
delegate(:abbreviation, to: :unit, prefix: true)
|
31
|
+
delegate(:shipping_reference, to: :commodity, prefix: true)
|
29
32
|
|
30
33
|
# Authorize a dispatch plan item if it contains authorization entries
|
31
34
|
# under it. A dispatch plan item can be authorized by source hub, or
|
@@ -3,7 +3,8 @@ module Cats
|
|
3
3
|
class DispatchPlanItemSerializer < ActiveModel::Serializer
|
4
4
|
attributes :id, :reference_no, :dispatch_plan_id, :plan_reference_no, :source_id, :source_name, :destination_id,
|
5
5
|
:destination_name, :quantity, :source_location_type, :destination_location_type, :commodity_status,
|
6
|
-
:status, :commodity_id, :commodity_name, :commodity_batch_no
|
6
|
+
:status, :commodity_id, :commodity_name, :commodity_batch_no, :unit_abbreviation,
|
7
|
+
:commodity_shipping_reference
|
7
8
|
end
|
8
9
|
end
|
9
10
|
end
|
data/config/routes.rb
CHANGED
@@ -39,6 +39,7 @@ Cats::Core::Engine.routes.draw do
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
+
get '/regions/:id/woredas', controller: :locations, action: :woredas, as: :region_woredas
|
42
43
|
post '/locations/filter', controller: :locations, action: :filter
|
43
44
|
resources :locations, except: %i[destroy] do
|
44
45
|
member do
|
@@ -19,6 +19,10 @@ class CreateCatsCoreDispatchPlanItems < ActiveRecord::Migration[6.1]
|
|
19
19
|
index: { name: 'commodity_on_dpi_indx' },
|
20
20
|
foreign_key: { to_table: :cats_core_commodities }
|
21
21
|
t.float :quantity, null: false
|
22
|
+
t.references :unit,
|
23
|
+
null: false,
|
24
|
+
index: { name: 'unit_on_dpi_indx' },
|
25
|
+
foreign_key: { to_table: :cats_core_unit_of_measures }
|
22
26
|
t.string :commodity_status, null: false, default: 'Good'
|
23
27
|
t.string :status, null: false, default: 'Unauthorized'
|
24
28
|
|
data/lib/cats/core/version.rb
CHANGED