<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -47,13 +47,22 @@ class PomodoriController
   
   ##
   # Calculates the daily average pomodoros. The rounding
-  # is not really important here.
+  # is not really important here. I consider only days with more
+  # than 6 pomodoros. If less I don't consider them a real
+  # day of work but more a few tasks on a holiday.
+  # Why 6? 6 can be reasonably an underestimated half a day
   #
   def average_pomodoros
     all = PomodoroCountByDay.find_all
-    (all.inject(0) { |sum, day| sum + day.count}) / all.size
-  rescue ZeroDivisionError
-    0
+    sum = 0
+    valid_day = 0
+    all.each do |day|
+      if day.count &gt; 5
+        valid_day+=1
+        sum = sum + day.count
+      end
+    end
+    valid_day &gt; 0 ? sum/valid_day : 0
   end
 
   def last_tags</diff>
      <filename>lib/pomodori/controllers/pomodori_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -28,7 +28,7 @@ class PomodoriControllerTest &lt; Test::Unit::TestCase
   
   it &quot;should return the average daily pomo&quot; do
     PomodoroCountByDay.stubs(:find_all).returns(pomodoro_count_by_day_sample)
-    @pomodori_controller.average_pomodoros.should == 1
+    @pomodori_controller.average_pomodoros.should == 7
   end
   
   it &quot;retrieves yesterday's pomodoros&quot; do</diff>
      <filename>test/pomodori/controllers/pomodori_controller_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -34,10 +34,14 @@ def pomodoros(how_many = 10)
   pomos
 end
 
+##
+# 3, 6, 9 pomos a day
+# average 6+9/2=7
+#
 def pomodoro_count_by_day_sample
   pomos = []
   3.times do |i|
-    pomos &lt;&lt; PomodoroCountByDay.new(DateTime.new(2009, 03, i % 3 + 1), pomodoros(i))
+    pomos &lt;&lt; PomodoroCountByDay.new(DateTime.new(2009, 03, i % 3 + 1), pomodoros(3 * (i + 1)))
   end
   pomos
 end</diff>
      <filename>test/test_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>80b6cfb557c42884acf2869fcaa0f5eb3f532374</id>
    </parent>
  </parents>
  <author>
    <name>reborg</name>
    <email>reborg@reborg.net</email>
  </author>
  <url>http://github.com/reborg/pomodori/commit/6bc59428d6b010dfc423c31c455a36b92868f6a2</url>
  <id>6bc59428d6b010dfc423c31c455a36b92868f6a2</id>
  <committed-date>2009-09-11T01:10:39-07:00</committed-date>
  <authored-date>2009-09-11T01:10:39-07:00</authored-date>
  <message>removing too short days from the total average</message>
  <tree>3cc1dc818e23c3223cf71cc0fcc37f1b8bcd45a4</tree>
  <committer>
    <name>reborg</name>
    <email>reborg@reborg.net</email>
  </committer>
</commit>
