cats_core 1.4.38 → 1.4.41
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 +4 -4
- data/app/controllers/cats/core/application_controller.rb +9 -0
- data/app/controllers/cats/core/dispatches_controller.rb +1 -0
- data/app/controllers/cats/core/round_plans_controller.rb +1 -0
- data/app/controllers/cats/core/users_controller.rb +2 -0
- data/app/models/cats/core/donation.rb +1 -1
- data/app/models/cats/core/project.rb +4 -0
- data/db/migrate/20210717032330_create_cats_core_donations.rb +0 -1
- data/db/migrate/20210717032927_create_cats_core_projects.rb +4 -0
- data/lib/cats/core/version.rb +1 -1
- data/spec/factories/cats/core/donations.rb +0 -1
- data/spec/factories/cats/core/projects.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4084a8e84ceacfb0f4e96ebba6f9c1bfb41cdf64e36341955dfd86131a5de89e
|
4
|
+
data.tar.gz: c091888b5e67a9ecc85e3dce2e5fa33aacab4d617bf31767ded0117329c2f4db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca7b27982330acd7df6ebf118e9412fcca962f6436903f7e48c0f1603b5d1bcc1a04b6bb5a508cd7579aa42bedb0e62ed548495759f7a7291b91f3f064ccaaa7
|
7
|
+
data.tar.gz: dac15feb2a1280d856a5ac280498a4b5e7c1585bccdcf74d4a5f78eb41a8e7562c6bdeebf5f53c150586d964cdd2af5663fc5fa588c6765917118526bd7c57c2
|
@@ -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)
|
@@ -4,6 +4,7 @@ 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
|
@@ -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] })
|
@@ -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,
|
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 }
|
@@ -2,10 +2,14 @@ module Cats
|
|
2
2
|
module Core
|
3
3
|
class Project < ApplicationRecord
|
4
4
|
belongs_to :source, polymorphic: true
|
5
|
+
belongs_to :program
|
5
6
|
|
6
7
|
validates :code, presence: true, uniqueness: true
|
7
8
|
validates :year, :implementing_agency, presence: true
|
8
9
|
validates :year, numericality: { greater_than: 2000 }
|
10
|
+
|
11
|
+
delegate(:code, to: :program, prefix: true)
|
12
|
+
delegate(:reference_no, to: :source, prefix: true)
|
9
13
|
end
|
10
14
|
end
|
11
15
|
end
|
@@ -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' },
|
@@ -4,6 +4,10 @@ class CreateCatsCoreProjects < ActiveRecord::Migration[7.0]
|
|
4
4
|
t.string :code, unique: true
|
5
5
|
t.string :description
|
6
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 }
|
7
11
|
t.integer :year, null: false
|
8
12
|
t.string :implementing_agency, null: false
|
9
13
|
|
data/lib/cats/core/version.rb
CHANGED