cats_core 1.4.33 → 1.4.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/controllers/cats/core/receipts_controller.rb +2 -1
- data/app/models/cats/core/dispatch_plan_item.rb +3 -0
- data/app/serializers/cats/core/dispatch_plan_item_serializer.rb +2 -1
- data/app/services/cats/core/round_plan_service.rb +8 -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 +2 -2
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
|
@@ -12,7 +12,8 @@ module Cats
|
|
12
12
|
private
|
13
13
|
|
14
14
|
def model_params
|
15
|
-
params.require(:payload).permit(:receipt_authorization_id, :commodity_status, :commodity_grade, :quantity,
|
15
|
+
params.require(:payload).permit(:receipt_authorization_id, :commodity_status, :commodity_grade, :quantity,
|
16
|
+
:remark)
|
16
17
|
end
|
17
18
|
end
|
18
19
|
end
|
@@ -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
|
@@ -7,7 +7,7 @@ module Cats
|
|
7
7
|
|
8
8
|
raise(StandardError, 'Plan has no plan items.') if round_plan.round_plan_items.count.zero?
|
9
9
|
|
10
|
-
round_plan.
|
10
|
+
clear_needs(round_plan.id)
|
11
11
|
|
12
12
|
details = []
|
13
13
|
rations = round_plan.round_rations
|
@@ -32,6 +32,13 @@ module Cats
|
|
32
32
|
round_plan
|
33
33
|
end
|
34
34
|
|
35
|
+
def clear_needs(plan_id)
|
36
|
+
Cats::Core::RoundPlanItemDetail
|
37
|
+
.joins(beneficiary_round_plan_item: :round_plan_item)
|
38
|
+
.where(cats_core_beneficiary_round_plan_items: { cats_core_round_plan_items: { round_plan_id: plan_id } })
|
39
|
+
.delete_all
|
40
|
+
end
|
41
|
+
|
35
42
|
def generate_round_plan(reference_no, rounds, plan_id, region_id)
|
36
43
|
round_plan = Cats::Core::RoundPlan.create!(
|
37
44
|
plan_id: plan_id,
|
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
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cats_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.36
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henock L.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-06-
|
11
|
+
date: 2022-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|