Skip to content

Commit 8c84bd5

Browse files
committed
More seed data so we are able to load multiple pages
1 parent 90fd9df commit 8c84bd5

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

db/seeds.rb

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,56 @@ def mark_aware_until(user:, topic:, message:, timestamp:)
800800
)
801801
end
802802

803+
# Extra topics to fill multiple pages with variety
804+
extra_topics = []
805+
(1..50).each do |i|
806+
creator = [alice_alias, bob_alias, carol_alias, dave_alias][i % 4]
807+
created_at = now - (15.days + i.hours)
808+
topic = Topic.create!(
809+
title: "Archive sampler #{i}",
810+
creator: creator,
811+
created_at: created_at,
812+
updated_at: created_at
813+
)
814+
815+
msgs = []
816+
msgs << create_message(
817+
topic: topic,
818+
sender: creator,
819+
subject: topic.title,
820+
body: "Sampler thread #{i} kickoff with creator #{creator.name}.",
821+
created_at: created_at,
822+
message_id_suffix: "sampler-#{i}-1"
823+
)
824+
msgs << create_message(
825+
topic: topic,
826+
sender: [alice_alias, bob_alias, carol_alias, dave_alias][(i + 1) % 4],
827+
subject: "Re: #{topic.title}",
828+
body: "Follow-up #{i}a to keep paging realistic.",
829+
created_at: created_at + 2.hours,
830+
reply_to: msgs.last,
831+
message_id_suffix: "sampler-#{i}-2"
832+
)
833+
msgs << create_message(
834+
topic: topic,
835+
sender: [alice_alias, bob_alias, carol_alias, dave_alias][(i + 2) % 4],
836+
subject: "Re: #{topic.title}",
837+
body: "Follow-up #{i}b with another participant.",
838+
created_at: created_at + 4.hours,
839+
reply_to: msgs.last,
840+
message_id_suffix: "sampler-#{i}-3"
841+
)
842+
843+
# Mix awareness/read states for coverage
844+
if i % 4 == 0
845+
mark_read_until(user: alice_user, topic: topic, message: msgs.last, timestamp: created_at + 5.hours)
846+
elsif i % 3 == 0
847+
mark_aware_until(user: bob_user, topic: topic, message: msgs.last, timestamp: created_at + 5.hours)
848+
end
849+
850+
extra_topics << { topic: topic, messages: msgs }
851+
end
852+
803853
# Threads to exercise all smart_time_display branches
804854
recent_topic = Topic.create!(
805855
title: "Recent activity thread",
@@ -907,6 +957,18 @@ def mark_aware_until(user:, topic:, message:, timestamp:)
907957
body: "Pooling experiments look good; consider adaptive target.\n@ExampleCompany let's benchmark with PG16"
908958
)
909959

960+
# Notes on extra sampler topics for visibility across pages
961+
extra_topics.each_with_index do |entry, idx|
962+
next unless (idx % 5).zero?
963+
builder = [alice_notes, bob_notes, carol_notes][idx % 3]
964+
message = entry[:messages][1] || entry[:messages].last
965+
builder.create!(
966+
topic: entry[:topic],
967+
message: message,
968+
body: "Sampler note ##{idx + 1} on #{entry[:topic].title}.\n@ExampleCompany follow-up #{idx + 1}"
969+
)
970+
end
971+
910972
timestamp_now = Time.current
911973

912974
# Fully read threads

0 commit comments

Comments
 (0)