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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 186d5da451b5abf3212599586408ca925e553e855f185b2ac52038a7cfa7b651
4
- data.tar.gz: 7fa1c103c95c8f80d98f75be767bf346b4cb5bfab1cf066776e3ae8880a95621
3
+ metadata.gz: 9b1a42d7b3cdd50ebcdcb1636aadeeeda8ecc3e9103f2ddf073c991f254d6fc5
4
+ data.tar.gz: 5bbee2e2655b3cb7d8d1f907ff941d4652e4e9058c9b7864dce87f0ad46cfef2
5
5
  SHA512:
6
- metadata.gz: cd85c7c41b4a8c7ab65f388969b4e9e6e5a6191c1eaf19c01bcf6cdbef36018d76136ab73c1bcf57b4fe47f81e5ab6062df1da4ca98970aaec7ddef593818bd7
7
- data.tar.gz: 885be8ea62166c70ae4bf3e4f900ed12a18ddecd0b9ba712643e3fe1e781b4099f7e2b8010ca5fdc14ef57089956fe2c43e2de0f36eabe343d69689b13c4b233
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
 
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.4.35'.freeze
3
+ VERSION = '1.4.36'.freeze
4
4
  end
5
5
  end
@@ -5,6 +5,7 @@ FactoryBot.define do
5
5
  destination factory: :location
6
6
  dispatch_plan
7
7
  quantity { 100 }
8
+ unit factory: :unit_of_measure
8
9
  commodity
9
10
  commodity_status { Cats::Core::Commodity::GOOD }
10
11
  status { Cats::Core::DispatchPlanItem::UNAUTHORIZED }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cats_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.35
4
+ version: 1.4.36
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.