Module: SearchByDates

Included in:
MembershipSaleSearch, PassSaleSearch, SaleSearch
Defined in:
app/concerns/search_by_dates.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#organizationObject (readonly)

Returns the value of attribute organization.



3
4
5
# File 'app/concerns/search_by_dates.rb', line 3

def organization
  @organization
end

#startObject (readonly)

Returns the value of attribute start.



2
3
4
# File 'app/concerns/search_by_dates.rb', line 2

def start
  @start
end

#stopObject (readonly)

Returns the value of attribute stop.



2
3
4
# File 'app/concerns/search_by_dates.rb', line 2

def stop
  @stop
end

Instance Method Details

#default_startObject



13
14
15
# File 'app/concerns/search_by_dates.rb', line 13

def default_start
  DateTime.now.in_time_zone(@organization.time_zone).beginning_of_month
end

#default_stopObject



17
18
19
# File 'app/concerns/search_by_dates.rb', line 17

def default_stop
  DateTime.now.in_time_zone(@organization.time_zone).end_of_day
end

#start_with(start) ⇒ Object



5
6
7
# File 'app/concerns/search_by_dates.rb', line 5

def start_with(start)
  start.present? ? DateTime.parse(start) : default_start
end

#stop_with(stop) ⇒ Object



9
10
11
# File 'app/concerns/search_by_dates.rb', line 9

def stop_with(stop)
  stop.present? ? Sundial.midnightish(@organization, stop) : default_stop
end