mas-rad_core 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +3 -0
- data/Rakefile +14 -0
- data/app/models/accreditation.rb +5 -0
- data/app/models/adviser.rb +61 -0
- data/app/models/allowed_payment_method.rb +7 -0
- data/app/models/authentication.rb +19 -0
- data/app/models/firm.rb +143 -0
- data/app/models/in_person_advice_method.rb +7 -0
- data/app/models/initial_advice_fee_structure.rb +7 -0
- data/app/models/initial_meeting_duration.rb +7 -0
- data/app/models/investment_size.rb +7 -0
- data/app/models/lookup/adviser.rb +10 -0
- data/app/models/lookup/firm.rb +17 -0
- data/app/models/lookup/subsidiary.rb +11 -0
- data/app/models/ongoing_advice_fee_structure.rb +7 -0
- data/app/models/other_advice_method.rb +7 -0
- data/app/models/principal.rb +94 -0
- data/app/models/professional_body.rb +3 -0
- data/app/models/professional_standing.rb +3 -0
- data/app/models/qualification.rb +5 -0
- data/app/models/travel_distance.rb +15 -0
- data/config/routes.rb +2 -0
- data/db/migrate/20141211110031_create_lookup_firms.rb +11 -0
- data/db/migrate/20141221140208_create_principals.rb +23 -0
- data/db/migrate/20141222150416_add_last_sign_in_at_to_principal.rb +5 -0
- data/db/migrate/20141230112136_create_lookup_subsidiaries.rb +10 -0
- data/db/migrate/20150106115732_remove_last_sign_in_at_from_principals.rb +5 -0
- data/db/migrate/20150114144343_create_lookup_advisers.rb +10 -0
- data/db/migrate/20150114151447_create_firms.rb +13 -0
- data/db/migrate/20150115130949_add_address_to_firm.rb +9 -0
- data/db/migrate/20150119102735_create_in_person_advice_methods.rb +15 -0
- data/db/migrate/20150119111754_create_other_advice_methods.rb +15 -0
- data/db/migrate/20150119114218_add_free_initial_meeting_to_firm.rb +5 -0
- data/db/migrate/20150119125208_create_initial_meeting_durations.rb +11 -0
- data/db/migrate/20150119152325_create_initial_advice_fee_structures.rb +15 -0
- data/db/migrate/20150119152336_create_ongoing_advice_fee_structures.rb +15 -0
- data/db/migrate/20150120133717_create_allowed_payment_methods.rb +15 -0
- data/db/migrate/20150120141928_add_minimum_fixed_fee_to_firm.rb +5 -0
- data/db/migrate/20150120150738_create_investment_sizes.rb +15 -0
- data/db/migrate/20150121110757_create_advisers.rb +11 -0
- data/db/migrate/20150121123437_add_business_income_breakdown_fields_to_firm.rb +11 -0
- data/db/migrate/20150121134845_create_qualifications.rb +15 -0
- data/db/migrate/20150121154458_create_accreditations.rb +15 -0
- data/db/migrate/20150121173015_create_professional_standings.rb +15 -0
- data/db/migrate/20150121181341_create_professional_bodies.rb +15 -0
- data/db/migrate/20150121183728_add_confirmed_disclaimer_to_advisers.rb +5 -0
- data/db/migrate/20150124124350_add_geographical_fields_to_adviser.rb +7 -0
- data/db/migrate/20150125145457_add_parent_id_to_firms.rb +5 -0
- data/db/migrate/20150125164156_remove_unique_constraint_from_firms_fca_number.rb +5 -0
- data/db/migrate/20150127084858_add_ordering_on_reference_data.rb +31 -0
- data/db/migrate/20150209144836_remove_covers_whole_of_uk_from_advisers.rb +17 -0
- data/lib/mas/rad_core.rb +4 -0
- data/lib/mas/rad_core/engine.rb +21 -0
- data/lib/mas/rad_core/version.rb +5 -0
- data/lib/mas/stats.rb +19 -0
- data/lib/mas/tasks/rad_core_tasks.rake +4 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +29 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +26 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.example.yml +14 -0
- data/spec/dummy/config/database.yml +13 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +41 -0
- data/spec/dummy/config/environments/production.rb +79 -0
- data/spec/dummy/config/environments/test.rb +42 -0
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/db/schema.rb +246 -0
- data/spec/dummy/log/test.log +13097 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/factories/accreditation.rb +5 -0
- data/spec/factories/adviser.rb +21 -0
- data/spec/factories/allowed_payment_method.rb +5 -0
- data/spec/factories/firm.rb +34 -0
- data/spec/factories/in_person_advice_method.rb +5 -0
- data/spec/factories/initial_advice_fee_structure.rb +5 -0
- data/spec/factories/initial_meeting_duration.rb +5 -0
- data/spec/factories/investment_size.rb +5 -0
- data/spec/factories/lookup_firm.rb +6 -0
- data/spec/factories/ongoing_advice_fee_structure.rb +5 -0
- data/spec/factories/other_advice_method.rb +5 -0
- data/spec/factories/principal.rb +15 -0
- data/spec/factories/professional_body.rb +5 -0
- data/spec/factories/professional_standing.rb +5 -0
- data/spec/factories/qualification.rb +5 -0
- data/spec/models/accreditation_spec.rb +3 -0
- data/spec/models/adviser_spec.rb +93 -0
- data/spec/models/allowed_payment_method_spec.rb +3 -0
- data/spec/models/firm_spec.rb +188 -0
- data/spec/models/in_person_advice_method_spec.rb +3 -0
- data/spec/models/initial_advice_fee_structure_spec.rb +3 -0
- data/spec/models/initial_meeting_duration_spec.rb +3 -0
- data/spec/models/investment_size_spec.rb +3 -0
- data/spec/models/lookup/adviser_spec.rb +21 -0
- data/spec/models/lookup/firm_spec.rb +19 -0
- data/spec/models/ongoing_advice_fee_structure_spec.rb +3 -0
- data/spec/models/other_advice_method_spec.rb +3 -0
- data/spec/models/principal_spec.rb +185 -0
- data/spec/models/qualification_spec.rb +3 -0
- data/spec/spec_helper.rb +24 -0
- data/spec/support/shared_examples/reference_data.rb +14 -0
- metadata +361 -0
data/config/routes.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
class CreateLookupFirms < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :lookup_firms do |t|
|
4
|
+
t.integer :fca_number, null: false
|
5
|
+
t.string :registered_name, null: false, default: ''
|
6
|
+
t.index :fca_number, unique: true
|
7
|
+
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class CreatePrincipals < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :principals do |t|
|
4
|
+
with_options null: false do
|
5
|
+
t.integer :fca_number, length: 6
|
6
|
+
t.index :fca_number, unique: true
|
7
|
+
|
8
|
+
t.string :token, length: 32
|
9
|
+
t.index :token, unique: true
|
10
|
+
|
11
|
+
t.string :website_address
|
12
|
+
t.string :first_name
|
13
|
+
t.string :last_name
|
14
|
+
t.string :job_title
|
15
|
+
t.string :email_address
|
16
|
+
t.string :telephone_number
|
17
|
+
t.boolean :confirmed_disclaimer, default: false
|
18
|
+
|
19
|
+
t.timestamps
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateFirms < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :firms do |t|
|
4
|
+
t.integer :fca_number, null: false
|
5
|
+
t.string :registered_name, null: false
|
6
|
+
t.string :email_address
|
7
|
+
t.string :telephone_number
|
8
|
+
t.index :fca_number, unique: true
|
9
|
+
|
10
|
+
t.timestamps null: false
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class AddAddressToFirm < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
add_column :firms, :address_line_one, :string
|
4
|
+
add_column :firms, :address_line_two, :string
|
5
|
+
add_column :firms, :address_town, :string
|
6
|
+
add_column :firms, :address_county, :string
|
7
|
+
add_column :firms, :address_postcode, :string
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateInPersonAdviceMethods < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :in_person_advice_methods do |t|
|
4
|
+
t.string :name, null: false, unique: true
|
5
|
+
|
6
|
+
t.timestamps null: false
|
7
|
+
end
|
8
|
+
|
9
|
+
create_join_table :firms, :in_person_advice_methods do |t|
|
10
|
+
t.index %i(firm_id in_person_advice_method_id),
|
11
|
+
name: 'firms_in_person_advice_methods_index',
|
12
|
+
unique: true
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateOtherAdviceMethods < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :other_advice_methods do |t|
|
4
|
+
t.string :name, null: false, unique: true
|
5
|
+
|
6
|
+
t.timestamps null: false
|
7
|
+
end
|
8
|
+
|
9
|
+
create_join_table :firms, :other_advice_methods do |t|
|
10
|
+
t.index %i(firm_id other_advice_method_id),
|
11
|
+
name: 'firms_other_advice_methods_index',
|
12
|
+
unique: true
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class CreateInitialMeetingDurations < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :initial_meeting_durations do |t|
|
4
|
+
t.string :name, null: false, unique: true
|
5
|
+
|
6
|
+
t.timestamps null: false
|
7
|
+
end
|
8
|
+
|
9
|
+
add_reference :firms, :initial_meeting_duration, index: true
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateInitialAdviceFeeStructures < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :initial_advice_fee_structures do |t|
|
4
|
+
t.string :name, null: false, unique: true
|
5
|
+
|
6
|
+
t.timestamps null: false
|
7
|
+
end
|
8
|
+
|
9
|
+
create_join_table :firms, :initial_advice_fee_structures do |t|
|
10
|
+
t.index %i(firm_id initial_advice_fee_structure_id),
|
11
|
+
name: 'firms_initial_advice_fee_structures_index',
|
12
|
+
unique: true
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateOngoingAdviceFeeStructures < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :ongoing_advice_fee_structures do |t|
|
4
|
+
t.string :name, null: false, unique: true
|
5
|
+
|
6
|
+
t.timestamps null: false
|
7
|
+
end
|
8
|
+
|
9
|
+
create_join_table :firms, :ongoing_advice_fee_structures do |t|
|
10
|
+
t.index %i(firm_id ongoing_advice_fee_structure_id),
|
11
|
+
name: 'firms_ongoing_advice_fee_structures_index',
|
12
|
+
unique: true
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateAllowedPaymentMethods < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :allowed_payment_methods do |t|
|
4
|
+
t.string :name, null: false, unique: true
|
5
|
+
|
6
|
+
t.timestamps null: false
|
7
|
+
end
|
8
|
+
|
9
|
+
create_join_table :firms, :allowed_payment_methods do |t|
|
10
|
+
t.index %i(firm_id allowed_payment_method_id),
|
11
|
+
name: 'firms_allowed_payment_methods_index',
|
12
|
+
unique: true
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateInvestmentSizes < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :investment_sizes do |t|
|
4
|
+
t.string :name, null: false, unique: true
|
5
|
+
|
6
|
+
t.timestamps null: false
|
7
|
+
end
|
8
|
+
|
9
|
+
create_join_table :firms, :investment_sizes do |t|
|
10
|
+
t.index %i(firm_id investment_size_id),
|
11
|
+
name: 'firms_investment_sizes_index',
|
12
|
+
unique: true
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class CreateAdvisers < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :advisers do |t|
|
4
|
+
t.string :reference_number, null: false, unique: true, length: 8
|
5
|
+
t.string :name, null: false
|
6
|
+
t.belongs_to :firm, null: false
|
7
|
+
|
8
|
+
t.timestamps null: false
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class AddBusinessIncomeBreakdownFieldsToFirm < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
add_column :firms, :retirement_income_products_percent, :integer
|
4
|
+
add_column :firms, :pension_transfer_percent, :integer
|
5
|
+
add_column :firms, :long_term_care_percent, :integer
|
6
|
+
add_column :firms, :equity_release_percent, :integer
|
7
|
+
add_column :firms, :inheritance_tax_and_estate_planning_percent, :integer
|
8
|
+
add_column :firms, :wills_and_probate_percent, :integer
|
9
|
+
add_column :firms, :other_percent, :integer
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateQualifications < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :qualifications do |t|
|
4
|
+
t.string :name, null: false
|
5
|
+
|
6
|
+
t.timestamps null: false
|
7
|
+
end
|
8
|
+
|
9
|
+
create_join_table :advisers, :qualifications do |t|
|
10
|
+
t.index %i(adviser_id qualification_id),
|
11
|
+
unique: true,
|
12
|
+
name: 'advisers_qualifications_index'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateAccreditations < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :accreditations do |t|
|
4
|
+
t.string :name, null: false
|
5
|
+
|
6
|
+
t.timestamps null: false
|
7
|
+
end
|
8
|
+
|
9
|
+
create_join_table :advisers, :accreditations do |t|
|
10
|
+
t.index %i(adviser_id accreditation_id),
|
11
|
+
unique: true,
|
12
|
+
name: 'advisers_accreditations_index'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateProfessionalStandings < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :professional_standings do |t|
|
4
|
+
t.string :name, null: false
|
5
|
+
|
6
|
+
t.timestamps null: false
|
7
|
+
end
|
8
|
+
|
9
|
+
create_join_table :advisers, :professional_standings do |t|
|
10
|
+
t.index %i(adviser_id professional_standing_id),
|
11
|
+
unique: true,
|
12
|
+
name: 'advisers_professional_standings_index'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateProfessionalBodies < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :professional_bodies do |t|
|
4
|
+
t.string :name, null: false
|
5
|
+
|
6
|
+
t.timestamps null: false
|
7
|
+
end
|
8
|
+
|
9
|
+
create_join_table :advisers, :professional_bodies do |t|
|
10
|
+
t.index %i(adviser_id professional_body_id),
|
11
|
+
unique: true,
|
12
|
+
name: 'advisers_professional_bodies_index'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
class AddGeographicalFieldsToAdviser < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
add_column :advisers, :postcode, :string, null: false, default: ''
|
4
|
+
add_column :advisers, :travel_distance, :integer, null: false, default: 0
|
5
|
+
add_column :advisers, :covers_whole_of_uk, :boolean, null: false, default: false
|
6
|
+
end
|
7
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
class AddOrderingOnReferenceData < ActiveRecord::Migration
|
2
|
+
REFERENCE_TABLES = [
|
3
|
+
:accreditations,
|
4
|
+
:allowed_payment_methods,
|
5
|
+
:in_person_advice_methods,
|
6
|
+
:initial_advice_fee_structures,
|
7
|
+
:initial_meeting_durations,
|
8
|
+
:investment_sizes,
|
9
|
+
:ongoing_advice_fee_structures,
|
10
|
+
:other_advice_methods,
|
11
|
+
:professional_bodies,
|
12
|
+
:professional_standings,
|
13
|
+
:qualifications
|
14
|
+
]
|
15
|
+
|
16
|
+
def up
|
17
|
+
REFERENCE_TABLES.each do |table|
|
18
|
+
add_column table, :order, :integer, null: false, default: 0
|
19
|
+
|
20
|
+
table.to_s.classify.constantize.unscoped.order(:id).each do |m|
|
21
|
+
m.update_attribute(:order, m.id)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def down
|
27
|
+
REFERENCE_TABLES.each do |table|
|
28
|
+
remove_column table, :order
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class RemoveCoversWholeOfUkFromAdvisers < ActiveRecord::Migration
|
2
|
+
WHOLE_OF_UK_MILES = 650
|
3
|
+
|
4
|
+
def up
|
5
|
+
Adviser.where(covers_whole_of_uk: true).find_each do |adviser|
|
6
|
+
adviser.postcode = adviser.firm.address_postcode
|
7
|
+
adviser.travel_distance = WHOLE_OF_UK_MILES
|
8
|
+
adviser.save!
|
9
|
+
end
|
10
|
+
|
11
|
+
remove_column :advisers, :covers_whole_of_uk
|
12
|
+
end
|
13
|
+
|
14
|
+
def down
|
15
|
+
raise ActiveRecord::IrreversibleMigration
|
16
|
+
end
|
17
|
+
end
|