cats_core 1.4.37 → 1.4.40

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.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/cats/core/application_controller.rb +9 -0
  3. data/app/controllers/cats/core/commodities_controller.rb +8 -2
  4. data/app/controllers/cats/core/dispatch_authorizations_controller.rb +2 -1
  5. data/app/controllers/cats/core/dispatch_plan_items_controller.rb +14 -2
  6. data/app/controllers/cats/core/dispatch_plans_controller.rb +7 -1
  7. data/app/controllers/cats/core/dispatch_transactions_controller.rb +1 -1
  8. data/app/controllers/cats/core/dispatches_controller.rb +13 -2
  9. data/app/controllers/cats/core/receipt_authorizations_controller.rb +3 -2
  10. data/app/controllers/cats/core/receipt_transactions_controller.rb +2 -1
  11. data/app/controllers/cats/core/round_plans_controller.rb +3 -2
  12. data/app/controllers/cats/core/routes_controller.rb +8 -2
  13. data/app/controllers/cats/core/stacks_controller.rb +2 -2
  14. data/app/controllers/cats/core/stores_controller.rb +4 -4
  15. data/app/controllers/cats/core/unit_conversions_controller.rb +6 -0
  16. data/app/controllers/cats/core/users_controller.rb +2 -0
  17. data/app/helpers/cats/core/document_helper.rb +12 -0
  18. data/app/models/cats/core/commodity.rb +5 -3
  19. data/app/models/cats/core/dispatch.rb +5 -0
  20. data/app/models/cats/core/donation.rb +1 -1
  21. data/app/models/cats/core/notification.rb +1 -1
  22. data/app/models/cats/core/project.rb +14 -0
  23. data/app/models/cats/core/transport_requisition_item.rb +1 -1
  24. data/app/serializers/cats/core/commodity_serializer.rb +3 -3
  25. data/app/serializers/cats/core/dispatch_serializer.rb +1 -5
  26. data/app/services/cats/core/dispatch_service.rb +11 -4
  27. data/config/routes.rb +6 -0
  28. data/db/migrate/20210717032330_create_cats_core_donations.rb +0 -1
  29. data/db/migrate/20210717032927_create_cats_core_projects.rb +17 -0
  30. data/db/migrate/20210717033223_create_cats_core_commodities.rb +4 -1
  31. data/lib/cats/core/version.rb +1 -1
  32. data/spec/factories/cats/core/commodities.rb +1 -1
  33. data/spec/factories/cats/core/donations.rb +0 -1
  34. data/spec/factories/cats/core/projects.rb +10 -0
  35. metadata +6 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f2ea0d3a39edea3ab29b38b312d3d2e31e16ba07d54c0f985f5ceb248869fef4
4
- data.tar.gz: 02e0ba07bbc6bf360a637a215faa26de072c2fe3d955547b9ba68193eca1220e
3
+ metadata.gz: f351b09b0928289a2d7a7eba97b0784bb459bec5e830a81648e1a6248d187cfb
4
+ data.tar.gz: 968878625a82ba3e0dca6b11264be31955c7e237c255684150d47f71d2b59ad6
5
5
  SHA512:
6
- metadata.gz: 9c2f4ba51cc505f5320d2dee177e5cfa1e42d72bc8bd0b69b3128141b568354220a3e4b9d681d9412aa740b2ceda1bdc1a118a774f6ff34b1e8656eaff9e08b8
7
- data.tar.gz: c976d634759281fb71a769495282b74459ed8167eb8c61be21f8566213e7394ee6fd873ba0cc2e3905eb473a56fc8cbdbe427913d40b3e784ca33a9bbcb9296c
6
+ metadata.gz: 6d2f3cff48d29e0c9e2fb370be54d735b2ac0e9e2c6d549b43bfb0c181efb17bf7dc20d2a3420240e258fbd6508e7e5347e91ee59fb2cdca8d93dbed95df6edc
7
+ data.tar.gz: d1d76375ad48d4bba448318854cca83b14ad7955e3c19ca142bfa56dd9231449e042681037daae808327b1a30518514b22bbe2653abbf8d87ccf45406bb8b0dd
@@ -14,6 +14,15 @@ module Cats
14
14
  render json: { error: 'Unauthorized' }, status: 401 if current_user.nil?
15
15
  end
16
16
 
17
+ # In case we want to disable bullet for specific controller actions
18
+ def skip_bullet
19
+ previous_value = Bullet.enable?
20
+ Bullet.enable = false
21
+ yield
22
+ ensure
23
+ Bullet.enable = previous_value
24
+ end
25
+
17
26
  private
18
27
 
19
28
  def serialize(data)
@@ -3,6 +3,12 @@ module Cats
3
3
  class CommoditiesController < ApplicationController
4
4
  include Common
5
5
 
6
+ def index
7
+ super do
8
+ Commodity.all.includes({ project: { source: :commodity_category } }, :unit_of_measure)
9
+ end
10
+ end
11
+
6
12
  def approve
7
13
  commodity = Commodity.find(params[:id])
8
14
  result = commodity.approve
@@ -12,14 +18,14 @@ module Cats
12
18
  end
13
19
 
14
20
  def filter
15
- query = Commodity.ransack(params[:q])
21
+ query = Commodity.includes(:project, :unit_of_measure).ransack(params[:q])
16
22
  render json: { success: true, data: serialize(query.result) }
17
23
  end
18
24
 
19
25
  private
20
26
 
21
27
  def model_params
22
- params.require(:payload).permit(:batch_no, :description, :unit_of_measure_id, :source_id, :commodity_grade,
28
+ params.require(:payload).permit(:batch_no, :description, :unit_of_measure_id, :project_id, :commodity_grade,
23
29
  :source_type, :quantity, :best_use_before, :volume_per_metric_ton,
24
30
  :arrival_status, :shipping_reference)
25
31
  end
@@ -5,7 +5,7 @@ module Cats
5
5
 
6
6
  def index
7
7
  super do
8
- DispatchAuthorization.where(dispatch_id: params[:id])
8
+ DispatchAuthorization.includes(:dispatch, :store, :authorized_by).where(dispatch_id: params[:id])
9
9
  end
10
10
  end
11
11
 
@@ -21,6 +21,7 @@ module Cats
21
21
  storekeeper = User.find(params[:id])
22
22
  stores = storekeeper.stores
23
23
  authorizations = DispatchAuthorization.joins(:dispatch)
24
+ .includes(:dispatch, :store, :authorized_by)
24
25
  .where(store: stores, dispatch: { dispatch_status: Dispatch::APPROVED })
25
26
  render json: { success: true, data: serialize(authorizations) }
26
27
  end
@@ -5,12 +5,24 @@ module Cats
5
5
 
6
6
  def index
7
7
  super do
8
- DispatchPlanItem.where(dispatch_plan_id: params[:id])
8
+ DispatchPlanItem.includes(
9
+ :source,
10
+ :destination,
11
+ { commodity: { project: { source: :commodity_category } } },
12
+ :unit,
13
+ :dispatch_plan
14
+ ).where(dispatch_plan_id: params[:id])
9
15
  end
10
16
  end
11
17
 
12
18
  def filter
13
- query = DispatchPlanItem.ransack(params[:q])
19
+ query = DispatchPlanItem.includes(
20
+ :source,
21
+ :destination,
22
+ { commodity: { project: { source: :commodity_category } } },
23
+ :unit,
24
+ :dispatch_plan
25
+ ).ransack(params[:q])
14
26
  render json: { success: true, data: serialize(query.result) }
15
27
  end
16
28
 
@@ -3,8 +3,14 @@ module Cats
3
3
  class DispatchPlansController < ApplicationController
4
4
  include Common
5
5
 
6
+ def index
7
+ super do
8
+ DispatchPlan.all.includes(:dispatchable)
9
+ end
10
+ end
11
+
6
12
  def plans_for_user
7
- plans = DispatchPlan.where(prepared_by: current_user)
13
+ plans = DispatchPlan.where(prepared_by: current_user).includes(:dispatchable)
8
14
  render json: { success: true, data: serialize(plans) }
9
15
  end
10
16
 
@@ -5,7 +5,7 @@ module Cats
5
5
 
6
6
  def index
7
7
  super do
8
- DispatchTransaction.where(dispatch_authorization_id: params[:id])
8
+ DispatchTransaction.includes(:source).where(dispatch_authorization_id: params[:id])
9
9
  end
10
10
  end
11
11
 
@@ -4,10 +4,16 @@ module Cats
4
4
  include Common
5
5
  skip_before_action :authenticate, only: %i[start_with_pin]
6
6
  before_action :set_service, only: %i[create_receipt_authorization approve start start_with_pin search confirm]
7
+ around_action :skip_bullet, if: -> { defined?(Bullet) }, only: %i[search start_with_pin]
7
8
 
8
9
  def index
9
10
  super do
10
- Dispatch.where(dispatch_plan_item_id: params[:id])
11
+ Dispatch.includes(
12
+ { dispatch_plan_item: :destination },
13
+ :transporter,
14
+ :prepared_by,
15
+ :unit
16
+ ).where(dispatch_plan_item_id: params[:id])
11
17
  end
12
18
  end
13
19
 
@@ -51,7 +57,12 @@ module Cats
51
57
  end
52
58
 
53
59
  def filter
54
- query = Dispatch.ransack(params[:q])
60
+ query = Dispatch.includes(
61
+ { dispatch_plan_item: :destination },
62
+ :transporter,
63
+ :prepared_by,
64
+ :unit
65
+ ).ransack(params[:q])
55
66
  render json: { success: true, data: serialize(query.result) }
56
67
  end
57
68
 
@@ -7,7 +7,7 @@ module Cats
7
7
 
8
8
  def index
9
9
  super do
10
- ReceiptAuthorization.where(dispatch_id: params[:id])
10
+ ReceiptAuthorization.includes(:dispatch, :store, :authorized_by).where(dispatch_id: params[:id])
11
11
  end
12
12
  end
13
13
 
@@ -40,7 +40,8 @@ module Cats
40
40
  storekeeper = User.find(params[:id])
41
41
  status = params[:status]
42
42
  stores = storekeeper.stores
43
- authorizations = ReceiptAuthorization.where(store: stores, status: status)
43
+ authorizations = ReceiptAuthorization.includes(:dispatch, :store, :authorized_by)
44
+ .where(store: stores, status: status)
44
45
  render json: { success: true, data: serialize(authorizations) }
45
46
  end
46
47
 
@@ -5,7 +5,8 @@ module Cats
5
5
 
6
6
  def index
7
7
  super do
8
- ReceiptTransaction.joins(receipt_authorization: :dispatch).where(receipt_authorization_id: params[:id])
8
+ ReceiptTransaction.includes(:destination, { receipt_authorization: :dispatch })
9
+ .where(receipt_authorization_id: params[:id])
9
10
  end
10
11
  end
11
12
 
@@ -4,15 +4,16 @@ module Cats
4
4
  include Common
5
5
 
6
6
  before_action :set_service, only: %i[approve generate remove_items generate_round_needs]
7
+ around_action :skip_bullet, if: -> { defined?(Bullet) }, only: %i[generate generate_round_needs remove_items]
7
8
 
8
9
  def index
9
10
  super do
10
- RoundPlan.where(plan: params[:id])
11
+ RoundPlan.includes({ plan: :program }, :region).where(plan: params[:id])
11
12
  end
12
13
  end
13
14
 
14
15
  def filter
15
- query = RoundPlan.ransack(params[:q])
16
+ query = RoundPlan.includes({ plan: :program }, :region).ransack(params[:q])
16
17
  render json: { success: true, data: serialize(query.result) }
17
18
  end
18
19
 
@@ -3,8 +3,14 @@ module Cats
3
3
  class RoutesController < ApplicationController
4
4
  include Common
5
5
 
6
+ def index
7
+ super do
8
+ Route.all.includes(:region)
9
+ end
10
+ end
11
+
6
12
  def filter
7
- query = Route.ransack(params[:q])
13
+ query = Route.includes(:region).ransack(params[:q])
8
14
  render json: { success: true, data: serialize(query.result) }
9
15
  end
10
16
 
@@ -23,7 +29,7 @@ module Cats
23
29
  end
24
30
 
25
31
  result = Route.insert_all!(data, record_timestamps: true)
26
- routes = Route.where(id: result.rows.flatten)
32
+ routes = Route.includes(:region).where(id: result.rows.flatten)
27
33
  render json: { success: true, data: serialize(routes) }
28
34
  end
29
35
 
@@ -5,12 +5,12 @@ module Cats
5
5
 
6
6
  def index
7
7
  super do
8
- Stack.where(store_id: params[:id])
8
+ Stack.includes(:commodity).where(store_id: params[:id])
9
9
  end
10
10
  end
11
11
 
12
12
  def filter
13
- query = Stack.where(store_id: params[:id]).ransack(params[:q])
13
+ query = Stack.includes(:commodity).where(store_id: params[:id]).ransack(params[:q])
14
14
  render json: { success: true, data: serialize(query.result) }
15
15
  end
16
16
 
@@ -4,19 +4,19 @@ module Cats
4
4
  include Common
5
5
 
6
6
  def index
7
- stores = Cats::Core::Store.where(warehouse_id: params[:id])
7
+ stores = Store.includes(:store_keeper, :stacks).where(warehouse_id: params[:id])
8
8
  render json: { success: true, data: serialize(stores) }
9
9
  end
10
10
 
11
11
  def filter
12
- query = Store.ransack(params[:q])
12
+ query = Store.includes(:store_keeper, :stacks).ransack(params[:q])
13
13
  render json: { success: true, data: serialize(query.result) }
14
14
  end
15
15
 
16
16
  def stores_for_hub
17
- warehouses = Cats::Core::Location.find(params[:id]).children
17
+ warehouses = Location.find(params[:id]).children
18
18
  ids = warehouses.map(&:id)
19
- stores = Cats::Core::Store.where(warehouse_id: ids)
19
+ stores = Store.includes(:store_keeper, :stacks).where(warehouse_id: ids)
20
20
  render json: { success: true, data: serialize(stores) }
21
21
  end
22
22
 
@@ -3,6 +3,12 @@ module Cats
3
3
  class UnitConversionsController < ApplicationController
4
4
  include Common
5
5
 
6
+ def index
7
+ super do
8
+ UnitConversion.all.includes(:from, :to)
9
+ end
10
+ end
11
+
6
12
  private
7
13
 
8
14
  def model_params
@@ -3,6 +3,8 @@ module Cats
3
3
  class UsersController < ApplicationController
4
4
  include Common
5
5
 
6
+ around_action :skip_bullet, if: -> { defined?(Bullet) }, only: %i[stores]
7
+
6
8
  def index
7
9
  super do
8
10
  User.joins(:application_module).where(cats_core_application_modules: { prefix: params[:prefix] })
@@ -0,0 +1,12 @@
1
+ module Cats
2
+ module Core
3
+ module DocumentHelper
4
+ require 'sablon'
5
+
6
+ def generate_document(template, output, data)
7
+ tpl = Sablon.template(template)
8
+ tpl.render_to_file(output, data)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -43,7 +43,7 @@ module Cats
43
43
  ].freeze
44
44
 
45
45
  belongs_to :unit_of_measure
46
- belongs_to :source, polymorphic: true
46
+ belongs_to :project
47
47
 
48
48
  validates :best_use_before, presence: true
49
49
  validates :batch_no, presence: true, uniqueness: true
@@ -55,10 +55,12 @@ module Cats
55
55
  validate :validate_updateability, on: :update
56
56
 
57
57
  delegate(:abbreviation, to: :unit_of_measure, prefix: 'unit')
58
- delegate(:reference_no, to: :source, prefix: true)
58
+ delegate(:code, to: :project, prefix: true)
59
59
 
60
60
  def name
61
- source.commodity_category.name
61
+ # For this to be efficient, our query should use includes like
62
+ # Commodity.includes(project: { source: commodity_category })
63
+ project.source.commodity_category.name
62
64
  end
63
65
 
64
66
  def validate_updateability
@@ -29,6 +29,11 @@ module Cats
29
29
 
30
30
  delegate(:name, to: :transporter, prefix: true)
31
31
  delegate(:email, to: :prepared_by, prefix: true)
32
+ delegate(:abbreviation, to: :unit, prefix: true)
33
+
34
+ def destination
35
+ dispatch_plan_item.destination.name
36
+ end
32
37
 
33
38
  def authorized_quantity
34
39
  dispatch_authorizations.sum(:quantity)
@@ -11,7 +11,7 @@ module Cats
11
11
  belongs_to :commodity_category, optional: true
12
12
  belongs_to :unit_of_measure, optional: true
13
13
 
14
- validates :reference_no, :amount, :donation_type, :donated_on, :agency, presence: true
14
+ validates :reference_no, :amount, :donation_type, :donated_on, presence: true
15
15
  validates :reference_no, uniqueness: true
16
16
  validates :donation_type, inclusion: { in: DONATION_TYPES }
17
17
  validates :currency, presence: true, if: -> { donation_type == CASH }
@@ -10,7 +10,7 @@ module Cats
10
10
  end
11
11
 
12
12
  def self.messages(notifications)
13
- notifications.map(&:message)
13
+ notifications.includes(:recipient).map(&:message)
14
14
  end
15
15
  end
16
16
  end
@@ -0,0 +1,14 @@
1
+ module Cats
2
+ module Core
3
+ class Project < ApplicationRecord
4
+ belongs_to :source, polymorphic: true
5
+ belongs_to :program
6
+
7
+ validates :code, presence: true, uniqueness: true
8
+ validates :year, :implementing_agency, presence: true
9
+ validates :year, numericality: { greater_than: 2000 }
10
+
11
+ delegate(:code, to: :program, prefix: true)
12
+ end
13
+ end
14
+ end
@@ -12,7 +12,7 @@ module Cats
12
12
  delegate(:source_name, to: :dispatch_plan_item, prefix: false)
13
13
 
14
14
  def commodity_name
15
- dispatch_plan_item.commodity.source.commodity_category.name
15
+ dispatch_plan_item.commodity.name
16
16
  end
17
17
 
18
18
  def woreda
@@ -1,9 +1,9 @@
1
1
  module Cats
2
2
  module Core
3
3
  class CommoditySerializer < ActiveModel::Serializer
4
- attributes :id, :name, :batch_no, :description, :unit_of_measure_id, :unit_abbreviation, :source_id,
5
- :source_type, :source_reference_no, :quantity, :best_use_before, :volume_per_metric_ton,
6
- :arrival_status, :status, :shipping_reference, :commodity_grade
4
+ attributes :id, :name, :batch_no, :description, :unit_of_measure_id, :unit_abbreviation, :project_id,
5
+ :project_code, :quantity, :best_use_before, :volume_per_metric_ton, :arrival_status, :status,
6
+ :shipping_reference, :commodity_grade
7
7
  end
8
8
  end
9
9
  end
@@ -3,11 +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, :unit_id, :commodity_status
7
-
8
- def destination
9
- object.dispatch_plan_item.destination.name
10
- end
6
+ :dispatch_status, :destination, :auth_details, :unit_id, :unit_abbreviation, :commodity_status
11
7
  end
12
8
  end
13
9
  end
@@ -19,12 +19,14 @@ module Cats
19
19
 
20
20
  if authorized
21
21
  return Dispatch.joins(:dispatch_plan_item)
22
+ .includes({ dispatch_plan_item: :destination }, :transporter, :prepared_by, :unit)
22
23
  .where(
23
24
  dispatch_plan_item: { destination: hub, status: DispatchPlanItem::AUTHORIZED },
24
25
  dispatch_status: status
25
26
  )
26
27
  end
27
28
  Dispatch.joins(:dispatch_plan_item)
29
+ .includes({ dispatch_plan_item: :destination }, :transporter, :prepared_by, :unit)
28
30
  .where(
29
31
  dispatch_plan_item: { destination: hub },
30
32
  dispatch_status: status
@@ -38,7 +40,12 @@ module Cats
38
40
  end
39
41
 
40
42
  def start_with_pin(dispatch_id, pin)
41
- dispatch = Dispatch.find(dispatch_id)
43
+ dispatch = Dispatch.includes(
44
+ { dispatch_plan_item: :destination },
45
+ :transporter,
46
+ :prepared_by,
47
+ :unit
48
+ ).find(dispatch_id)
42
49
  raise(StandardError, 'Dispatch is already started.') if dispatch.dispatch_status == Dispatch::STARTED
43
50
 
44
51
  raise(StandardError, 'No pin has been generated for dispatch.') if dispatch.auth_details.nil?
@@ -60,12 +67,12 @@ module Cats
60
67
  end
61
68
 
62
69
  def send_notification(dispatch)
63
- notification_rule = Cats::Core::NotificationRule.find_by(code: 'dispatch')
70
+ notification_rule = NotificationRule.find_by(code: 'dispatch')
64
71
  raise(StandardError, 'Notification rule not found for dispatch notification.') unless notification_rule
65
72
 
66
- users = Cats::Core::User.joins(:roles).where(cats_core_roles: { name: notification_rule.roles })
73
+ users = User.joins(:roles).where(cats_core_roles: { name: notification_rule.roles })
67
74
  location_id = dispatch.dispatch_plan_item.destination_id
68
- hub = Cats::Core::Location.find(location_id)
75
+ hub = Location.find(location_id)
69
76
  recipients = users.map do |user|
70
77
  details = user.details
71
78
 
data/config/routes.rb CHANGED
@@ -131,6 +131,12 @@ Cats::Core::Engine.routes.draw do
131
131
  action: :storekeeper_authorizations,
132
132
  as: :storekeeper_receipt_authorizations
133
133
  )
134
+ post(
135
+ '/receipt_authorizations/generate',
136
+ controller: :receipt_authorizations,
137
+ action: :generate,
138
+ as: :generate_receipt_authorizations
139
+ )
134
140
  resources :receipt_authorizations, except: %i[index destroy] do
135
141
  member do
136
142
  get 'transactions', controller: :receipt_transactions, action: :index
@@ -6,7 +6,6 @@ class CreateCatsCoreDonations < ActiveRecord::Migration[6.1]
6
6
  t.string :donation_type, null: false
7
7
  t.string :shipping_reference
8
8
  t.date :donated_on, null: false
9
- t.string :agency, null: false
10
9
  t.references :donor,
11
10
  null: false,
12
11
  index: { name: 'donor_on_donation_indx' },
@@ -0,0 +1,17 @@
1
+ class CreateCatsCoreProjects < ActiveRecord::Migration[7.0]
2
+ def change
3
+ create_table :cats_core_projects do |t|
4
+ t.string :code, unique: true
5
+ t.string :description
6
+ t.references :source, polymorphic: true
7
+ t.references :program,
8
+ null: false,
9
+ index: { name: 'program_on_projects_indx' },
10
+ foreign_key: { to_table: :cats_core_programs }
11
+ t.integer :year, null: false
12
+ t.string :implementing_agency, null: false
13
+
14
+ t.timestamps
15
+ end
16
+ end
17
+ end
@@ -6,7 +6,10 @@ class CreateCatsCoreCommodities < ActiveRecord::Migration[6.1]
6
6
  null: false,
7
7
  index: { name: 'uom_on_commodities_indx' },
8
8
  foreign_key: { to_table: :cats_core_unit_of_measures }
9
- t.references :source, polymorphic: true
9
+ t.references :project,
10
+ null: false,
11
+ index: { name: 'project_on_commodity_indx' },
12
+ foreign_key: { to_table: :cats_core_projects }
10
13
  t.float :quantity, null: false
11
14
  t.string :description
12
15
  t.date :best_use_before, null: false
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.4.37'.freeze
3
+ VERSION = '1.4.40'.freeze
4
4
  end
5
5
  end
@@ -3,7 +3,7 @@ FactoryBot.define do
3
3
  batch_no { FFaker::Name.name }
4
4
  description { FFaker::Name.name }
5
5
  unit_of_measure
6
- source factory: :gift_certificate
6
+ project
7
7
  quantity { 100 }
8
8
  best_use_before { Date.today + 2.month }
9
9
  volume_per_metric_ton { 10 }
@@ -5,7 +5,6 @@ FactoryBot.define do
5
5
  donation_type { Cats::Core::Donation::KIND }
6
6
  shipping_reference { FFaker::Name.name }
7
7
  donated_on { Date.today }
8
- agency { 'WFP' }
9
8
  donor
10
9
  plan
11
10
  amount { 100 }
@@ -0,0 +1,10 @@
1
+ FactoryBot.define do
2
+ factory :project, class: 'Cats::Core::Project' do
3
+ code { FFaker::Name.name }
4
+ description { FFaker::Name.name }
5
+ source factory: :gift_certificate
6
+ program
7
+ year { 2022 }
8
+ implementing_agency { FFaker::Name.name }
9
+ end
10
+ 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.4.37
4
+ version: 1.4.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: 2022-06-07 00:00:00.000000000 Z
11
+ date: 2022-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers
@@ -258,6 +258,7 @@ files:
258
258
  - app/controllers/cats/core/unit_of_measures_controller.rb
259
259
  - app/controllers/cats/core/users_controller.rb
260
260
  - app/controllers/concerns/cats/core/common.rb
261
+ - app/helpers/cats/core/document_helper.rb
261
262
  - app/jobs/cats/core/application_job.rb
262
263
  - app/models/cats/core/application_module.rb
263
264
  - app/models/cats/core/application_record.rb
@@ -292,6 +293,7 @@ files:
292
293
  - app/models/cats/core/plan_item.rb
293
294
  - app/models/cats/core/plan_item_detail.rb
294
295
  - app/models/cats/core/program.rb
296
+ - app/models/cats/core/project.rb
295
297
  - app/models/cats/core/purchase_order.rb
296
298
  - app/models/cats/core/ration.rb
297
299
  - app/models/cats/core/receipt.rb
@@ -387,6 +389,7 @@ files:
387
389
  - db/migrate/20210717032330_create_cats_core_donations.rb
388
390
  - db/migrate/20210717032602_create_cats_core_gift_certificates.rb
389
391
  - db/migrate/20210717032855_create_cats_core_purchase_orders.rb
392
+ - db/migrate/20210717032927_create_cats_core_projects.rb
390
393
  - db/migrate/20210717033223_create_cats_core_commodities.rb
391
394
  - db/migrate/20210717140855_create_cats_core_stores.rb
392
395
  - db/migrate/20210717171101_create_cats_core_stacks.rb
@@ -467,6 +470,7 @@ files:
467
470
  - spec/factories/cats/core/plan_items.rb
468
471
  - spec/factories/cats/core/plans.rb
469
472
  - spec/factories/cats/core/programs.rb
473
+ - spec/factories/cats/core/projects.rb
470
474
  - spec/factories/cats/core/purchase_orders.rb
471
475
  - spec/factories/cats/core/rations.rb
472
476
  - spec/factories/cats/core/receipt_authorizations.rb