mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-02 20:15:22 +02:00
Realistic demo data for performance testing (#2361)
* Realistic demo data for performance testing * Add note about performance testing * Fix bugbot issues * More realistic account values
This commit is contained in:
parent
0d62e60da1
commit
5a4c955522
16 changed files with 2166 additions and 474 deletions
30
app/models/demo/base_scenario.rb
Normal file
30
app/models/demo/base_scenario.rb
Normal file
|
@ -0,0 +1,30 @@
|
|||
# Base class for demo scenario handlers - subclasses must implement generate_family_data!
|
||||
class Demo::BaseScenario
|
||||
def initialize(generators)
|
||||
@generators = generators
|
||||
end
|
||||
|
||||
def generate!(families, **options)
|
||||
setup(**options) if respond_to?(:setup, true)
|
||||
|
||||
families.each do |family|
|
||||
ActiveRecord::Base.transaction do
|
||||
generate_family_data!(family, **options)
|
||||
end
|
||||
puts "#{scenario_name} data created for #{family.name}"
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def setup(**options)
|
||||
end
|
||||
|
||||
def generate_family_data!(family, **options)
|
||||
raise NotImplementedError, "Subclasses must implement generate_family_data!(family, **options)"
|
||||
end
|
||||
|
||||
def scenario_name
|
||||
self.class.name.split("::").last.downcase.gsub(/([a-z])([A-Z])/, '\1 \2')
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue