kpi_manager 0.1.0.pre

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 (56) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +12 -0
  4. data/Rakefile +30 -0
  5. data/app/assets/javascripts/kpi_manager/application.js +13 -0
  6. data/app/assets/stylesheets/kpi_manager/application.css +15 -0
  7. data/app/controllers/kpi_manager/application_controller.rb +5 -0
  8. data/app/helpers/kpi_manager/application_helper.rb +4 -0
  9. data/app/views/layouts/kpi_manager/application.html.erb +14 -0
  10. data/config/routes.rb +2 -0
  11. data/lib/kpi_manager/dashboard.rb +4 -0
  12. data/lib/kpi_manager/dataset.rb +13 -0
  13. data/lib/kpi_manager/engine.rb +5 -0
  14. data/lib/kpi_manager/generators/kpi_manager_generator.rb +15 -0
  15. data/lib/kpi_manager/generators/templates/dashboard_migration.rb +10 -0
  16. data/lib/kpi_manager/generators/templates/kpi_migration.rb +8 -0
  17. data/lib/kpi_manager/generators/templates/report_migration.rb +11 -0
  18. data/lib/kpi_manager/kpi.rb +21 -0
  19. data/lib/kpi_manager/report.rb +58 -0
  20. data/lib/kpi_manager/version.rb +3 -0
  21. data/lib/kpi_manager.rb +11 -0
  22. data/lib/tasks/kpi_manager_tasks.rake +4 -0
  23. data/spec/rails_helper.rb +15 -0
  24. data/spec/spec_helper.rb +23 -0
  25. data/spec/test_app/app/controllers/application_controller.rb +5 -0
  26. data/spec/test_app/app/helpers/application_helper.rb +2 -0
  27. data/spec/test_app/app/models/car.rb +4 -0
  28. data/spec/test_app/app/models/order.rb +5 -0
  29. data/spec/test_app/app/models/promotion.rb +5 -0
  30. data/spec/test_app/app/models/user.rb +15 -0
  31. data/spec/test_app/config/application.rb +31 -0
  32. data/spec/test_app/config/boot.rb +5 -0
  33. data/spec/test_app/config/environment.rb +5 -0
  34. data/spec/test_app/config/environments/development.rb +41 -0
  35. data/spec/test_app/config/environments/production.rb +79 -0
  36. data/spec/test_app/config/environments/test.rb +42 -0
  37. data/spec/test_app/config/initializers/assets.rb +11 -0
  38. data/spec/test_app/config/initializers/backtrace_silencers.rb +7 -0
  39. data/spec/test_app/config/initializers/cookies_serializer.rb +3 -0
  40. data/spec/test_app/config/initializers/filter_parameter_logging.rb +4 -0
  41. data/spec/test_app/config/initializers/inflections.rb +16 -0
  42. data/spec/test_app/config/initializers/kpi_manager.rb +21 -0
  43. data/spec/test_app/config/initializers/mime_types.rb +4 -0
  44. data/spec/test_app/config/initializers/session_store.rb +3 -0
  45. data/spec/test_app/config/initializers/wrap_parameters.rb +14 -0
  46. data/spec/test_app/config/routes.rb +3 -0
  47. data/spec/test_app/db/migrate/20170116133339_create_users.rb +13 -0
  48. data/spec/test_app/db/migrate/20170116133440_create_cars.rb +11 -0
  49. data/spec/test_app/db/migrate/20170116133459_create_promotion.rb +7 -0
  50. data/spec/test_app/db/migrate/20170116133513_create_orders.rb +12 -0
  51. data/spec/test_app/db/migrate/20170116205700_create_kpi_manager_dashboard.rb +10 -0
  52. data/spec/test_app/db/migrate/20170116205701_create_kpi_manager_report.rb +11 -0
  53. data/spec/test_app/db/migrate/20170116205702_create_kpi_manager_kpi.rb +8 -0
  54. data/spec/test_app/db/schema.rb +63 -0
  55. data/spec/test_app/spec/kpi_manager_spec.rb +37 -0
  56. metadata +257 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 985c3aca449032e19dd3a05f7e2d487294c5672d
4
+ data.tar.gz: 6bf47a080c73fcace81ae070bbb45c418e48d5b2
5
+ SHA512:
6
+ metadata.gz: 88c32c4ebc9a5879f4f3c2760b750aa2575a3c4ca27699234ac3ae37b9f33351596996549ce10bc938880abb93f031d0e619b6cf4b3463d2b12e5c132ceb7d48
7
+ data.tar.gz: e506c3ae26086b59c5a14a95e7b5f1efcb650ad04c124990812d8940c257070f63ae97f747375be92e963d6de224384dde6a7ad3ba638853f012627be8fa8506
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2017 Hugo Chevalier
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,12 @@
1
+ = KpiManager
2
+
3
+ As a developer:
4
+ Define KPIs in an initializer
5
+
6
+ As a back-office administrator:
7
+ - Create a report from back-office
8
+ - Attach any KPI that has been created by your developers
9
+ - KPIs removed by developers will be ignored without crashing the whole report
10
+ - Select your start and end dates to generate the report
11
+
12
+ rails g kpi_manager:migrations
data/Rakefile ADDED
@@ -0,0 +1,30 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'KpiManager'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path('../spec/test_app/Rakefile', __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+ load 'rails/tasks/statistics.rake'
21
+
22
+ Bundler::GemHelper.install_tasks
23
+
24
+ require 'rake'
25
+ require 'rspec/core/rake_task'
26
+
27
+ RSpec::Core::RakeTask.new(:spec) do |t|
28
+ t.pattern = Dir.glob('../spec/**/*_spec.rb')
29
+ end
30
+ task default: :spec
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,5 @@
1
+ module KpiManager
2
+ class ApplicationController < ActionController::Base # :nodoc:
3
+ protect_from_forgery with: :exception
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ module KpiManager
2
+ module ApplicationHelper # :nodoc:
3
+ end
4
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>KpiManager</title>
5
+ <%= stylesheet_link_tag "kpi_manager/application", media: "all" %>
6
+ <%= javascript_include_tag "kpi_manager/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ KpiManager::Engine.routes.draw do
2
+ end
@@ -0,0 +1,4 @@
1
+ module KpiManager
2
+ class Dashboard < ActiveRecord::Base
3
+ end
4
+ end
@@ -0,0 +1,13 @@
1
+ module KpiManager
2
+ # Allow scope-like behavior, KPIs use datasets to compute data from
3
+ class Dataset
4
+ def self.add(name, &block)
5
+ b = block
6
+ KpiManager::Report.class_eval do
7
+ define_method(name) do |from, to|
8
+ b.call(from, to)
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ module KpiManager
2
+ class Engine < ::Rails::Engine # :nodoc:
3
+ isolate_namespace KpiManager
4
+ end
5
+ end
@@ -0,0 +1,15 @@
1
+ module KpiManager
2
+ class MigrationsGenerator < Rails::Generators::Base # :nodoc:
3
+ source_root File.expand_path('../templates', __FILE__)
4
+
5
+ def copy_files
6
+ time = Time.zone.now.strftime('%Y%m%d%H%M')
7
+ dashboard_mig = "db/migrate/#{time}00_create_kpi_manager_dashboard.rb"
8
+ template 'dashboard_migration.rb', dashboard_mig
9
+ report_mig = "db/migrate/#{time}01_create_kpi_manager_report.rb"
10
+ template 'report_migration.rb', report_mig
11
+ kpi_mig = "db/migrate/#{time}02_create_kpi_manager_kpi.rb"
12
+ template 'kpi_migration.rb', kpi_mig
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,10 @@
1
+ class CreateKpiManagerDashboard < ActiveRecord::Migration # :nodoc:
2
+ def change
3
+ create_table :kpi_manager_dashboards do |t|
4
+ t.string :name
5
+ t.string :slug
6
+
7
+ t.timestamps null: false
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,8 @@
1
+ class CreateKpiManagerKpi < ActiveRecord::Migration # :nodoc:
2
+ def change
3
+ create_table :kpi_manager_kpis do |t|
4
+ t.string :slug
5
+ t.references :report
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,11 @@
1
+ class CreateKpiManagerReport < ActiveRecord::Migration # :nodoc:
2
+ def change
3
+ create_table :kpi_manager_reports do |t|
4
+ t.string :name
5
+ # TODO: handle recurrency
6
+ # TODO: handle multiple recipients
7
+
8
+ t.timestamps null: false
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,21 @@
1
+ module KpiManager
2
+ # Represent a KPI bound to a specific report
3
+ class Kpi < ActiveRecord::Base
4
+ belongs_to :report, class_name: 'KpiManager::Report'
5
+
6
+ @@kpis = {}
7
+
8
+ def self.add(name, label, options = nil, &block)
9
+ options ||= {}
10
+ dataset = options[:dataset]
11
+ b = block
12
+ raise 'No dataset to work against' unless dataset
13
+ KpiManager::Report.class_eval do
14
+ define_method(name) do |dataset_p, **refs|
15
+ b.call(dataset_p, refs)
16
+ end
17
+ end
18
+ @@kpis[name] = { dataset: dataset, label: label, options: options }
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,58 @@
1
+ module KpiManager
2
+ # Allow to manipulate recurrent reports
3
+ class Report < ActiveRecord::Base
4
+ has_many :kpis, class_name: 'KpiManager::Kpi'
5
+
6
+ after_initialize :initialize_instance_vars
7
+
8
+ def generate(from, to = nil)
9
+ @from = from
10
+ @to = to || Time.zone.now
11
+ @report = []
12
+
13
+ registered_kpis.each do |kpi_name, kpi_data|
14
+ @report << [
15
+ kpi_data[:label],
16
+ send(
17
+ kpi_name,
18
+ get_dataset(kpi_data[:dataset]),
19
+ references(kpi_data[:options])
20
+ )
21
+ ]
22
+ end
23
+
24
+ @report
25
+ end
26
+
27
+ private
28
+
29
+ def initialize_instance_vars(_attributes = {}, options = {})
30
+ @options = options
31
+ @datacache = {}
32
+ end
33
+
34
+ def references(kpi_options)
35
+ refs = {}
36
+ kpi_options[:references] ||= []
37
+ kpi_options[:references].each do |kpi_name|
38
+ kpi = registered_kpis[kpi_name]
39
+ refs[kpi_name] = send(
40
+ kpi_name,
41
+ get_dataset(kpi[:dataset]),
42
+ references(kpi[:options])
43
+ )
44
+ end
45
+ refs
46
+ end
47
+
48
+ def get_dataset(name)
49
+ @datacache[name] ||= send(name, @from, @to)
50
+ end
51
+
52
+ def registered_kpis
53
+ all_kpis = KpiManager::Kpi.class_variable_get(:@@kpis)
54
+ authorized = kpis.pluck(:slug).map(&:to_sym)
55
+ all_kpis.select { |kpi_name, _kpi_data| authorized.include?(kpi_name) }
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,3 @@
1
+ module KpiManager
2
+ VERSION = '0.1.0.pre'.freeze
3
+ end
@@ -0,0 +1,11 @@
1
+ require 'kpi_manager/engine'
2
+
3
+ module KpiManager # :nodoc:
4
+ end
5
+
6
+ require 'kpi_manager/dataset'
7
+ require 'kpi_manager/kpi'
8
+ require 'kpi_manager/report'
9
+
10
+ require 'rails/generators'
11
+ require 'kpi_manager/generators/kpi_manager_generator'
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :kpi_manager do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,15 @@
1
+ ENV['RAILS_ENV'] ||= 'test'
2
+ require File.expand_path('../test_app/config/environment', __FILE__)
3
+
4
+ abort('Running in production mode!') if Rails.env.production?
5
+ require 'spec_helper'
6
+ require 'rspec/rails'
7
+
8
+ ActiveRecord::Migration.maintain_test_schema!
9
+
10
+ RSpec.configure do |config|
11
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
12
+ config.use_transactional_fixtures = true
13
+ config.infer_spec_type_from_file_location!
14
+ config.filter_rails_from_backtrace!
15
+ end
@@ -0,0 +1,23 @@
1
+ RSpec.configure do |config|
2
+ require 'simplecov'
3
+ SimpleCov.start do
4
+ add_filter '/spec/'
5
+ end
6
+
7
+ config.expect_with :rspec do |expectations|
8
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
9
+ end
10
+
11
+ config.mock_with :rspec do |mocks|
12
+ mocks.verify_partial_doubles = true
13
+ end
14
+
15
+ config.shared_context_metadata_behavior = :apply_to_host_groups
16
+
17
+ config.filter_run_when_matching :focus
18
+ config.disable_monkey_patching!
19
+
20
+ config.default_formatter = 'doc' if config.files_to_run.one?
21
+
22
+ config.order = :random
23
+ end
@@ -0,0 +1,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,4 @@
1
+ class Car < ActiveRecord::Base
2
+ has_many :orders
3
+ has_many :users, through: :orders
4
+ end
@@ -0,0 +1,5 @@
1
+ class Order < ActiveRecord::Base
2
+ belongs_to :car
3
+ belongs_to :user
4
+ belongs_to :promotion
5
+ end
@@ -0,0 +1,5 @@
1
+ class Promotion < ActiveRecord::Base
2
+ def calculate_from(base_price)
3
+ base_price - (base_price / 100 * percentage)
4
+ end
5
+ end
@@ -0,0 +1,15 @@
1
+ class User < ActiveRecord::Base
2
+ has_many :orders
3
+ has_many :cars, through: :orders
4
+
5
+ scope :active, -> { where(enabled: true) }
6
+
7
+ def buy_car(car, promotion = nil)
8
+ order = orders.new(
9
+ car: car,
10
+ promotion: promotion
11
+ )
12
+ order.paid_price = promotion ? promotion.calculate_from(car.price) : car.price
13
+ order.save
14
+ end
15
+ end
@@ -0,0 +1,31 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ # Pick the frameworks you want:
4
+ require 'active_record/railtie'
5
+ require 'action_controller/railtie'
6
+ require 'action_mailer/railtie'
7
+ require 'action_view/railtie'
8
+ require 'sprockets/railtie'
9
+ # require "rails/test_unit/railtie"
10
+
11
+ Bundler.require(*Rails.groups)
12
+ require 'kpi_manager'
13
+
14
+ module TestApp
15
+ class Application < Rails::Application
16
+ # Settings in config/environments/* take precedence over those specified here.
17
+ # Application configuration should go into files in config/initializers
18
+ # -- all .rb files in that directory are automatically loaded.
19
+
20
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
21
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
22
+ # config.time_zone = 'Central Time (US & Canada)'
23
+
24
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
25
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
26
+ # config.i18n.default_locale = :de
27
+
28
+ # Do not swallow errors in after_commit/after_rollback callbacks.
29
+ config.active_record.raise_in_transactional_callbacks = true
30
+ end
31
+ end
@@ -0,0 +1,5 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
+ $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!
@@ -0,0 +1,41 @@
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Do not eager load code on boot.
10
+ config.eager_load = false
11
+
12
+ # Show full error reports and disable caching.
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send.
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger.
20
+ config.active_support.deprecation = :log
21
+
22
+ # Raise an error on page load if there are pending migrations.
23
+ config.active_record.migration_error = :page_load
24
+
25
+ # Debug mode disables concatenation and preprocessing of assets.
26
+ # This option may cause significant delays in view rendering with a large
27
+ # number of complex assets.
28
+ config.assets.debug = true
29
+
30
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
31
+ # yet still be able to expire them through the digest params.
32
+ config.assets.digest = true
33
+
34
+ # Adds additional error checking when serving assets at runtime.
35
+ # Checks for improperly declared sprockets dependencies.
36
+ # Raises helpful error messages.
37
+ config.assets.raise_runtime_errors = true
38
+
39
+ # Raises error for missing translations
40
+ # config.action_view.raise_on_missing_translations = true
41
+ end
@@ -0,0 +1,79 @@
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # Code is not reloaded between requests.
5
+ config.cache_classes = true
6
+
7
+ # Eager load code on boot. This eager loads most of Rails and
8
+ # your application in memory, allowing both threaded web servers
9
+ # and those relying on copy on write to perform better.
10
+ # Rake tasks automatically ignore this option for performance.
11
+ config.eager_load = true
12
+
13
+ # Full error reports are disabled and caching is turned on.
14
+ config.consider_all_requests_local = false
15
+ config.action_controller.perform_caching = true
16
+
17
+ # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
+ # Add `rack-cache` to your Gemfile before enabling this.
19
+ # For large-scale production use, consider using a caching reverse proxy like
20
+ # NGINX, varnish or squid.
21
+ # config.action_dispatch.rack_cache = true
22
+
23
+ # Disable serving static files from the `/public` folder by default since
24
+ # Apache or NGINX already handles this.
25
+ config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
26
+
27
+ # Compress JavaScripts and CSS.
28
+ config.assets.js_compressor = :uglifier
29
+ # config.assets.css_compressor = :sass
30
+
31
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
32
+ config.assets.compile = false
33
+
34
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
35
+ # yet still be able to expire them through the digest params.
36
+ config.assets.digest = true
37
+
38
+ # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
39
+
40
+ # Specifies the header that your server uses for sending files.
41
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
42
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
43
+
44
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
45
+ # config.force_ssl = true
46
+
47
+ # Use the lowest log level to ensure availability of diagnostic information
48
+ # when problems arise.
49
+ config.log_level = :debug
50
+
51
+ # Prepend all log lines with the following tags.
52
+ # config.log_tags = [ :subdomain, :uuid ]
53
+
54
+ # Use a different logger for distributed setups.
55
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
56
+
57
+ # Use a different cache store in production.
58
+ # config.cache_store = :mem_cache_store
59
+
60
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
61
+ # config.action_controller.asset_host = 'http://assets.example.com'
62
+
63
+ # Ignore bad email addresses and do not raise email delivery errors.
64
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
65
+ # config.action_mailer.raise_delivery_errors = false
66
+
67
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
68
+ # the I18n.default_locale when a translation cannot be found).
69
+ config.i18n.fallbacks = true
70
+
71
+ # Send deprecation notices to registered listeners.
72
+ config.active_support.deprecation = :notify
73
+
74
+ # Use default logging formatter so that PID and timestamp are not suppressed.
75
+ config.log_formatter = ::Logger::Formatter.new
76
+
77
+ # Do not dump schema after migrations.
78
+ config.active_record.dump_schema_after_migration = false
79
+ end
@@ -0,0 +1,42 @@
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Do not eager load code on boot. This avoids loading your whole application
11
+ # just for the purpose of running a single test. If you are using a tool that
12
+ # preloads Rails for running tests, you may have to set it to true.
13
+ config.eager_load = false
14
+
15
+ # Configure static file server for tests with Cache-Control for performance.
16
+ config.serve_static_files = true
17
+ config.static_cache_control = 'public, max-age=3600'
18
+
19
+ # Show full error reports and disable caching.
20
+ config.consider_all_requests_local = true
21
+ config.action_controller.perform_caching = false
22
+
23
+ # Raise exceptions instead of rendering exception templates.
24
+ config.action_dispatch.show_exceptions = false
25
+
26
+ # Disable request forgery protection in test environment.
27
+ config.action_controller.allow_forgery_protection = false
28
+
29
+ # Tell Action Mailer not to deliver emails to the real world.
30
+ # The :test delivery method accumulates sent emails in the
31
+ # ActionMailer::Base.deliveries array.
32
+ config.action_mailer.delivery_method = :test
33
+
34
+ # Randomize the order test cases are executed.
35
+ config.active_support.test_order = :random
36
+
37
+ # Print deprecation notices to the stderr.
38
+ config.active_support.deprecation = :stderr
39
+
40
+ # Raises error for missing translations
41
+ # config.action_view.raise_on_missing_translations = true
42
+ end
@@ -0,0 +1,11 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Version of your assets, change this if you want to expire all your assets.
4
+ Rails.application.config.assets.version = '1.0'
5
+
6
+ # Add additional assets to the asset load path
7
+ # Rails.application.config.assets.paths << Emoji.images_path
8
+
9
+ # Precompile additional assets.
10
+ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
11
+ # Rails.application.config.assets.precompile += %w( search.js )
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Configure sensitive parameters which will be filtered from the log file.
4
+ Rails.application.config.filter_parameters += [:password]
@@ -0,0 +1,16 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format. Inflections
4
+ # are locale specific, and you may define rules for as many different
5
+ # locales as you wish. All of these examples are active by default:
6
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
+ # inflect.plural /^(ox)$/i, '\1en'
8
+ # inflect.singular /^(ox)en/i, '\1'
9
+ # inflect.irregular 'person', 'people'
10
+ # inflect.uncountable %w( fish sheep )
11
+ # end
12
+
13
+ # These inflection rules are supported but not enabled by default:
14
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
+ # inflect.acronym 'RESTful'
16
+ # end
@@ -0,0 +1,21 @@
1
+ # Datasets
2
+ KpiManager::Dataset.add(:subscribers) do |from, to|
3
+ User.where(created_at: (from..to))
4
+ end
5
+
6
+ KpiManager::Dataset.add(:bills) do |from, to|
7
+ Order.where(created_at: (from..to))
8
+ end
9
+
10
+ # KPIs
11
+ KpiManager::Kpi.add(:users_count, 'Subscribed users', dataset: :subscribers) do |dataset|
12
+ dataset.count
13
+ end
14
+
15
+ KpiManager::Kpi.add(:total_earned, 'Total earned', dataset: :bills) do |dataset|
16
+ dataset.to_a.inject(0) { |acc, elem| acc + elem.paid_price }
17
+ end
18
+
19
+ KpiManager::Kpi.add(:average_order, 'Average order', dataset: :bills, references: [:total_earned]) do |dataset, **refs|
20
+ dataset.count.zero? ? 0 : refs[:total_earned] / dataset.count
21
+ end
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Rails.application.config.session_store :cookie_store, key: '_test_app_session'
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9
+ end
10
+
11
+ # To enable root element in JSON for ActiveRecord objects.
12
+ # ActiveSupport.on_load(:active_record) do
13
+ # self.include_root_in_json = true
14
+ # end
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ mount KpiManager::Engine => '/kpi_manager'
3
+ end
@@ -0,0 +1,13 @@
1
+ class CreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table :users do |t|
4
+ t.string :firstname
5
+ t.string :lastname
6
+ t.string :email
7
+ t.date :birthdate
8
+ t.boolean :enabled, default: :true
9
+
10
+ t.timestamps null: false
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,11 @@
1
+ class CreateCars < ActiveRecord::Migration
2
+ def change
3
+ create_table :cars do |t|
4
+ t.string :brand
5
+ t.string :model
6
+ t.float :price
7
+
8
+ t.timestamps null: false
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ class CreatePromotion < ActiveRecord::Migration
2
+ def change
3
+ create_table :promotions do |t|
4
+ t.integer :percentage
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,12 @@
1
+ class CreateOrders < ActiveRecord::Migration
2
+ def change
3
+ create_table :orders do |t|
4
+ t.references :car
5
+ t.references :user
6
+ t.references :promotion
7
+ t.float :paid_price
8
+
9
+ t.timestamps null: false
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,10 @@
1
+ class CreateKpiManagerDashboard < ActiveRecord::Migration # :nodoc:
2
+ def change
3
+ create_table :kpi_manager_dashboards do |t|
4
+ t.string :name
5
+ t.string :slug
6
+
7
+ t.timestamps null: false
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ class CreateKpiManagerReport < ActiveRecord::Migration # :nodoc:
2
+ def change
3
+ create_table :kpi_manager_reports do |t|
4
+ t.string :name
5
+ # TODO: handle recurrency
6
+ # TODO: handle multiple recipients
7
+
8
+ t.timestamps null: false
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,8 @@
1
+ class CreateKpiManagerKpi < ActiveRecord::Migration # :nodoc:
2
+ def change
3
+ create_table :kpi_manager_kpis do |t|
4
+ t.string :slug
5
+ t.references :report
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,63 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended that you check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(version: 20_170_116_205_702) do
15
+ create_table 'cars', force: :cascade do |t|
16
+ t.string 'brand'
17
+ t.string 'model'
18
+ t.float 'price'
19
+ t.datetime 'created_at', null: false
20
+ t.datetime 'updated_at', null: false
21
+ end
22
+
23
+ create_table 'kpi_manager_dashboards', force: :cascade do |t|
24
+ t.string 'name'
25
+ t.string 'slug'
26
+ t.datetime 'created_at', null: false
27
+ t.datetime 'updated_at', null: false
28
+ end
29
+
30
+ create_table 'kpi_manager_kpis', force: :cascade do |t|
31
+ t.string 'slug'
32
+ t.integer 'report_id'
33
+ end
34
+
35
+ create_table 'kpi_manager_reports', force: :cascade do |t|
36
+ t.string 'name'
37
+ t.datetime 'created_at', null: false
38
+ t.datetime 'updated_at', null: false
39
+ end
40
+
41
+ create_table 'orders', force: :cascade do |t|
42
+ t.integer 'car_id'
43
+ t.integer 'user_id'
44
+ t.integer 'promotion_id'
45
+ t.float 'paid_price'
46
+ t.datetime 'created_at', null: false
47
+ t.datetime 'updated_at', null: false
48
+ end
49
+
50
+ create_table 'promotions', force: :cascade do |t|
51
+ t.integer 'percentage'
52
+ end
53
+
54
+ create_table 'users', force: :cascade do |t|
55
+ t.string 'firstname'
56
+ t.string 'lastname'
57
+ t.string 'email'
58
+ t.date 'birthdate'
59
+ t.boolean 'enabled', default: true
60
+ t.datetime 'created_at', null: false
61
+ t.datetime 'updated_at', null: false
62
+ end
63
+ end
@@ -0,0 +1,37 @@
1
+ require 'spec_helper'
2
+ require 'rails_helper'
3
+
4
+ RSpec.describe KpiManager::Report, :type => :model do
5
+ it 'generates a report' do
6
+ p206 = Car.create(brand: 'Peugot', model: '206', price: 9890.90)
7
+ zoe = Car.create(brand: 'Renault', model: 'Zoé', price: 12500)
8
+
9
+ hugo = User.create(
10
+ firstname: 'Hugo',
11
+ lastname: 'Chevalier',
12
+ email: 'email@gmail.com',
13
+ birthdate: Date.parse('1989-05-01')
14
+ )
15
+
16
+ drakhaine = User.create(
17
+ firstname: 'Drakhaine',
18
+ lastname: 'Arakhnide',
19
+ email: 'email@gmail.com',
20
+ birthdate: Date.parse('1989-04-24')
21
+ )
22
+
23
+ hugo.buy_car(p206)
24
+ drakhaine.buy_car(zoe, Promotion.create(percentage: 10))
25
+
26
+ report = KpiManager::Report.create(name: 'My first report')
27
+ report.kpis.create(slug: 'users_count')
28
+ report.kpis.create(slug: 'total_earned')
29
+ report.kpis.create(slug: 'average_order')
30
+ expectancy = [
31
+ ["Subscribed users", 2],
32
+ ["Total earned", 21140.9],
33
+ ["Average order", 10570.45]
34
+ ]
35
+ expect(report.generate(Date.yesterday)).to eql(expectancy)
36
+ end
37
+ end
metadata ADDED
@@ -0,0 +1,257 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kpi_manager
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0.pre
5
+ platform: ruby
6
+ authors:
7
+ - Hugo Chevalier
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-01-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 4.2.7
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 4.2.7
27
+ - !ruby/object:Gem::Dependency
28
+ name: sqlite3
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 12.0.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 12.0.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.5'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.5'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec-rails
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.5'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.5'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec-mocks
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.5'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.5'
97
+ - !ruby/object:Gem::Dependency
98
+ name: simplecov
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: codeclimate-test-reporter
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 1.0.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 1.0.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubocop
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 0.46.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 0.46.0
139
+ description: Description of KpiManager.
140
+ email:
141
+ - drakhaine@gmail.com
142
+ executables: []
143
+ extensions: []
144
+ extra_rdoc_files: []
145
+ files:
146
+ - MIT-LICENSE
147
+ - README.rdoc
148
+ - Rakefile
149
+ - app/assets/javascripts/kpi_manager/application.js
150
+ - app/assets/stylesheets/kpi_manager/application.css
151
+ - app/controllers/kpi_manager/application_controller.rb
152
+ - app/helpers/kpi_manager/application_helper.rb
153
+ - app/views/layouts/kpi_manager/application.html.erb
154
+ - config/routes.rb
155
+ - lib/kpi_manager.rb
156
+ - lib/kpi_manager/dashboard.rb
157
+ - lib/kpi_manager/dataset.rb
158
+ - lib/kpi_manager/engine.rb
159
+ - lib/kpi_manager/generators/kpi_manager_generator.rb
160
+ - lib/kpi_manager/generators/templates/dashboard_migration.rb
161
+ - lib/kpi_manager/generators/templates/kpi_migration.rb
162
+ - lib/kpi_manager/generators/templates/report_migration.rb
163
+ - lib/kpi_manager/kpi.rb
164
+ - lib/kpi_manager/report.rb
165
+ - lib/kpi_manager/version.rb
166
+ - lib/tasks/kpi_manager_tasks.rake
167
+ - spec/rails_helper.rb
168
+ - spec/spec_helper.rb
169
+ - spec/test_app/app/controllers/application_controller.rb
170
+ - spec/test_app/app/helpers/application_helper.rb
171
+ - spec/test_app/app/models/car.rb
172
+ - spec/test_app/app/models/order.rb
173
+ - spec/test_app/app/models/promotion.rb
174
+ - spec/test_app/app/models/user.rb
175
+ - spec/test_app/config/application.rb
176
+ - spec/test_app/config/boot.rb
177
+ - spec/test_app/config/environment.rb
178
+ - spec/test_app/config/environments/development.rb
179
+ - spec/test_app/config/environments/production.rb
180
+ - spec/test_app/config/environments/test.rb
181
+ - spec/test_app/config/initializers/assets.rb
182
+ - spec/test_app/config/initializers/backtrace_silencers.rb
183
+ - spec/test_app/config/initializers/cookies_serializer.rb
184
+ - spec/test_app/config/initializers/filter_parameter_logging.rb
185
+ - spec/test_app/config/initializers/inflections.rb
186
+ - spec/test_app/config/initializers/kpi_manager.rb
187
+ - spec/test_app/config/initializers/mime_types.rb
188
+ - spec/test_app/config/initializers/session_store.rb
189
+ - spec/test_app/config/initializers/wrap_parameters.rb
190
+ - spec/test_app/config/routes.rb
191
+ - spec/test_app/db/migrate/20170116133339_create_users.rb
192
+ - spec/test_app/db/migrate/20170116133440_create_cars.rb
193
+ - spec/test_app/db/migrate/20170116133459_create_promotion.rb
194
+ - spec/test_app/db/migrate/20170116133513_create_orders.rb
195
+ - spec/test_app/db/migrate/20170116205700_create_kpi_manager_dashboard.rb
196
+ - spec/test_app/db/migrate/20170116205701_create_kpi_manager_report.rb
197
+ - spec/test_app/db/migrate/20170116205702_create_kpi_manager_kpi.rb
198
+ - spec/test_app/db/schema.rb
199
+ - spec/test_app/spec/kpi_manager_spec.rb
200
+ homepage: https://rubygems.org/kpi_manager
201
+ licenses:
202
+ - MIT
203
+ metadata: {}
204
+ post_install_message:
205
+ rdoc_options: []
206
+ require_paths:
207
+ - lib
208
+ required_ruby_version: !ruby/object:Gem::Requirement
209
+ requirements:
210
+ - - ">="
211
+ - !ruby/object:Gem::Version
212
+ version: '0'
213
+ required_rubygems_version: !ruby/object:Gem::Requirement
214
+ requirements:
215
+ - - ">"
216
+ - !ruby/object:Gem::Version
217
+ version: 1.3.1
218
+ requirements: []
219
+ rubyforge_project:
220
+ rubygems_version: 2.4.8
221
+ signing_key:
222
+ specification_version: 4
223
+ summary: Summary of KpiManager.
224
+ test_files:
225
+ - spec/rails_helper.rb
226
+ - spec/spec_helper.rb
227
+ - spec/test_app/app/controllers/application_controller.rb
228
+ - spec/test_app/app/helpers/application_helper.rb
229
+ - spec/test_app/app/models/car.rb
230
+ - spec/test_app/app/models/order.rb
231
+ - spec/test_app/app/models/promotion.rb
232
+ - spec/test_app/app/models/user.rb
233
+ - spec/test_app/config/application.rb
234
+ - spec/test_app/config/boot.rb
235
+ - spec/test_app/config/environment.rb
236
+ - spec/test_app/config/environments/development.rb
237
+ - spec/test_app/config/environments/production.rb
238
+ - spec/test_app/config/environments/test.rb
239
+ - spec/test_app/config/initializers/assets.rb
240
+ - spec/test_app/config/initializers/backtrace_silencers.rb
241
+ - spec/test_app/config/initializers/cookies_serializer.rb
242
+ - spec/test_app/config/initializers/filter_parameter_logging.rb
243
+ - spec/test_app/config/initializers/inflections.rb
244
+ - spec/test_app/config/initializers/kpi_manager.rb
245
+ - spec/test_app/config/initializers/mime_types.rb
246
+ - spec/test_app/config/initializers/session_store.rb
247
+ - spec/test_app/config/initializers/wrap_parameters.rb
248
+ - spec/test_app/config/routes.rb
249
+ - spec/test_app/db/migrate/20170116133339_create_users.rb
250
+ - spec/test_app/db/migrate/20170116133440_create_cars.rb
251
+ - spec/test_app/db/migrate/20170116133459_create_promotion.rb
252
+ - spec/test_app/db/migrate/20170116133513_create_orders.rb
253
+ - spec/test_app/db/migrate/20170116205700_create_kpi_manager_dashboard.rb
254
+ - spec/test_app/db/migrate/20170116205701_create_kpi_manager_report.rb
255
+ - spec/test_app/db/migrate/20170116205702_create_kpi_manager_kpi.rb
256
+ - spec/test_app/db/schema.rb
257
+ - spec/test_app/spec/kpi_manager_spec.rb