app/models/stream.rb
# If no datetime is provided then assume we want the previous DefaultStreamHistory
# object for the most recent period when self.stream was the default.
#
# If a datetime is provided then return the previous DefaultStreamHistory object
# for when self.stream was the default for the supplied datetime.
#
# If self.stream was not the default for the datetime supplied return nil
If no datetime is provided then assume we want the previous DefaultStreamHistory
object for the most recent period when self.stream was the default.

If a datetime is provided then return the previous DefaultStreamHistory object
for when self.stream was the default for the supplied datetime.

If self.stream was not the default for the datetime supplied return nil
If no datetime is provided then assume we want the previous DefaultStreamHistory object for the most recent period when self . stream was the default . If a datetime is provided then return the previous DefaultStreamHistory object for when self . stream was the default for the supplied datetime . If self . stream was not the default for the datetime supplied return nil
def previous_default_stream_history(datetime = nil)
    default_stream_history = if datetime
                               select_default_stream_history_by_date(datetime)
                             else
                               default_stream_histories.order(start_time: :desc).first
                             end
    return if default_stream_history.blank?
    organization.default_stream_histories
                .order(end_time: :desc)
                .where('end_time < ?', default_stream_history.start_time)
                .first
  end
def previous_default_stream_history ( datetime = nil ) default_stream_history = if datetime select_default_stream_history_by_date ( datetime ) else default_stream_histories . order ( start_time : :desc ) . first end return if default_stream_history . blank? organization . default_stream_histories . order ( end_time : :desc ) . where ( 'end_time < ?' , default_stream_history . start_time ) . first end
If no datetime is provided then assume we want the previous DefaultStreamHistory
object for the most recent period when self.stream was the default.
If no datetime is provided then assume we want the previous DefaultStreamHistory object for the most recent period when self . stream was the default .
datetime
<not_specific>