Class: Durt::NotifyTracker

Inherits:
TimeTracker show all
Defined in:
lib/durt/notify_tracker.rb

Class Method Summary collapse

Methods inherited from TimeTracker

active?, switch_project

Class Method Details

.enter(issue) ⇒ Object



7
# File 'lib/durt/notify_tracker.rb', line 7

def self.enter(issue); end

.notify!(message) ⇒ Object



21
22
23
# File 'lib/durt/notify_tracker.rb', line 21

def self.notify!(message)
  system("notify-send '#{message}'")
end

.start(issue) ⇒ Object



9
10
11
# File 'lib/durt/notify_tracker.rb', line 9

def self.start(issue)
  notify!("Started tracking: #{issue.label}")
end

.stop(issue) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/durt/notify_tracker.rb', line 13

def self.stop(issue)
  tracked_time = issue.sessions.last.tracked_time
  total = issue.total_tracked_time

  notify!("Minutes tracked: #{(tracked_time / 60).ceil}")
  notify!("Minutes tracked overall: #{(total / 60).ceil}")
end