app/models/service_learning/service_learning_position.rb
def time?(time, day, precise = false)
    if precise
      time = Time.parse(time.to_s) unless time.is_a?(Time)
      time = time.strftime("%H:%M:00")
      conditions = "start_time <= :time AND end_time >= :time AND #{day.to_s} IS true"
      !times.find(:first, :conditions => [conditions, { :time => time }]).nil?
    else
      timecode = "#{time}_#{day}"
      timecodes.include?(timecode)
    end
  end
# Returns true if this position is marked as valid for the specified time. Parameters:
# 
#  * time - The requested time, in string format
#  * day - The day of the week in question, in string or symbol format
#  * precise - If true, we check every ServiceLearningPositionTime precisely to the minute; otherwise, just check 
#             against #timecodes (which only counts half-hour blocks, but is _much_ faster). Defaults to false.
Returns true if this position is marked as valid for the specified time. Parameters:
time - The requested time, in string format
day - The day of the week in question, in string or symbol format
precise - If true, we check every ServiceLearningPositionTime precisely to the minute; otherwise, just check
against #timecodes (which only counts half-hour blocks, but is _much_ faster). Defaults to false.
Returns true if this position is marked as valid for the specified time . Parameters : time - The requested time in string format day - The day of the week in question in string or symbol format precise - If true we check every ServiceLearningPositionTime precisely to the minute ; otherwise just check against #timecodes ( which only counts half - hour blocks but is _much_ faster ) . Defaults to false .
def time?(time, day, precise = false)
    if precise
      time = Time.parse(time.to_s) unless time.is_a?(Time)
      time = time.strftime("%H:%M:00")
      conditions = "start_time <= :time AND end_time >= :time AND #{day.to_s} IS true"
      !times.find(:first, :conditions => [conditions, { :time => time }]).nil?
    else
      timecode = "#{time}_#{day}"
      timecodes.include?(timecode)
    end
  end
def time? ( time , day , precise = false ) if precise time = Time . parse ( time . to_s ) unless time . is_a? ( Time ) time = time . strftime ( "%H:%M:00" ) conditions = "start_time <= :time AND end_time >= :time AND #{day.to_s} IS true" ! times . find ( :first , :conditions => [ conditions , { :time => time } ] ) . nil? else timecode = "#{time}_#{day}" timecodes . include? ( timecode ) end end
Returns true if this position is marked as valid for the specified time.
Returns true if this position is marked as valid for the specified time .
time
day
precise