cats_core 1.4.43 → 1.4.46
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_plans_controller.rb +1 -1
- data/app/controllers/cats/core/dispatch_transactions_controller.rb +5 -0
- data/app/controllers/cats/core/loans_controller.rb +2 -2
- data/app/controllers/cats/core/purchase_orders_controller.rb +1 -1
- data/app/controllers/cats/core/receipt_transactions_controller.rb +5 -0
- data/app/controllers/cats/core/swaps_controller.rb +3 -3
- data/app/models/cats/core/commodity.rb +1 -1
- data/app/models/cats/core/commodity_donation.rb +4 -0
- data/app/models/cats/core/loan.rb +4 -0
- data/app/models/cats/core/purchase_order.rb +4 -0
- data/app/models/cats/core/stack.rb +2 -1
- data/app/models/cats/core/swap.rb +4 -0
- data/app/services/cats/core/authorization_service.rb +17 -0
- data/config/routes.rb +2 -0
- data/db/migrate/20210717032855_create_cats_core_purchase_orders.rb +1 -0
- data/db/migrate/20220626063501_create_cats_core_loans.rb +1 -0
- data/db/migrate/20220626063757_create_cats_core_swaps.rb +1 -0
- data/lib/cats/core/version.rb +1 -1
- data/spec/factories/cats/core/dispatch_plan_items.rb +1 -1
- data/spec/factories/cats/core/loans.rb +1 -0
- data/spec/factories/cats/core/purchase_orders.rb +1 -0
- data/spec/factories/cats/core/swaps.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: 35e8eb4c24f3e5499dae203f071d84e56efc538665557820ebb0c0c4b56a8d8e
|
4
|
+
data.tar.gz: fe6f7c522a28fcbdc53c0f61dfc7b0844970564de93952c134965055c0501cb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fad95b3e3b72ab44e84cb72954d9f825a2ff40be3c615685be577fd49e54fb123f6e6b4be4ad42ea1008bd9f64c2e42091666fad8f1c7e6546cb6368e1ae83b
|
7
|
+
data.tar.gz: 385a523e608cf19f3871495b94d0b3c52621bb14caaaf164daf13c08509e24a64b3fe4a044443d0cef1952a6899ce1e760c9dcfbe04cae29265bb9f8819fd1f3
|
@@ -12,8 +12,8 @@ module Cats
|
|
12
12
|
private
|
13
13
|
|
14
14
|
def model_params
|
15
|
-
params.require(:payload).permit(:reference_no, :lender, :agreement_date, :repayment_date,
|
16
|
-
:commodity_category_id)
|
15
|
+
params.require(:payload).permit(:reference_no, :description, :lender, :agreement_date, :repayment_date,
|
16
|
+
:quantity, :unit_id, :commodity_category_id)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -17,7 +17,7 @@ module Cats
|
|
17
17
|
def model_params
|
18
18
|
params.require(:payload).permit(:reference_no, :order_date, :requisition_no, :supplier, :cash_donation_id,
|
19
19
|
:commodity_category_id, :quantity, :purchase_type, :unit_id, :price,
|
20
|
-
:currency_id)
|
20
|
+
:currency_id, :description)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -12,9 +12,9 @@ module Cats
|
|
12
12
|
private
|
13
13
|
|
14
14
|
def model_params
|
15
|
-
params.require(:payload).permit(:reference_no, :swapper, :agreement_date, :issued_commodity_id,
|
16
|
-
:issued_quantity, :received_commodity_id, :received_quantity,
|
17
|
-
:
|
15
|
+
params.require(:payload).permit(:reference_no, :swapper, :agreement_date, :issued_commodity_id, :description,
|
16
|
+
:issued_quantity, :received_commodity_id, :received_quantity, :issued_unit_id,
|
17
|
+
:received_unit_id)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -60,7 +60,7 @@ module Cats
|
|
60
60
|
def name
|
61
61
|
# For this to be efficient, our query should use includes like
|
62
62
|
# Commodity.includes(project: { source: commodity_category })
|
63
|
-
project.source.
|
63
|
+
project.source.commodity_name
|
64
64
|
end
|
65
65
|
|
66
66
|
def validate_updateability
|
@@ -10,6 +10,10 @@ module Cats
|
|
10
10
|
delegate(:reference_no, to: :plan, prefix: true, allow_nil: true)
|
11
11
|
delegate(:name, to: :commodity_category, prefix: true)
|
12
12
|
delegate(:abbreviation, to: :unit, prefix: true)
|
13
|
+
|
14
|
+
def commodity_name
|
15
|
+
commodity_category.name
|
16
|
+
end
|
13
17
|
end
|
14
18
|
end
|
15
19
|
end
|
@@ -21,7 +21,8 @@ module Cats
|
|
21
21
|
validates :stack_status, inclusion: { in: STACK_STATUSES }
|
22
22
|
validate :validate_coordinates, :validate_dimensions, :validate_distance_from_wall, :validate_overlap,
|
23
23
|
:validate_space_between_stack, :validate_max_height, :validate_max_length, :validate_max_width,
|
24
|
-
:validate_distance_from_ceiling,
|
24
|
+
:validate_distance_from_ceiling,
|
25
|
+
unless: -> { store && (store.code == 'SUP-STORE' || store.code.start_with?('FDP;')) }
|
25
26
|
|
26
27
|
delegate :batch_no, to: :commodity, prefix: true
|
27
28
|
|
@@ -14,6 +14,10 @@ module Cats
|
|
14
14
|
delegate(:name, to: :received_commodity, prefix: true)
|
15
15
|
delegate(:abbreviation, to: :issued_unit, prefix: true)
|
16
16
|
delegate(:abbreviation, to: :received_unit, prefix: true)
|
17
|
+
|
18
|
+
def commodity_name
|
19
|
+
received_commodity.name
|
20
|
+
end
|
17
21
|
end
|
18
22
|
end
|
19
23
|
end
|
@@ -43,6 +43,23 @@ module Cats
|
|
43
43
|
authorization.dispatch.stack
|
44
44
|
authorization
|
45
45
|
end
|
46
|
+
|
47
|
+
def receipt_authorization(id)
|
48
|
+
item = DispatchPlanItem.find(id).includes(
|
49
|
+
:destination,
|
50
|
+
:unit,
|
51
|
+
commodity: { project: :source }
|
52
|
+
)
|
53
|
+
{
|
54
|
+
date: Date.today,
|
55
|
+
reference_no: item.reference_no,
|
56
|
+
destination: item.destination.name,
|
57
|
+
source: item.commodity.project.source.description,
|
58
|
+
commodity: "#{item.commodity.project.source.commodity_name} (#{item.commodity.batch_no})",
|
59
|
+
unit: item.unit.abbreviation,
|
60
|
+
quantity: item.quantity
|
61
|
+
}
|
62
|
+
end
|
46
63
|
end
|
47
64
|
end
|
48
65
|
end
|
data/config/routes.rb
CHANGED
@@ -167,7 +167,9 @@ Cats::Core::Engine.routes.draw do
|
|
167
167
|
action: :create_allocation,
|
168
168
|
as: :allocation_transaction
|
169
169
|
)
|
170
|
+
post '/dispatch_transactions/filter', controller: :dispatch_transactions, action: :filter
|
170
171
|
resources :dispatch_transactions, except: %i[index new edit destroy]
|
172
|
+
post '/receipt_transactions/filter', controller: :receipt_transactions, action: :filter
|
171
173
|
resources :receipt_transactions, except: %i[index new edit destroy]
|
172
174
|
resources :lost_commodities, except: %i[index destroy]
|
173
175
|
get '/plans/:id/round_plans', controller: :round_plans, action: :index, as: :round_plans_plan
|
@@ -2,6 +2,7 @@ class CreateCatsCorePurchaseOrders < ActiveRecord::Migration[6.1]
|
|
2
2
|
def change
|
3
3
|
create_table :cats_core_purchase_orders do |t|
|
4
4
|
t.string :reference_no, unique: true
|
5
|
+
t.string :description
|
5
6
|
t.date :order_date, null: false
|
6
7
|
t.string :requisition_no
|
7
8
|
t.string :supplier, null: false
|
@@ -2,6 +2,7 @@ class CreateCatsCoreSwaps < ActiveRecord::Migration[7.0]
|
|
2
2
|
def change
|
3
3
|
create_table :cats_core_swaps do |t|
|
4
4
|
t.string :reference_no, unique: true
|
5
|
+
t.string :description
|
5
6
|
t.string :swapper, null: false
|
6
7
|
t.date :agreement_date, null: false
|
7
8
|
t.float :issued_quantity, null: false
|
data/lib/cats/core/version.rb
CHANGED
@@ -2,7 +2,7 @@ FactoryBot.define do
|
|
2
2
|
factory :dispatch_plan_item, class: 'Cats::Core::DispatchPlanItem' do
|
3
3
|
reference_no { FFaker::Name.name }
|
4
4
|
source factory: :location
|
5
|
-
destination factory: :
|
5
|
+
destination factory: :woreda
|
6
6
|
dispatch_plan
|
7
7
|
quantity { 100 }
|
8
8
|
unit factory: :unit_of_measure
|
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.46
|
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-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|