Commits

Virgil Dupras committed c79fec3

Open contributions only help with backlogs that are at least 4 months old.

Comments (0)

Files changed (1)

 # to use complex import scehemes.
 
 from itertools import groupby
-from datetime import datetime
+from datetime import datetime, timedelta
 import hashlib
 import re
 from functools import wraps
         timelogs = session.query(Timelog).filter_by(is_paid=False)\
             .filter(Timelog.project_id.in_(affected_projects_ids)).order_by(Timelog.start_time).all()
         if not timelogs and self.is_open:
+            # We only "help" project that have a 4 months old backlog of hours to pay. We do that
+            # to give them an opportunity to "help themselves" a little. Otherwise, a strong project
+            # could cause a project to never solicit its users for contributions.
+            four_months_ago = datetime.now() - timedelta(days=120)
             timelogs = session.query(Timelog).filter_by(is_paid=False)\
-                .order_by(Timelog.start_time).all()
+                .filter(Timelog.start_time<four_months_ago).order_by(Timelog.start_time).all()
         if not timelogs:
             return False
         for timelog in timelogs: