<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -652,6 +652,7 @@ class StatsController &lt; ApplicationController
           &quot;AND tags.id = taggings.tag_id &quot; +
           &quot;AND taggings.taggable_id = todos.id &quot;, current_user.id])
     tags_ids_s = tag_ids.map(&amp;:id).sort.join(&quot;,&quot;)
+    return {} if tags_ids_s.blank?  # return empty array for .size to work
     return Tag.find(:all, :conditions =&gt; &quot;id in (&quot; + tags_ids_s + &quot;)&quot;)
   end
 </diff>
      <filename>app/controllers/stats_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -90,5 +90,21 @@ class StatsControllerTest &lt; Test::Unit::TestCase
     assert_response :success
     assert_template &quot;stats/show_selection_from_chart&quot;
   end
-  
+
+  def test_stats_render_when_tasks_have_no_taggings
+    login_as(:admin_user)
+
+    # using the default fixtures, todos have tags
+    get :index
+    assert_response :success
+
+    # clear taggings table and render again
+    taggings = Tagging.find(:all)
+    taggings.each do |t|
+      t.delete
+    end
+    get :index
+    assert_response :success
+
+  end
 end</diff>
      <filename>test/functional/stats_controller_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>278c7310c18cf245dca4291cce3168abc78ff9aa</id>
    </parent>
  </parents>
  <author>
    <name>Reinier Balt</name>
    <email>lrbalt@gmail.com</email>
  </author>
  <url>http://github.com/bsag/tracks/commit/8cdae83014eadccd194d1d907b14026ae4b418cd</url>
  <id>8cdae83014eadccd194d1d907b14026ae4b418cd</id>
  <committed-date>2009-01-15T13:13:22-08:00</committed-date>
  <authored-date>2009-01-15T13:13:22-08:00</authored-date>
  <message>fix case when there are no tags places on todos, the stats page would fail. Fixes #822.

Thanks Walter for finding this one</message>
  <tree>15ba1a9d44a0aedd3889a6eb60b747e7f3d14ae2</tree>
  <committer>
    <name>Reinier Balt</name>
    <email>lrbalt@gmail.com</email>
  </committer>
</commit>
