Make unbreakable bonds belong to the same affinity group in seeds

This commit is contained in:
Manuel Bustillo 2024-07-11 23:39:40 +02:00
parent 16914c874b
commit 204771ef2b

View File

@ -60,13 +60,17 @@ end
guest.save!
end
Guest.affinity_group_counts.each do |group|
couples = (group.taggings_count / 4).floor
Guest.all.sample(100).each_slice(2) do |a, b|
bond_name = "#{a.full_name} & #{b.full_name}"
guests_involved = Guest.tagged_with(group.name).limit(couples * 2)
guests_involved.each_slice(2) do |a, b|
bond_name = "#{a.full_name} & #{b.full_name}"
a.unbreakable_bond_list.add(bond_name)
b.unbreakable_bond_list.add(bond_name)
a.unbreakable_bond_list.add(bond_name)
b.unbreakable_bond_list.add(bond_name)
a.save!
b.save!
end
a.save!
b.save!
end
end