Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions db/seeds/dev/monthly_reports.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,17 @@
}

if aisha_user
# 30 monthly reports for Aisha (30 months of history)
30.times do |i|
# A handful of monthly reports for Aisha (recent months of history)
8.times do |i|
create_monthly_report.call(
organization: aisha_org,
created_by: aisha_user,
date: (Date.today - i.months).beginning_of_month
)
end

# Additional batches under varying older dates to mimic prod's long tail
report_counts = [ 15, 12, 9, 7, 5, 4, 3, 2, 1, 1 ]
# A few older batches to mimic prod's long tail
report_counts = [ 4, 3, 2, 1 ]
report_counts.each_with_index do |count, batch|
count.times do |i|
create_monthly_report.call(
Expand All @@ -144,7 +144,7 @@
# A few monthly reports for the admin user as well
admin_user = User.first
if admin_user && admin_user != aisha_user
5.times do
3.times do
create_monthly_report.call(
organization: Organization.all.sample || aisha_org,
created_by: admin_user,
Expand Down
14 changes: 7 additions & 7 deletions db/seeds/dev/workshop_logs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
all_workshops = Workshop.all.to_a.shuffle

if aisha_user && all_workshops.any? && WorkshopLog.where(created_by_id: aisha_user.id).none?
# 30 logs for Aisha's primary workshop
# A handful of logs for Aisha's primary workshop
primary_workshop = all_workshops.shift
30.times do |i|
8.times do |i|
WorkshopLog.create!(
workshop_id: primary_workshop.id,
organization_id: aisha_org.id,
Expand All @@ -28,9 +28,9 @@
)
end

# Up to 10 other workshops with varying log counts (1–15)
other_workshops = all_workshops.first(10)
log_counts = [ 15, 12, 9, 7, 5, 4, 3, 2, 1, 1 ]
# A few other workshops with varying log counts
other_workshops = all_workshops.first(4)
log_counts = [ 4, 3, 2, 1 ]
other_workshops.each_with_index do |workshop, idx|
count = log_counts[idx] || 1
count.times do |i|
Expand All @@ -51,12 +51,12 @@
)
end
end
puts " Created 89 logs for Aisha on 11 workshops"
puts " Created #{WorkshopLog.where(created_by_id: aisha_user.id).count} logs for Aisha on #{other_workshops.count + 1} workshops"
end

# A few logs for the admin user as well
if WorkshopLog.where(created_by_id: User.first&.id).none?
5.times do
3.times do
workshop = Workshop.all.sample
next unless workshop

Expand Down