cats_core 1.0.35 → 1.0.36

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: 3b2945064c03295f5dcd5971f0e6ce570b50e4616166030f17fa5a6bd869d5cd
4
- data.tar.gz: 3a6e091d8830f0d30ef67285547b64e2fa327e3efbbaad99449daf4cce0c67fa
3
+ metadata.gz: c909272a932180976b058fc2514d349d48677862c5bee425d97e1ebb1d92f30e
4
+ data.tar.gz: 57060b872361ba7f38b5bffe9522241ccb147bb3fac27b7e593288937a771672
5
5
  SHA512:
6
- metadata.gz: 58327459e7bbf5c43a08787c53d7ad8b9e08a7b8b6453e1ed06493e173a45cac45d82f0cdf3ddfbd5b6c106df31932e0ac637a0a3dd35a2d9493dc56ee1ad37a
7
- data.tar.gz: 3065d7e0fceee9696d93851cb6c35be27fef7e3fd0779e783a490f8fe548eed6dc96348fe1be64be7f318fb845417ad0bbc23f1d0551cdcb4e56a1d669b3bc8a
6
+ metadata.gz: af510c6f846701bea55bd995f6ccf3d34500c11c8a23cdac2df2f89f258170c4f93fb31c9242eaf927ed3a24a5e499fdd2c995ca1d2c178d9e39c60364e6d072
7
+ data.tar.gz: 19dff931a8a64a71870263e2193709f541ea530110ac852ef0c751bca2e8739d996c8da2ad53c3465d720ad2167a34ead9c9cca36cd42956db7abecf6b1b37fa
@@ -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,11 @@
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
+ end
10
+ end
11
+ 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
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.0.35'.freeze
3
+ VERSION = '1.0.36'.freeze
4
4
  end
5
5
  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,7 +1,7 @@
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.36
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.
@@ -250,6 +250,7 @@ files:
250
250
  - app/models/cats/core/program.rb
251
251
  - app/models/cats/core/purchase_order.rb
252
252
  - app/models/cats/core/ration.rb
253
+ - app/models/cats/core/ration_item.rb
253
254
  - app/models/cats/core/receipt.rb
254
255
  - app/models/cats/core/receipt_transaction.rb
255
256
  - app/models/cats/core/rhn_request.rb
@@ -290,6 +291,7 @@ files:
290
291
  - db/migrate/20210716210905_create_cats_core_suppliers.rb
291
292
  - db/migrate/20210717031108_create_cats_core_donors.rb
292
293
  - db/migrate/20210717031216_create_cats_core_rations.rb
294
+ - db/migrate/20210717031343_create_cats_core_ration_items.rb
293
295
  - db/migrate/20210717031810_create_cats_core_hrps.rb
294
296
  - db/migrate/20210717032024_create_cats_core_hrp_items.rb
295
297
  - db/migrate/20210717032330_create_cats_core_donations.rb
@@ -334,6 +336,7 @@ files:
334
336
  - spec/factories/cats/core/operators.rb
335
337
  - spec/factories/cats/core/programs.rb
336
338
  - spec/factories/cats/core/purchase_orders.rb
339
+ - spec/factories/cats/core/ration_items.rb
337
340
  - spec/factories/cats/core/rations.rb
338
341
  - spec/factories/cats/core/receipt_transactions.rb
339
342
  - spec/factories/cats/core/receipts.rb