changeset 175:7d85ebe92ecf

getMemberList gets arrivedWithin parameter.
author casties
date Tue, 11 Jun 2013 11:29:56 +0200
parents 15c3bc75028e
children ca6e3873107c
files MPIWGStaff.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MPIWGStaff.py	Mon Jun 10 17:59:39 2013 +0200
+++ b/MPIWGStaff.py	Tue Jun 11 11:29:56 2013 +0200
@@ -134,7 +134,7 @@
         return len(res) > 0
 
 
-    def getMemberList(self, department=None, sortBy='last_name', onlyCurrent=False, limit=0):
+    def getMemberList(self, department=None, sortBy='last_name', onlyCurrent=False, arrivedWithin=None, limit=0):
         """Return the list of members.
         
         Returns a list of MPIWGStaffMember objects.
@@ -150,6 +150,10 @@
         if onlyCurrent:
             query += " and date_from < CURRENT_DATE"
             
+        if arrivedWithin is not None:
+            query += " and date_from > CURRENT_DATE - interval %s"
+            args.append(arrivedWithin)
+            
         if sortBy == 'last_name':
             query += " order by lower(last_name)"
         elif sortBy == 'date_from':