<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -7,7 +7,7 @@ class PeopleController &lt; ApplicationController
   before_filter :setup
   
   def index
-    @people = Person.active(params[:page])
+    @people = Person.mostly_active(params[:page])
 
     respond_to do |format|
       format.html</diff>
      <filename>app/controllers/people_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -50,6 +50,7 @@ class Person &lt; ActiveRecord::Base
   NUM_WALL_COMMENTS = 10
   NUM_RECENT = 8
   FEED_SIZE = 10
+  TIME_AGO_FOR_MOSTLY_ACTIVE = 1.month.ago
   ACCEPTED_AND_ACTIVE =  [%(status = #{Connection::ACCEPTED} AND
                             deactivated = ? AND
                             (email_verified IS NULL OR email_verified = ?)),
@@ -110,6 +111,14 @@ class Person &lt; ActiveRecord::Base
                      :conditions =&gt; conditions_for_active)
     end
     
+    # Return the people who are 'mostly' active.
+    # People are mostly active if they have logged in recently enough.
+    def mostly_active(page = 1)
+      paginate(:all, :page =&gt; page,
+                     :per_page =&gt; RASTER_PER_PAGE,
+                     :conditions =&gt; conditions_for_mostly_active)
+    end
+    
     # Return *all* the active users.
     def all_active
       find(:all, :conditions =&gt; conditions_for_active)
@@ -397,10 +406,22 @@ class Person &lt; ActiveRecord::Base
       crypted_password.blank? || !password.blank? || !verify_password.nil?
     end
     
-    # Return the conditions for a user to be active.
-    def self.conditions_for_active
-      [%(deactivated = ? AND 
-        (email_verified IS NULL OR email_verified = ?)),
-       false, true]
+    class &lt;&lt; self
+    
+      # Return the conditions for a user to be active.
+      def conditions_for_active
+        [%(deactivated = ? AND 
+          (email_verified IS NULL OR email_verified = ?)),
+         false, true]
+      end
+      
+      # Return the conditions for a user to be 'mostly' active.
+      def conditions_for_mostly_active
+        [%(deactivated = ? AND 
+          (email_verified IS NULL OR email_verified = ?) AND
+          (last_logged_in_at IS NOT NULL AND
+           last_logged_in_at &gt;= ?)),
+         false, true, TIME_AGO_FOR_MOSTLY_ACTIVE]
+      end
     end
 end</diff>
      <filename>app/models/person.rb</filename>
    </modified>
    <modified>
      <diff>@@ -337,6 +337,34 @@ describe Person do
       @person.should be_active
     end
   end
+  
+  describe &quot;mostly active&quot; do
+    it &quot;should include a recently logged-in person&quot; do
+      Person.mostly_active.should contain(@person)
+    end
+    
+    it &quot;should not include a deactivated person&quot; do
+      @person.toggle!(:deactivated)
+      Person.mostly_active.should_not contain(@person)
+    end
+    
+    it &quot;should not include an email unverified person&quot; do
+      enable_email_notifications
+      @person.email_verified = false; @person.save!
+      Person.mostly_active.should_not contain(@person)      
+    end
+    
+    it &quot;should not include a person who has never logged in&quot; do
+      @person.last_logged_in_at = nil; @person.save
+      Person.mostly_active.should_not contain(@person)
+    end
+    
+    it &quot;should not include a person who logged in too long ago&quot; do
+      @person.last_logged_in_at = Person::TIME_AGO_FOR_MOSTLY_ACTIVE - 1
+      @person.save
+      Person.mostly_active.should_not contain(@person)
+    end
+  end
 
   describe &quot;admin&quot; do
 </diff>
      <filename>spec/models/person_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>f65d99d95a4150b00b12d0d5109452712533df93</id>
    </parent>
  </parents>
  <author>
    <name>Michael Hartl</name>
    <email>michael@michaelhartl.com</email>
  </author>
  <url>http://github.com/piotrj/insoshi/commit/779e5a266ed875e2d447a9a6ca73947c15b5471a</url>
  <id>779e5a266ed875e2d447a9a6ca73947c15b5471a</id>
  <committed-date>2008-05-22T13:56:35-07:00</committed-date>
  <authored-date>2008-05-22T13:56:35-07:00</authored-date>
  <message>Added mostly_active category on Steve Bristol's recommendation</message>
  <tree>1bc6e19ec4f6539b0c9ff720866e97314e90971c</tree>
  <committer>
    <name>Michael Hartl</name>
    <email>michael@michaelhartl.com</email>
  </committer>
</commit>
