cats_core 1.3.16 → 1.3.20

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2ad7f2aaa0c106926140445109463f49c20ef3c4d7336de19a4f99abe4152b48
4
- data.tar.gz: ffb46327fe5ab23994d9ada4ab2d8cbdcfba90f7f44436a8f95b87bb8e9fc21d
3
+ metadata.gz: 9e298fc271839d6ddb95ce6fc876b1b6438e31fb15c94049ffc6e36431670330
4
+ data.tar.gz: 3a8d54022afad56f01b5be2433cbcf28154cf8a7ba7eee5390a3c3265d139037
5
5
  SHA512:
6
- metadata.gz: e7ec684441796002b858da2a27ae38eecc14dea715682ea44f361434af24324236ddcd1ecd178dca5b9f44e99442341b6a667e43a0de9afafe12f37b21619628
7
- data.tar.gz: 8887e74996a6a483da128576e049b630d20c0deb097d6e309a96be5421e11794b4e2033b8a25ee26f08fcb8de40e0a9e592336f4b97b79a1e71461364c0215bd
6
+ metadata.gz: 7cc8eb81b7edd12b5676d45c67b84d16fd8cb869cf5ad515736a3584a8c3dd4bf8274e3364c35b4bced831e9c0e94edcb124cfb1bfc22c551db36fd4c0f16456
7
+ data.tar.gz: 2e9555de096c8a8c22295ff8ef0247de401a2906862800fa31b8e1f4f49dbdb2cac88751941f84d28a4217390bdcd3698790ade35d4fab75eea6e09fd79544c6
@@ -11,8 +11,7 @@ module Cats
11
11
  private
12
12
 
13
13
  def model_params
14
- params.require(:payload).permit(:dispatch_plan_id, :source_id, :destination_id, :quantity, :commodity_id,
15
- :commodity_status)
14
+ params.require(:payload).permit(:dispatch_plan_id, :source_id, :destination_id, :quantity, :commodity_status)
16
15
  end
17
16
  end
18
17
  end
@@ -57,7 +57,7 @@ module Cats
57
57
  end
58
58
 
59
59
  def commodity
60
- data = @dispatch.dispatch_plan_item.commodity
60
+ data = @dispatch.dispatch_plan_item.dispatch_plan.commodity
61
61
  render json: { success: true, data: serialize(data) }
62
62
  end
63
63
 
@@ -15,10 +15,9 @@ module Cats
15
15
  validates :reference_no, presence: true, uniqueness: true
16
16
  validates :status, inclusion: { in: STATUSES }
17
17
 
18
- delegate(:batch_no, to: :commodity, prefix: true)
19
- delegate(:name, to: :commodity, prefix: true)
20
- delegate(:quantity, to: :commodity, prefix: true)
18
+ delegate(:batch_no, :name, :quantity, to: :commodity, prefix: true)
21
19
  delegate(:reference_no, to: :request, prefix: true, allow_nil: true)
20
+ delegate(:quantity, to: :request, prefix: true, allow_nil: true)
22
21
 
23
22
  def approve
24
23
  raise(StandardError, 'Dispatch plan already approved.') if status == APPROVED
@@ -1,7 +1,6 @@
1
1
  module Cats
2
2
  module Core
3
3
  class DispatchPlanItem < ApplicationRecord
4
- belongs_to :commodity
5
4
  belongs_to :source, class_name: 'Cats::Core::Location'
6
5
  belongs_to :destination, class_name: 'Cats::Core::Location'
7
6
  belongs_to :dispatch_plan
@@ -11,7 +10,7 @@ module Cats
11
10
  validates :quantity, presence: true, numericality: { greater_than: 0 }
12
11
 
13
12
  delegate(:reference_no, to: :dispatch_plan, prefix: :plan, allow_nil: true)
14
- delegate(:batch_no, to: :commodity, prefix: true)
13
+ delegate(:commodity_batch_no, :commodity_name, to: :dispatch_plan)
15
14
  delegate(:name, to: :source, prefix: true)
16
15
  delegate(:name, to: :destination, prefix: true)
17
16
  delegate(:location_type, to: :source, prefix: true)
@@ -7,6 +7,8 @@ module Cats
7
7
  has_many :monthly_plan_item_details
8
8
 
9
9
  validates :beneficiaries, presence: true, numericality: { greater_than: 0 }
10
+
11
+ delegate(:reference_no, to: :monthly_plan, prefix: 'plan')
10
12
  end
11
13
  end
12
14
  end
@@ -7,7 +7,7 @@ module Cats
7
7
 
8
8
  def message
9
9
  dispatch = params[:dispatch]
10
- commodity = dispatch.dispatch_plan_item.commodity
10
+ commodity = dispatch.dispatch_plan_item.dispatch_plan.commodity
11
11
  title = "Dispatch Notification - #{commodity.name}"
12
12
  date = Date.today
13
13
  body = <<~BODY
@@ -3,7 +3,8 @@ module Cats
3
3
  class DispatchPlanService
4
4
  def approve(plan)
5
5
  plan.approve
6
- send_notification(plan)
6
+ plan.request.allocate if plan.request_id
7
+ # send_notification(plan)
7
8
  plan
8
9
  end
9
10
 
@@ -18,7 +19,6 @@ module Cats
18
19
  end
19
20
  plan.prepared_by = user
20
21
  result = plan.save
21
- plan.request.allocate if result && plan.request_id
22
22
 
23
23
  [result, plan]
24
24
  end
@@ -10,7 +10,7 @@ module Cats
10
10
  store = Cats::Core::Store.find_by(code: 'SUP-STORE')
11
11
  raise(StandardError, 'Supplier store does not exist.') unless store
12
12
 
13
- commodity = plan_item.commodity
13
+ commodity = plan_item.dispatch_plan.commodity
14
14
  stack = store.stacks.find_by(commodity: commodity)
15
15
 
16
16
  raise(StandardError, 'Commodity not found in supplier store.') unless stack
@@ -5,10 +5,6 @@ class CreateCatsCoreDispatchPlanItems < ActiveRecord::Migration[6.1]
5
5
  null: false,
6
6
  index: { name: 'dpi_on_dp_indx' },
7
7
  foreign_key: { to_table: :cats_core_dispatch_plans }
8
- t.references :commodity,
9
- null: false,
10
- index: { name: 'dpi_on_commodity_indx' },
11
- foreign_key: { to_table: :cats_core_commodities }
12
8
  t.references :source,
13
9
  null: false,
14
10
  index: { name: 'dpi_on_source_indx' },
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.3.16'.freeze
3
+ VERSION = '1.3.20'.freeze
4
4
  end
5
5
  end
@@ -1,6 +1,5 @@
1
1
  FactoryBot.define do
2
2
  factory :dispatch_plan_item, class: 'Cats::Core::DispatchPlanItem' do
3
- commodity
4
3
  source factory: :location
5
4
  destination factory: :location
6
5
  dispatch_plan
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.3.16
4
+ version: 1.3.20
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-01-13 00:00:00.000000000 Z
11
+ date: 2022-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers
@@ -86,28 +86,28 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 6.1.4
89
+ version: 7.0.1
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 6.1.4
96
+ version: 7.0.1
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: ransack
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 2.4.2
103
+ version: '0'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: 2.4.2
110
+ version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rolify
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -470,7 +470,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
470
470
  - !ruby/object:Gem::Version
471
471
  version: '0'
472
472
  requirements: []
473
- rubygems_version: 3.2.22
473
+ rubygems_version: 3.2.32
474
474
  signing_key:
475
475
  specification_version: 4
476
476
  summary: Core module for CATS applications