<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -74,7 +74,7 @@ class Report &lt; ActiveRecord::Base
   before_validation :set_source
   before_create :detect_location, :append_tags
   after_save :check_uniqueid
-  after_create :assign_tags, :assign_wait_time, :assign_filters
+  after_create :assign_tags, :assign_wait_time, :assign_filters, :auto_review
   
   named_scope :with_location, :conditions =&gt; 'location_id IS NOT NULL'
   named_scope :with_wait_time, :conditions =&gt; 'wait_time IS NOT NULL'
@@ -87,7 +87,7 @@ class Report &lt; ActiveRecord::Base
   named_scope( :unassigned, 
     :limit =&gt; 10, 
     :order =&gt; 'created_at DESC',
-    :conditions =&gt; 'reviewer_id IS NULL OR (assigned_at &lt; UTC_TIMESTAMP - INTERVAL 10 MINUTE AND reviewed_at IS NULL)' 
+    :conditions =&gt; 'reviewed_at IS NULL AND reviewer_id IS NULL OR assigned_at &lt; UTC_TIMESTAMP - INTERVAL 10 MINUTE' 
   ) do
     def assign(reviewer)
       # FIXME: can't we do this more efficiently? a la p-code:
@@ -282,4 +282,11 @@ class Report &lt; ActiveRecord::Base
 		end
 		true
   end
+  
+  def auto_review
+    if self.wait_time &amp;&amp; self.location
+      self.reviewed_at = Time.now.utc
+    end
+    true
+  end
 end</diff>
      <filename>app/models/report.rb</filename>
    </modified>
    <modified>
      <diff>@@ -11,7 +11,7 @@
 
 ActiveRecord::Schema.define(:version =&gt; 20081104035507) do
 
-  create_table &quot;alert_viewings&quot;, :options=&gt;'ENGINE=MyISAM', :force =&gt; true do |t|
+  create_table &quot;alert_viewings&quot;, :force =&gt; true do |t|
     t.column &quot;user_id&quot;, :integer
     t.column &quot;reviewer_alert_id&quot;, :integer
     t.column &quot;created_at&quot;, :datetime
@@ -67,7 +67,7 @@ ActiveRecord::Schema.define(:version =&gt; 20081104035507) do
 
   add_index &quot;locations&quot;, [&quot;point&quot;], :name =&gt; &quot;index_locations_on_point&quot;, :spatial=&gt; true 
 
-  create_table &quot;polling_places&quot;, :options=&gt;'ENGINE=MyISAM', :force =&gt; true do |t|
+  create_table &quot;polling_places&quot;, :force =&gt; true do |t|
     t.column &quot;location_id&quot;, :integer
     t.column &quot;name&quot;, :string, :limit =&gt; 80
     t.column &quot;address&quot;, :string, :limit =&gt; 80
@@ -86,7 +86,7 @@ ActiveRecord::Schema.define(:version =&gt; 20081104035507) do
   add_index &quot;report_filters&quot;, [&quot;report_id&quot;], :name =&gt; &quot;index_report_filters_on_report_id&quot;
   add_index &quot;report_filters&quot;, [&quot;filter_id&quot;], :name =&gt; &quot;index_report_filters_on_filter_id&quot;
 
-  create_table &quot;report_tags&quot;, :options=&gt;'ENGINE=MyISAM', :force =&gt; true do |t|
+  create_table &quot;report_tags&quot;, :force =&gt; true do |t|
     t.column &quot;report_id&quot;, :integer
     t.column &quot;tag_id&quot;, :integer
   end
@@ -94,7 +94,7 @@ ActiveRecord::Schema.define(:version =&gt; 20081104035507) do
   add_index &quot;report_tags&quot;, [&quot;report_id&quot;], :name =&gt; &quot;index_report_tags_on_report_id&quot;
   add_index &quot;report_tags&quot;, [&quot;tag_id&quot;], :name =&gt; &quot;index_report_tags_on_tag_id&quot;
 
-  create_table &quot;reporters&quot;, :options=&gt;'ENGINE=MyISAM', :force =&gt; true do |t|
+  create_table &quot;reporters&quot;, :force =&gt; true do |t|
     t.column &quot;location_id&quot;, :integer
     t.column &quot;type&quot;, :string, :limit =&gt; 30
     t.column &quot;uniqueid&quot;, :string, :limit =&gt; 80
@@ -109,7 +109,7 @@ ActiveRecord::Schema.define(:version =&gt; 20081104035507) do
 
   add_index &quot;reporters&quot;, [&quot;uniqueid&quot;, &quot;type&quot;], :name =&gt; &quot;index_reports_on_uniqueid_and_type&quot;, :unique =&gt; true
 
-  create_table &quot;reports&quot;, :options=&gt;'ENGINE=MyISAM', :force =&gt; true do |t|
+  create_table &quot;reports&quot;, :force =&gt; true do |t|
     t.column &quot;source&quot;, :string, :limit =&gt; 3
     t.column &quot;reporter_id&quot;, :integer
     t.column &quot;location_id&quot;, :integer
@@ -121,20 +121,20 @@ ActiveRecord::Schema.define(:version =&gt; 20081104035507) do
     t.column &quot;polling_place_id&quot;, :integer
     t.column &quot;created_at&quot;, :datetime
     t.column &quot;updated_at&quot;, :datetime
-    t.column &quot;rating&quot;, :integer
-    t.column &quot;location_accuracy&quot;, :integer
-    t.column &quot;has_audio&quot;, :boolean
     t.column &quot;assigned_at&quot;, :datetime
     t.column &quot;reviewed_at&quot;, :datetime
     t.column &quot;reviewer_id&quot;, :integer
     t.column &quot;dismissed_at&quot;, :datetime
     t.column &quot;tag_s&quot;, :string
+    t.column &quot;rating&quot;, :integer
+    t.column &quot;location_accuracy&quot;, :integer
+    t.column &quot;has_audio&quot;, :boolean
   end
 
   add_index &quot;reports&quot;, [&quot;created_at&quot;], :name =&gt; &quot;index_reports_on_created_at&quot;
   add_index &quot;reports&quot;, [&quot;reviewer_id&quot;], :name =&gt; &quot;index_reports_on_reviewer_id&quot;
 
-  create_table &quot;reviewer_alerts&quot;, :options=&gt;'ENGINE=MyISAM', :force =&gt; true do |t|
+  create_table &quot;reviewer_alerts&quot;, :force =&gt; true do |t|
     t.column &quot;text&quot;, :string
     t.column &quot;user_id&quot;, :integer
     t.column &quot;created_at&quot;, :datetime
@@ -150,7 +150,7 @@ ActiveRecord::Schema.define(:version =&gt; 20081104035507) do
     t.column &quot;decimal_value&quot;, :integer, :limit =&gt; 10
   end
 
-  create_table &quot;tags&quot;, :options=&gt;'ENGINE=MyISAM', :force =&gt; true do |t|
+  create_table &quot;tags&quot;, :force =&gt; true do |t|
     t.column &quot;pattern&quot;, :string, :limit =&gt; 30
     t.column &quot;description&quot;, :string, :limit =&gt; 80
     t.column &quot;score&quot;, :integer
@@ -181,13 +181,14 @@ ActiveRecord::Schema.define(:version =&gt; 20081104035507) do
     t.column &quot;remember_token_expires_at&quot;, :datetime
     t.column &quot;activation_code&quot;, :string, :limit =&gt; 40
     t.column &quot;activated_at&quot;, :datetime
-    t.column &quot;is_admin&quot;, :boolean, :default =&gt; false
     t.column &quot;is_terminated&quot;, :boolean, :default =&gt; false
+    t.column &quot;is_admin&quot;, :boolean, :default =&gt; false
     t.column &quot;reports_count&quot;, :integer, :default =&gt; 0
   end
 
   add_index &quot;users&quot;, [&quot;api_key&quot;], :name =&gt; &quot;index_users_on_api_key&quot;, :unique =&gt; true
   add_index &quot;users&quot;, [&quot;email&quot;], :name =&gt; &quot;index_users_on_email&quot;, :unique =&gt; true
   add_index &quot;users&quot;, [&quot;type&quot;], :name =&gt; &quot;index_users_on_type&quot;
+  add_index &quot;users&quot;, [&quot;reports_count&quot;], :name =&gt; &quot;index_users_on_reports_count&quot;
 
 end</diff>
      <filename>db/schema.rb</filename>
    </modified>
    <modified>
      <diff>@@ -22,4 +22,4 @@ Looks like:
 
 Run hourly via cron and mail via:
 
-0 * * * * mysql --table -u &lt;USER&gt; votereport_development &lt; doc/hourly_statistics.sql | /bin/mail -s &quot;TVR Hours Stats&quot; monitors@twitter.votereport.com
+0 * * * * mysql --table -u &lt;USER&gt; votereport_production &lt; doc/hourly_statistics.sql | /bin/mail -s &quot;TVR Hours Stats&quot; &lt;SOME LIST@twittervotereport.com&gt;</diff>
      <filename>doc/README_FOR_HOURLY_STATS</filename>
    </modified>
    <modified>
      <diff>@@ -141,6 +141,13 @@ class ReportTest &lt; ActiveSupport::TestCase
     assert_equal reports.size, Report.assigned(users(:quentin)).size
   end
   
+  def test_auto_review
+    new_report = @twitter_reporter.reports.create(:text =&gt; 'i got #early #reg #challenges #wait:10 some tags 11222')
+    assert_not_nil new_report.reviewed_at
+    reports = Report.unassigned
+    assert !reports.include?(new_report)
+  end
+  
   ##########################
   
   def create_report(text)</diff>
      <filename>test/unit/report_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>b07fa11dcb1b2879cb0087db63e6c1488e32ad8a</id>
    </parent>
  </parents>
  <author>
    <name>Billy Gray</name>
    <email>wgray@zetetic.net</email>
  </author>
  <url>http://github.com/davetroy/votereport/commit/7cbba86695129faee32f9775704ff7d39c50e5e1</url>
  <id>7cbba86695129faee32f9775704ff7d39c50e5e1</id>
  <committed-date>2008-11-03T22:21:05-08:00</committed-date>
  <authored-date>2008-11-03T22:21:05-08:00</authored-date>
  <message>- sets reports with a wait and a location as pre-approved
- we may want to set the reviewer to some dummy/system user</message>
  <tree>60a695a4d4fbbb49885adb73bbc5334d3fdc695a</tree>
  <committer>
    <name>Billy Gray</name>
    <email>wgray@zetetic.net</email>
  </committer>
</commit>
