File tree Expand file tree Collapse file tree 3 files changed +5
-7
lines changed
Expand file tree Collapse file tree 3 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -5,11 +5,9 @@ def index
55 @conference = current_sponsorship . conference
66
77 @broadcast_deliveries = BroadcastDelivery
8- . where ( sponsorship : current_sponsorship )
9- . joins ( :broadcast )
10- . merge ( Broadcast . where ( status : :sent ) )
118 . includes ( :broadcast )
12- . order ( 'broadcasts.dispatched_at DESC' )
9+ . where ( sponsorship : current_sponsorship , broadcast : { status : :sent } )
10+ . order ( broadcast : { id : :desc } )
1311 end
1412
1513 private
Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ class Broadcast < ApplicationRecord
1313 validates :title , presence : true
1414 validates :body , presence : true
1515
16- def perform_later!
17- self . update! ( status : :pending )
16+ def perform_later! ( now : Time . current )
17+ self . update! ( status : :pending , dispatched_at : now )
1818 self . deliveries . each do |delivery |
1919 delivery . update! ( status : :pending )
2020 DispatchBroadcastDeliveryJob . perform_later ( delivery )
Original file line number Diff line number Diff line change 2121 .card.text-dark.mb-3 {id: "broadcast-#{delivery.broadcast.id}"}
2222 .card-header
2323 %strong= delivery.broadcast.title
24- %small.text-muted.ml-2= l(delivery.broadcast.dispatched_at, format: :short)
24+ %small.text-muted.ml-2= l(delivery.broadcast.dispatched_at || delivery.broadcast.created_at , format: :short)
2525 .card-body
2626 = replace_template_variables(delivery.broadcast.html)
You can’t perform that action at this time.
0 commit comments