[fix] Fix style; Fix start_hour and end_hour in test
This commit is contained in:
parent
1c54d38094
commit
3019a022c7
3 changed files with 3 additions and 2 deletions
|
|
@ -56,6 +56,7 @@ class EventSchedule < ApplicationRecord
|
||||||
#
|
#
|
||||||
def happening_now?(threshold = 30.minutes)
|
def happening_now?(threshold = 30.minutes)
|
||||||
return false if end_time < Time.now
|
return false if end_time < Time.now
|
||||||
|
|
||||||
event_time_range = start_time..end_time
|
event_time_range = start_time..end_time
|
||||||
now_range = (Time.now - threshold)..(Time.now + threshold)
|
now_range = (Time.now - threshold)..(Time.now + threshold)
|
||||||
event_time_range.overlaps?(now_range)
|
event_time_range.overlaps?(now_range)
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
%h3
|
%h3
|
||||||
This page was loaded at
|
This page was loaded at
|
||||||
= inyourtz(Time.now) do
|
= inyourtz(Time.now) do
|
||||||
#{Time.now.strftime('%a %b %d at %I:%M %P (%z)').to_s}
|
= Time.now.strftime('%a %b %d at %I:%M %P (%z)')
|
||||||
|
|
||||||
.row
|
.row
|
||||||
/ TODO: Clean this up, merge with all events page.
|
/ TODO: Clean this up, merge with all events page.
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ describe SchedulesController do
|
||||||
|
|
||||||
describe 'GET #happening_now' do
|
describe 'GET #happening_now' do
|
||||||
before do
|
before do
|
||||||
@conference2 = create(:full_conference, start_date: 1.day.ago, end_date: 7.days.from_now)
|
@conference2 = create(:full_conference, start_date: 1.day.ago, end_date: 7.days.from_now, start_hour: 0, end_hour: 24)
|
||||||
@program = @conference2.program
|
@program = @conference2.program
|
||||||
@selected_schedule = create(:schedule, program: @program)
|
@selected_schedule = create(:schedule, program: @program)
|
||||||
@program.update_attributes!(selected_schedule: @selected_schedule)
|
@program.update_attributes!(selected_schedule: @selected_schedule)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue