Class: Paradeiser::ParadeiserController
- Inherits:
-
Controller
- Object
- Controller
- Paradeiser::ParadeiserController
show all
- Defined in:
- lib/paradeiser/controllers/paradeiser_controller.rb
Instance Attribute Summary
Attributes inherited from Controller
#exitstatus, #has_output
Instance Method Summary
collapse
Methods inherited from Controller
#call, #get_binding, #initialize, #model, #render
Instance Method Details
#export ⇒ Object
37
38
39
40
|
# File 'lib/paradeiser/controllers/paradeiser_controller.rb', line 37
def export
self.has_output = true
render(:text => Repository.all.to_json)
end
|
#report ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/paradeiser/controllers/paradeiser_controller.rb', line 13
def report
pomodori = Repository.all_pomodori
@finished = pomodori.select{|p| p.finished?}.size
@canceled = pomodori.select{|p| p.canceled?}.size
@external_interrupts = pomodori.map{|p| p.interrupts}.flatten.select{|i| :external == i.type}.size
@internal_interrupts = pomodori.map{|p| p.interrupts}.flatten.select{|i| :internal == i.type}.size
breaks = Repository.all_breaks
@breaks = breaks.size
@break_minutes = breaks.sum{|b| b.duration}.to_i.minutes
@annotations = pomodori.collect{|p| p.annotations}.flatten
self.has_output = true
end
|
#status ⇒ Object
30
31
32
33
34
35
|
# File 'lib/paradeiser/controllers/paradeiser_controller.rb', line 30
def status
@pom = Repository.active || Repository.all.last
self.exitstatus = Status.of(@pom).to_i
self.has_output = true
render(:text => 'There are no pomodori or breaks.') unless @pom
end
|