Sha256: 697aac8534d945a3f24ff690ea20174c872afc9fa8261d1ff41a48daa59f64e5

Contents?: true

Size: 389 Bytes

Versions: 2

Compression:

Stored size: 389 Bytes

Contents

class Pratt
  module TimeSpent
    def conditions_for_time_spent scale = nil, when_to = DateTime.now
      when_to = Chronic.parse(when_to) if when_to.is_a?(String)
      cond = ["end_at IS NOT NULL"]
      cond = [(cond << "start_at BETWEEN ? AND ?").join(' AND ')] | [when_to.send("beginning_of_#{scale}"), when_to.send("end_of_#{scale}")] unless scale.nil?
      cond
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
Pratt-1.6.5 models/pratt.rb
Pratt-1.6.4 models/pratt.rb