Skip to content

Commit cf39993

Browse files
committed
Exclude boosters unless cycle only has boosters.
1 parent 3cbd77e commit cf39993

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/tasks/cards.rake

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,13 @@ namespace :cards do
381381

382382
def update_date_release_for_cycles
383383
CardCycle.all.find_each do |c|
384-
c.date_release = c.card_sets.minimum(:date_release)
384+
num_non_booster_sets = c.card_sets.where.not(card_set_type_id: 'booster_pack').count
385+
386+
c.date_release = if num_non_booster_sets.positive?
387+
c.card_sets.where.not(card_set_type_id: 'booster_pack').minimum(:date_release)
388+
else
389+
c.card_sets.minimum(:date_release)
390+
end
385391
c.save
386392
end
387393
end

0 commit comments

Comments
 (0)