cats_core 1.0.35 → 1.0.39

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: 3b2945064c03295f5dcd5971f0e6ce570b50e4616166030f17fa5a6bd869d5cd
4
- data.tar.gz: 3a6e091d8830f0d30ef67285547b64e2fa327e3efbbaad99449daf4cce0c67fa
3
+ metadata.gz: dbd96f5c771c2adceaa0d3c058ba5643b6e38189b4a5afdfbe666affab5a3c36
4
+ data.tar.gz: b55e4ab59388139d7c591194059f001af370df848077f446640ec3e1dc25f975
5
5
  SHA512:
6
- metadata.gz: 58327459e7bbf5c43a08787c53d7ad8b9e08a7b8b6453e1ed06493e173a45cac45d82f0cdf3ddfbd5b6c106df31932e0ac637a0a3dd35a2d9493dc56ee1ad37a
7
- data.tar.gz: 3065d7e0fceee9696d93851cb6c35be27fef7e3fd0779e783a490f8fe548eed6dc96348fe1be64be7f318fb845417ad0bbc23f1d0551cdcb4e56a1d669b3bc8a
6
+ metadata.gz: '0812bb8e9484cc6dd7f375434c294e7f82320999a9a3ae7a5793c6ede1592fe9eefe50895892895cabe240d1c0fa12197dd9bf2479e1f816d8d31f3c98fe7575'
7
+ data.tar.gz: dc903f04dddb57c08c4c80c0a3c0135b85254a12bc634414a96eab76bdb39c85cf96e2f37abf47d4853b084651a843d45bd42b5cf2771d0667fdab152e260569
@@ -9,7 +9,7 @@ module Cats
9
9
  MEHER = 'Meher'.freeze
10
10
  SEASONS = [BELG, MEHER].freeze
11
11
 
12
- belongs_to :ration
12
+ belongs_to :ration, optional: true
13
13
  has_many :hrp_items
14
14
 
15
15
  validates :reference_no, :year, :status, presence: true
@@ -6,7 +6,6 @@ module Cats
6
6
  belongs_to :operator
7
7
 
8
8
  validates :beneficiaries, presence: true, numericality: { greater_than: 0 }
9
- validates :commodity_amount, presence: true, numericality: { greater_than: 0 }
10
9
  validates :hrp_id, uniqueness: { scope: :woreda_id }
11
10
 
12
11
  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
@@ -2,11 +2,8 @@ module Cats
2
2
  module Core
3
3
  class Ration < ApplicationRecord
4
4
  belongs_to :program
5
- belongs_to :commodity_category
6
5
 
7
- validates :reference_no, :amount, presence: true
8
- validates :reference_no, uniqueness: true
9
- validates :amount, numericality: { greater_than: 0 }
6
+ validates :reference_no, presence: true, uniqueness: true
10
7
  end
11
8
  end
12
9
  end
@@ -0,0 +1,14 @@
1
+ module Cats
2
+ module Core
3
+ class RationItem < ApplicationRecord
4
+ belongs_to :commodity_category
5
+ belongs_to :ration
6
+ belongs_to :unit_of_measure
7
+
8
+ validates :amount, presence: true, numericality: { greater_than: 0 }
9
+
10
+ delegate(:name, to: :commodity_category, prefix: true)
11
+ delegate(:abbreviation, to: :unit_of_measure, prefix: true)
12
+ end
13
+ end
14
+ end
@@ -6,11 +6,6 @@ class CreateCatsCoreRations < ActiveRecord::Migration[6.1]
6
6
  null: false,
7
7
  index: { name: 'program_on_ration_indx' },
8
8
  foreign_key: { to_table: :cats_core_programs }
9
- t.references :commodity_category,
10
- null: false,
11
- index: { name: 'cc_on_ration_indx' },
12
- foreign_key: { to_table: :cats_core_commodity_categories }
13
- t.float :amount, null: false
14
9
  t.boolean :current, null: false, default: true
15
10
 
16
11
  t.timestamps
@@ -0,0 +1,21 @@
1
+ class CreateCatsCoreRationItems < ActiveRecord::Migration[6.1]
2
+ def change
3
+ create_table :cats_core_ration_items do |t|
4
+ t.references :commodity_category,
5
+ null: false,
6
+ index: { name: 'cc_on_ration_indx' },
7
+ foreign_key: { to_table: :cats_core_commodity_categories }
8
+ t.references :ration,
9
+ null: false,
10
+ index: { name: 'ri_on_ration_indx' },
11
+ foreign_key: { to_table: :cats_core_rations }
12
+ t.references :unit_of_measure,
13
+ null: false,
14
+ index: { name: 'uom_on_ration_indx' },
15
+ foreign_key: { to_table: :cats_core_unit_of_measures }
16
+ t.float :amount, null: false
17
+
18
+ t.timestamps
19
+ end
20
+ end
21
+ end
@@ -7,7 +7,7 @@ class CreateCatsCoreHrps < ActiveRecord::Migration[6.1]
7
7
  t.string :status, null: false, default: 'Draft'
8
8
 
9
9
  t.references :ration,
10
- null: false,
10
+ null: true,
11
11
  index: { name: 'ration_on_hrp_indx' },
12
12
  foreign_key: { to_table: :cats_core_rations }
13
13
 
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.0.35'.freeze
3
+ VERSION = '1.0.39'.freeze
4
4
  end
5
5
  end
@@ -0,0 +1,7 @@
1
+ FactoryBot.define do
2
+ factory :hrp_item_detail, class: 'Cats::Core::HrpItemDetail' do
3
+ hrp_item
4
+ ration_item
5
+ amount { 150 }
6
+ end
7
+ end
@@ -3,7 +3,6 @@ FactoryBot.define do
3
3
  hrp
4
4
  woreda
5
5
  beneficiaries { 100 }
6
- commodity_amount { 100 }
7
6
  operator
8
7
  end
9
8
  end
@@ -0,0 +1,8 @@
1
+ FactoryBot.define do
2
+ factory :ration_item, class: 'Cats::Core::RationItem' do
3
+ commodity_category
4
+ ration
5
+ amount { 150 }
6
+ unit_of_measure
7
+ end
8
+ end
@@ -2,8 +2,6 @@ FactoryBot.define do
2
2
  factory :ration, class: 'Cats::Core::Ration' do
3
3
  reference_no { FFaker::Name.name }
4
4
  program
5
- commodity_category
6
- amount { 1.5 }
7
5
  current { false }
8
6
  end
9
7
  end
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.35
4
+ version: 1.0.39
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-18 00:00:00.000000000 Z
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
@@ -250,6 +251,7 @@ files:
250
251
  - app/models/cats/core/program.rb
251
252
  - app/models/cats/core/purchase_order.rb
252
253
  - app/models/cats/core/ration.rb
254
+ - app/models/cats/core/ration_item.rb
253
255
  - app/models/cats/core/receipt.rb
254
256
  - app/models/cats/core/receipt_transaction.rb
255
257
  - app/models/cats/core/rhn_request.rb
@@ -290,8 +292,10 @@ files:
290
292
  - db/migrate/20210716210905_create_cats_core_suppliers.rb
291
293
  - db/migrate/20210717031108_create_cats_core_donors.rb
292
294
  - db/migrate/20210717031216_create_cats_core_rations.rb
295
+ - db/migrate/20210717031343_create_cats_core_ration_items.rb
293
296
  - db/migrate/20210717031810_create_cats_core_hrps.rb
294
297
  - db/migrate/20210717032024_create_cats_core_hrp_items.rb
298
+ - db/migrate/20210717032240_create_cats_core_hrp_item_details.rb
295
299
  - db/migrate/20210717032330_create_cats_core_donations.rb
296
300
  - db/migrate/20210717032602_create_cats_core_gift_certificates.rb
297
301
  - db/migrate/20210717032855_create_cats_core_purchase_orders.rb
@@ -325,6 +329,7 @@ files:
325
329
  - spec/factories/cats/core/donations.rb
326
330
  - spec/factories/cats/core/donors.rb
327
331
  - spec/factories/cats/core/gift_certificates.rb
332
+ - spec/factories/cats/core/hrp_item_details.rb
328
333
  - spec/factories/cats/core/hrp_items.rb
329
334
  - spec/factories/cats/core/hrps.rb
330
335
  - spec/factories/cats/core/locations.rb
@@ -334,6 +339,7 @@ files:
334
339
  - spec/factories/cats/core/operators.rb
335
340
  - spec/factories/cats/core/programs.rb
336
341
  - spec/factories/cats/core/purchase_orders.rb
342
+ - spec/factories/cats/core/ration_items.rb
337
343
  - spec/factories/cats/core/rations.rb
338
344
  - spec/factories/cats/core/receipt_transactions.rb
339
345
  - spec/factories/cats/core/receipts.rb