Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offair talks having same track id and different conference_day_id #2002

Merged
merged 3 commits into from
Aug 12, 2023
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
2 changes: 1 addition & 1 deletion app/models/talk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ def start_streaming
ActiveRecord::Base.transaction do
other_talks_in_track = conference.tracks.find_by(name: track.name).talks
.accepted_and_intermission
.select { |t| t.conference_day.id == conference_day.id && t.id != id }
.reject { |t| t.id == id }
other_talks_in_track.each do |other_talk|
other_talk.video.update!(on_air: false)
end
Expand Down
8 changes: 7 additions & 1 deletion spec/models/talk_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@
before do
create(:cndt2020)
end
let!(:talk1) { create(:talk1, :accepted) }
let!(:talk1) { create(:talk1, :accepted, track_id: 1) }
let!(:talk2) { create(:talk2, :accepted, :conference_day_id_1) }
let!(:talk3) { create(:talk3, :accepted, track_id: 1) }
let!(:video1) { create(:video, :off_air) }
let!(:video2) { create(:video, :on_air, :talk2) }
let!(:video3) { create(:video, :on_air, :talk3) }
context 'start streaming talk1' do
before do
talk1.start_streaming
Expand All @@ -55,6 +57,10 @@
expect(talk1.video.on_air).to(eq(true))
end

it "shouldn't be on_air whatever talks has different conference_day_id" do
expect(talk3.video.on_air).to(eq(false))
end

example 'talk in the same track and same conference_day should be off_air' do
expect(talk2.video.on_air).to(eq(false))
end
Expand Down