<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>app/views/statuses/statistics.html.erb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -51,6 +51,12 @@ class StatusesController &lt; ApplicationController
     render_tweets
   end
 
+  def statistics
+    @top_ten_twats = Tweet.top_ten_updaters
+
+    @twats_per_hour = Tweet.updates_per_hour
+  end
+
   def user_timeline
     limit = params[:all] ? 100000000000 : 25
     @tweets = @user.public_tweets.find(:all,:include =&gt; :user,:limit =&gt; limit)</diff>
      <filename>app/controllers/statuses_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -30,4 +30,24 @@ class Tweet &lt; ActiveRecord::Base
      end
      ret
   end
+
+  def self.top_ten_updaters
+    find_by_sql(&lt;&lt;-EOF)
+      SELECT count(tweets.tweet) AS updates, users.username AS name
+      FROM tweets
+      INNER JOIN users ON tweets.user_id = users.id
+      WHERE tweets.tweet_type != 'direct'
+      GROUP BY user_id ORDER BY updates DESC LIMIT 10
+    EOF
+  end
+
+  def self.updates_per_hour
+    hours = {}
+    all(:conditions =&gt; &quot;tweet_type != 'direct'&quot;).each do |tweet|
+      hours[tweet.created_at.hour] ||= 1
+      hours[tweet.created_at.hour] += 1
+    end
+    hours
+  end
+
 end</diff>
      <filename>app/models/tweet.rb</filename>
    </modified>
    <modified>
      <diff>@@ -29,6 +29,10 @@
             &lt;a href=&quot;/favorites&quot; id=&quot;favorites_tab&quot;&gt;Favorites&lt;/a&gt;&lt;/li&gt;
         &lt;li&gt;
             &lt;a href=&quot;/public_timeline&quot; id=&quot;public_timeline_tab&quot;&gt;Everyone&lt;/a&gt;&lt;/li&gt;
+      &lt;li&gt;
+        &lt;a href=&quot;/statistics&quot; id=&quot;search_tab&quot;&gt;POPULARITY CONTEST&lt;/a&gt;&lt;/li&gt;
+      &lt;/li&gt;
+
     &lt;/ul&gt;
 
     &lt;div class=&quot;section last&quot;&gt;</diff>
      <filename>app/views/statuses/_sidebar.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -8,6 +8,7 @@ ActionController::Routing::Routes.draw do |map|
   map.connect &quot;/friends&quot;, :controller =&gt; &quot;statuses&quot;,:action =&gt; &quot;friends&quot;
   map.connect &quot;/followers&quot;, :controller =&gt; &quot;statuses&quot;,:action =&gt; &quot;followers&quot;
   map.connect &quot;/search&quot;, :controller =&gt; &quot;statuses&quot;,:action =&gt; &quot;search&quot;
+  map.connect &quot;/statistics&quot;, :controller =&gt; &quot;statuses&quot;,:action =&gt; &quot;statistics&quot;
   map.connect &quot;/public_timeline&quot;, :controller =&gt; &quot;statuses&quot;,:action =&gt; &quot;public_timeline&quot;
 
   map.connect &quot;/statuses/public_timeline.:format&quot;, :controller =&gt; &quot;statuses&quot;, :action =&gt; &quot;friends_timeline&quot;</diff>
      <filename>config/routes.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>0c5953a749f33cd5d02cf624998d422126ed6077</id>
    </parent>
  </parents>
  <author>
    <name>Michael Pearson</name>
    <email>mp@monkey.(none)</email>
  </author>
  <url>http://github.com/rnielsen/twetter/commit/a10cefbd781a25e718c549fc9074f270ed090985</url>
  <id>a10cefbd781a25e718c549fc9074f270ed090985</id>
  <committed-date>2009-05-16T03:27:25-07:00</committed-date>
  <authored-date>2009-05-16T03:27:25-07:00</authored-date>
  <message>Basic statistics support - no graphing</message>
  <tree>c48003fc56c033605ca2c950797e4cddbcd0e0f4</tree>
  <committer>
    <name>Michael Pearson</name>
    <email>mp@monkey.(none)</email>
  </committer>
</commit>
