cats_core 1.4.36 → 1.4.37
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2ea0d3a39edea3ab29b38b312d3d2e31e16ba07d54c0f985f5ceb248869fef4
|
4
|
+
data.tar.gz: 02e0ba07bbc6bf360a637a215faa26de072c2fe3d955547b9ba68193eca1220e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c2f4ba51cc505f5320d2dee177e5cfa1e42d72bc8bd0b69b3128141b568354220a3e4b9d681d9412aa740b2ceda1bdc1a118a774f6ff34b1e8656eaff9e08b8
|
7
|
+
data.tar.gz: c976d634759281fb71a769495282b74459ed8167eb8c61be21f8566213e7394ee6fd873ba0cc2e3905eb473a56fc8cbdbe427913d40b3e784ca33a9bbcb9296c
|
@@ -37,7 +37,7 @@ module Cats
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def remove_items
|
40
|
-
plan = @service.remove_items(params[:id], remove_params)
|
40
|
+
plan = @service.remove_items(params[:id], remove_params[:ids])
|
41
41
|
render json: { success: true, data: serialize(plan) }
|
42
42
|
rescue StandardError => e
|
43
43
|
render json: { success: false, error: e.message }
|
@@ -16,7 +16,15 @@ module Cats
|
|
16
16
|
# Commodity statuses
|
17
17
|
GOOD = 'Good'.freeze
|
18
18
|
DAMAGED = 'Damaged'.freeze
|
19
|
-
|
19
|
+
LEAKAGE = 'Leakage'.freeze
|
20
|
+
WET = 'Wet'.freeze
|
21
|
+
MOLDY = 'Moldy'.freeze
|
22
|
+
INFESTED = 'Infested'.freeze
|
23
|
+
INSECT_INFECTED = 'Insect Infected'.freeze
|
24
|
+
FAECES_FROM_RODENTS = 'Faeces From Rodents'.freeze
|
25
|
+
UNDERWEIGHT_PACKAGE = 'Underweight Package'.freeze
|
26
|
+
COMMODITY_STATUSES = [GOOD, DAMAGED, LEAKAGE, WET, MOLDY, INFESTED, INSECT_INFECTED, FAECES_FROM_RODENTS,
|
27
|
+
UNDERWEIGHT_PACKAGE].freeze
|
20
28
|
|
21
29
|
# Arrival Statuses
|
22
30
|
AT_SOURCE = 'At Source'.freeze
|
@@ -3,7 +3,7 @@ module Cats
|
|
3
3
|
class DispatchSerializer < ActiveModel::Serializer
|
4
4
|
attributes :id, :reference_no, :dispatch_plan_item_id, :transporter_id, :transporter_name, :plate_no,
|
5
5
|
:driver_name, :driver_phone, :quantity, :remark, :prepared_by_id, :prepared_by_email,
|
6
|
-
:dispatch_status, :destination, :auth_details
|
6
|
+
:dispatch_status, :destination, :auth_details, :unit_id, :commodity_status
|
7
7
|
|
8
8
|
def destination
|
9
9
|
object.dispatch_plan_item.destination.name
|
@@ -115,7 +115,7 @@ module Cats
|
|
115
115
|
.where(beneficiary_round_plan_items: { id: ids })
|
116
116
|
raise(StandardError, 'Round plan items should be from the same plan.') if plans.count > 1
|
117
117
|
|
118
|
-
unless plans.count.positive? &&
|
118
|
+
unless plans.count.positive? && plan.id == plans[0].id
|
119
119
|
raise(StandardError, 'Round plan items are not from the given round plan.')
|
120
120
|
end
|
121
121
|
|
@@ -146,10 +146,16 @@ module Cats
|
|
146
146
|
if plan.plan.program.code == 'PSNP'
|
147
147
|
rounds = plan.rounds.count
|
148
148
|
item_ids = plan.beneficiary_round_plan_items.pluck('beneficiary_plan_item_id').flatten
|
149
|
-
plan_items = BeneficiaryPlanItem.where(id: item_ids)
|
150
|
-
invalid = plan_items.select { |pi| pi.rounds - (pi.rounds_served || 0) < rounds }
|
151
|
-
|
152
|
-
|
149
|
+
plan_items = BeneficiaryPlanItem.includes(plan_item: :fdp).where(id: item_ids)
|
150
|
+
invalid = plan_items.select { |pi| pi.rounds - (pi.rounds_served || 0) < rounds }.map do |pi|
|
151
|
+
pi.plan_item.fdp.name
|
152
|
+
end
|
153
|
+
|
154
|
+
if invalid.count.positive?
|
155
|
+
msg = invalid.join(', ')
|
156
|
+
error = "The FDPs [#{msg}] exceeded their allowed number of rounds."
|
157
|
+
raise(StandardError, error)
|
158
|
+
end
|
153
159
|
|
154
160
|
items = plan_items.each_with_object([]) do |plan_item, res|
|
155
161
|
rounds_served = plan_item.rounds_served || 0
|
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.37
|
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-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|