cats_core 1.0.36 → 1.0.40
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/cats/core/hrp.rb +1 -1
- data/app/models/cats/core/hrp_item.rb +2 -1
- data/app/models/cats/core/hrp_item_detail.rb +11 -0
- data/app/models/cats/core/ration_item.rb +3 -0
- data/db/migrate/20210717031810_create_cats_core_hrps.rb +1 -1
- data/db/migrate/20210717032024_create_cats_core_hrp_items.rb +0 -1
- data/db/migrate/20210717032240_create_cats_core_hrp_item_details.rb +18 -0
- data/lib/cats/core/version.rb +1 -1
- data/spec/factories/cats/core/hrp_item_details.rb +7 -0
- data/spec/factories/cats/core/hrp_items.rb +0 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37b5451e19e51157d009365bb31175b4d944c3571fcb0d9b6ec3d3dcebb7289d
|
4
|
+
data.tar.gz: 8b98610327bb324b7804b837c446883eb2853faeb244686bababae44d71b02ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 132f9f7a5af86d83a87a8410490dcc0bd1a2134feb1da3fa8dd3eabe3508e9359369e0ec5aa15918e072fe5769f5645229f006c39c7fd070cbfb756b3ee3fad4
|
7
|
+
data.tar.gz: 218d19acc42b5508c85f9b4e1f3c5b4112bf85b120114038d4f30af3ed4631d92e5dccee8c1f26931b24122d93c62a95ec92bf438785166da69c240306b0cc69
|
data/app/models/cats/core/hrp.rb
CHANGED
@@ -5,8 +5,9 @@ module Cats
|
|
5
5
|
belongs_to :woreda, -> { where(location_type: Cats::Core::Location::WOREDA) }, class_name: 'Cats::Core::Location'
|
6
6
|
belongs_to :operator
|
7
7
|
|
8
|
+
has_many :hrp_item_details
|
9
|
+
|
8
10
|
validates :beneficiaries, presence: true, numericality: { greater_than: 0 }
|
9
|
-
validates :commodity_amount, presence: true, numericality: { greater_than: 0 }
|
10
11
|
validates :hrp_id, uniqueness: { scope: :woreda_id }
|
11
12
|
|
12
13
|
delegate(:name, to: :woreda, prefix: true)
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Cats
|
2
|
+
module Core
|
3
|
+
class HrpItemDetail < ApplicationRecord
|
4
|
+
belongs_to :hrp_item
|
5
|
+
belongs_to :ration_item
|
6
|
+
|
7
|
+
validates :amount, presence: true, numericality: { greater_than: 0 }
|
8
|
+
validates :hrp_item_id, uniqueness: { scope: :ration_item_id }
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -10,7 +10,6 @@ class CreateCatsCoreHrpItems < ActiveRecord::Migration[6.1]
|
|
10
10
|
index: { name: 'woreda_on_hrp_items_idnx' },
|
11
11
|
foreign_key: { to_table: :cats_core_locations }
|
12
12
|
t.integer :beneficiaries, null: false
|
13
|
-
t.float :commodity_amount, null: false
|
14
13
|
t.references :operator,
|
15
14
|
null: false,
|
16
15
|
index: { name: 'operator_on_hrp_items_indx' },
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreateCatsCoreHrpItemDetails < ActiveRecord::Migration[6.1]
|
2
|
+
def change
|
3
|
+
create_table :cats_core_hrp_item_details do |t|
|
4
|
+
t.references :hrp_item,
|
5
|
+
null: false,
|
6
|
+
index: { name: 'hi_on_hid_indx' },
|
7
|
+
foreign_key: { to_table: :cats_core_hrp_items }
|
8
|
+
t.references :ration_item,
|
9
|
+
null: false,
|
10
|
+
index: { name: 'ri_on_hid_indx' },
|
11
|
+
foreign_key: { to_table: :cats_core_ration_items }
|
12
|
+
t.float :amount, null: false
|
13
|
+
|
14
|
+
t.timestamps
|
15
|
+
end
|
16
|
+
add_index(:cats_core_hrp_item_details, [:hrp_item_id, :ration_item_id], unique: true, name: 'hii_rii_on_hid_indx')
|
17
|
+
end
|
18
|
+
end
|
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.0.
|
4
|
+
version: 1.0.40
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henock L.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|
@@ -242,6 +242,7 @@ files:
|
|
242
242
|
- app/models/cats/core/gift_certificate.rb
|
243
243
|
- app/models/cats/core/hrp.rb
|
244
244
|
- app/models/cats/core/hrp_item.rb
|
245
|
+
- app/models/cats/core/hrp_item_detail.rb
|
245
246
|
- app/models/cats/core/location.rb
|
246
247
|
- app/models/cats/core/menu.rb
|
247
248
|
- app/models/cats/core/menu_item.rb
|
@@ -294,6 +295,7 @@ files:
|
|
294
295
|
- db/migrate/20210717031343_create_cats_core_ration_items.rb
|
295
296
|
- db/migrate/20210717031810_create_cats_core_hrps.rb
|
296
297
|
- db/migrate/20210717032024_create_cats_core_hrp_items.rb
|
298
|
+
- db/migrate/20210717032240_create_cats_core_hrp_item_details.rb
|
297
299
|
- db/migrate/20210717032330_create_cats_core_donations.rb
|
298
300
|
- db/migrate/20210717032602_create_cats_core_gift_certificates.rb
|
299
301
|
- db/migrate/20210717032855_create_cats_core_purchase_orders.rb
|
@@ -327,6 +329,7 @@ files:
|
|
327
329
|
- spec/factories/cats/core/donations.rb
|
328
330
|
- spec/factories/cats/core/donors.rb
|
329
331
|
- spec/factories/cats/core/gift_certificates.rb
|
332
|
+
- spec/factories/cats/core/hrp_item_details.rb
|
330
333
|
- spec/factories/cats/core/hrp_items.rb
|
331
334
|
- spec/factories/cats/core/hrps.rb
|
332
335
|
- spec/factories/cats/core/locations.rb
|