bigbang_engine 0.2.0 → 0.3.1
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/bigbang_engine-0.1.0.gem +0 -0
- data/bigbang_engine-0.2.0.gem +0 -0
- data/bigbang_engine.gemspec +3 -11
- data/bin/console +1 -1
- data/lib/bigbang_engine/support.rb +1 -1
- data/lib/bigbang_engine/support/concerns/fund_concern/associations.rb +37 -35
- data/lib/bigbang_engine/support/concerns/fund_concern/callbacks.rb +34 -32
- data/lib/bigbang_engine/support/concerns/fund_concern/delegators.rb +15 -13
- data/lib/bigbang_engine/support/concerns/fund_concern/scopes.rb +25 -23
- data/lib/bigbang_engine/support/version.rb +5 -0
- metadata +4 -3
- data/lib/bigbang_engine.rb +0 -5
- data/lib/bigbang_engine/version.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a38ff75a2a80e6b21e2c82757fdbb2e14f430e1
|
4
|
+
data.tar.gz: 62261e8ddd249a1903de19ddfee436a9bd2d835a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9a303b31d488bfdf268161388cfe5293bec25b563cdf051703eda505595816caa51836263221eed9a847c2359045566bd3ad1d8d1a4d34cb0ccd1928614c42e
|
7
|
+
data.tar.gz: aa461e295f495ff0a371a8dcebf61b75b35d8836210697a969f17946e433ca877347ad1cdc2493fac92fa15627bbc2df1faeba06913b187424695a25aede2443
|
Binary file
|
Binary file
|
data/bigbang_engine.gemspec
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'bigbang_engine/version'
|
4
|
+
require 'bigbang_engine/support/version'
|
5
|
+
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
8
|
spec.name = "bigbang_engine"
|
8
|
-
spec.version = BigbangEngine::VERSION
|
9
|
+
spec.version = BigbangEngine::Support::VERSION
|
9
10
|
spec.authors = ["Vitor Vidotto"]
|
10
11
|
spec.email = ["vvidotto@bip.b.br"]
|
11
12
|
|
@@ -13,15 +14,6 @@ Gem::Specification.new do |spec|
|
|
13
14
|
spec.description = %q{Extraction of part of the intelligence behind BigBang}
|
14
15
|
spec.homepage = "https://bitbucket.org/guideinvestimentos/"
|
15
16
|
|
16
|
-
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
|
-
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
-
# if spec.respond_to?(:metadata)
|
19
|
-
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
20
|
-
# else
|
21
|
-
# raise "RubyGems 2.0 or newer is required to protect against " \
|
22
|
-
# "public gem pushes."
|
23
|
-
# end
|
24
|
-
|
25
17
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
26
18
|
f.match(%r{^(test|spec|features)/})
|
27
19
|
end
|
data/bin/console
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require "bundler/setup"
|
4
|
-
require "bigbang_engine"
|
4
|
+
require "bigbang_engine/support"
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -1,2 +1,2 @@
|
|
1
1
|
|
2
|
-
require '
|
2
|
+
require 'bigbang_engine/support/concerns/fund_concern'
|
@@ -1,44 +1,46 @@
|
|
1
|
-
module
|
2
|
-
module
|
3
|
-
module
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
1
|
+
module BigbangEngine
|
2
|
+
module Support
|
3
|
+
module FundConcern
|
4
|
+
module Associations
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
included do
|
7
|
+
belongs_to :administrator
|
8
|
+
belongs_to :manager
|
9
|
+
belongs_to :asset_strategy
|
10
|
+
belongs_to :asset_sub_strategy
|
11
|
+
belongs_to :client
|
12
|
+
belongs_to :rebate_group
|
12
13
|
|
13
|
-
|
14
|
+
has_many :attachments
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
16
|
+
has_one :promotional_material,
|
17
|
+
-> { where(attachable_foreign_key: :promotional_material) },
|
18
|
+
as: :attachable, class_name: 'Attachment', dependent: :destroy
|
18
19
|
|
19
|
-
|
20
|
-
|
20
|
+
has_one :regulation, -> { where(attachable_foreign_key: :regulation) },
|
21
|
+
as: :attachable, class_name: 'Attachment', dependent: :destroy
|
21
22
|
|
22
|
-
|
23
|
-
|
23
|
+
has_one :sheet_complementary_form, -> { where(attachable_foreign_key: :sheet_complementary_form) },
|
24
|
+
as: :attachable, class_name: 'Attachment', dependent: :destroy
|
24
25
|
|
25
|
-
|
26
|
-
|
26
|
+
has_one :sheet_essential, -> { where(attachable_foreign_key: :sheet_essential) },
|
27
|
+
as: :attachable, class_name: 'Attachment', dependent: :destroy
|
27
28
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
29
|
+
has_many :documents, class_name: "Documentation", as: Fund
|
30
|
+
has_many :bank_accounts, as: :accountable, dependent: :destroy
|
31
|
+
has_many :shares, dependent: :destroy
|
32
|
+
has_one :info, dependent: :destroy, class_name: "FundInfo"
|
33
|
+
has_one :transactions_info, class_name: "FundTransactionsInfo"
|
34
|
+
has_one :monthly_fund_sheet
|
35
|
+
accepts_nested_attributes_for :promotional_material, allow_destroy: true
|
36
|
+
accepts_nested_attributes_for :regulation, allow_destroy: true
|
37
|
+
accepts_nested_attributes_for :sheet_essential, allow_destroy: true
|
38
|
+
accepts_nested_attributes_for :sheet_complementary_form, allow_destroy: true
|
39
|
+
accepts_nested_attributes_for :bank_accounts, allow_destroy: true
|
40
|
+
accepts_nested_attributes_for :info, allow_destroy: true
|
41
|
+
accepts_nested_attributes_for :transactions_info, allow_destroy: true
|
42
|
+
end
|
41
43
|
end
|
42
44
|
end
|
43
45
|
end
|
44
|
-
end
|
46
|
+
end
|
@@ -1,41 +1,43 @@
|
|
1
|
-
module
|
2
|
-
module
|
3
|
-
module
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
module BigbangEngine
|
2
|
+
module Support
|
3
|
+
module FundConcern
|
4
|
+
module Callbacks
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
included do
|
7
|
+
before_save :update_client_attributes
|
8
|
+
before_validation :reject_attachments
|
9
|
+
end
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
def update_client_attributes
|
12
|
+
if client
|
13
|
+
client.update_attribute(:name, name) if name_changed?
|
14
|
+
client.update_attribute(:document, cnpj) if cnpj_changed?
|
15
|
+
end
|
14
16
|
end
|
15
|
-
end
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
18
|
+
def reject_attachments
|
19
|
+
self.promotional_material = nil if promotional_material &&
|
20
|
+
promotional_material.file_file_name.blank?
|
21
|
+
self.regulation = nil if regulation && regulation.file_file_name.blank?
|
22
|
+
self.sheet_complementary_form = nil if sheet_complementary_form &&
|
23
|
+
sheet_complementary_form.file_file_name.blank?
|
24
|
+
self.sheet_essential = nil if sheet_essential &&
|
25
|
+
sheet_essential.file_file_name.blank?
|
26
|
+
true
|
27
|
+
end
|
27
28
|
|
28
|
-
|
29
|
-
|
30
|
-
|
29
|
+
def after_save_asset
|
30
|
+
set_status
|
31
|
+
end
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
33
|
+
def after_destroy_asset
|
34
|
+
set_status
|
35
|
+
end
|
35
36
|
|
36
|
-
|
37
|
-
|
38
|
-
|
37
|
+
def set_status
|
38
|
+
manager.status = manager.balances.actives.empty? ? :inactive : :active
|
39
|
+
manager.save!
|
40
|
+
end
|
39
41
|
end
|
40
42
|
end
|
41
43
|
end
|
@@ -1,16 +1,18 @@
|
|
1
|
-
module
|
2
|
-
module
|
3
|
-
module
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
1
|
+
module BigbangEngine
|
2
|
+
module Support
|
3
|
+
module FundConcern
|
4
|
+
module Delegators
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
included do
|
7
|
+
delegate :double_count, to: :manager, allow_nil: true
|
8
|
+
delegate :bmark, to: :asset_strategy
|
9
|
+
delegate :name, to: :administrator, prefix: true, allow_nil: true
|
10
|
+
delegate :name, to: :manager, prefix: true, allow_nil: true
|
11
|
+
delegate :email, to: :manager, prefix: true, allow_nil: true
|
12
|
+
delegate :adm_fee_calculation_type,
|
13
|
+
to: :rebate_group, allow_nil: true
|
14
|
+
delegate :share_treshold, to: :asset_sub_strategy, allow_nil: true
|
15
|
+
end
|
14
16
|
end
|
15
17
|
end
|
16
18
|
end
|
@@ -1,29 +1,31 @@
|
|
1
|
-
module
|
2
|
-
module
|
3
|
-
module
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
module BigbangEngine
|
2
|
+
module Support
|
3
|
+
module FundConcern
|
4
|
+
module Scopes
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
included do
|
7
|
+
scope :double_count, ->(flag) {
|
8
|
+
joins(:manager).where("managers.double_count = #{flag}")
|
9
|
+
}
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
11
|
+
scope :to_website,
|
12
|
+
-> { with_info.where("show_on_website = 1").by_name }
|
13
|
+
scope :share_gaps,
|
14
|
+
-> { with_info.where("fund_infos.terminated = 0").by_name }
|
15
|
+
scope :with_transactions, -> { joins(:transactions).uniq }
|
16
|
+
scope :with_sheets, -> {
|
17
|
+
with_info.where.not(fund_infos: {sheet_id: nil}).
|
18
|
+
by_name.pluck(:name, :id)
|
19
|
+
}
|
19
20
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
scope :exclusive_funds, -> {
|
22
|
+
with_info.includes(:asset, :client).where(
|
23
|
+
"fund_infos.exclusive = 1 AND client_id IS NOT NULL").map(&:asset)
|
24
|
+
}
|
24
25
|
|
25
|
-
|
26
|
-
|
26
|
+
private
|
27
|
+
scope :with_info, -> { joins(:info) }
|
28
|
+
end
|
27
29
|
end
|
28
30
|
end
|
29
31
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bigbang_engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vitor Vidotto
|
@@ -65,16 +65,17 @@ files:
|
|
65
65
|
- Gemfile
|
66
66
|
- README.md
|
67
67
|
- Rakefile
|
68
|
+
- bigbang_engine-0.1.0.gem
|
69
|
+
- bigbang_engine-0.2.0.gem
|
68
70
|
- bigbang_engine.gemspec
|
69
71
|
- bin/console
|
70
72
|
- bin/setup
|
71
|
-
- lib/bigbang_engine.rb
|
72
73
|
- lib/bigbang_engine/support.rb
|
73
74
|
- lib/bigbang_engine/support/concerns/fund_concern/associations.rb
|
74
75
|
- lib/bigbang_engine/support/concerns/fund_concern/callbacks.rb
|
75
76
|
- lib/bigbang_engine/support/concerns/fund_concern/delegators.rb
|
76
77
|
- lib/bigbang_engine/support/concerns/fund_concern/scopes.rb
|
77
|
-
- lib/bigbang_engine/version.rb
|
78
|
+
- lib/bigbang_engine/support/version.rb
|
78
79
|
homepage: https://bitbucket.org/guideinvestimentos/
|
79
80
|
licenses: []
|
80
81
|
metadata: {}
|
data/lib/bigbang_engine.rb
DELETED