-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUS38_listUpcomingBirthdays.py
More file actions
25 lines (19 loc) · 913 Bytes
/
US38_listUpcomingBirthdays.py
File metadata and controls
25 lines (19 loc) · 913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from all_db_operations import *
from print_data import *
connection = MongoClient('localhost', 27017)
db = connection['GEDCOMDB']
def US38_listUpcomingBirthdays():
userStoryName('US38')
#return_flag=False
people=db.people.find({})
results = [res for res in people]
people.close()
current=datetime.now()
output('\t' + 'Individual ID' + '\t\t' + 'Name' + '\t\t\t\t' + 'Birthday')
for res in results:
if "birthday" in res and res["birthday"] is not None:
birthday= datetime.strptime(res["birthday"],"%Y-%m-%d %H:%M:%S")
if (birthday.month- current.month > 0 ):
output('\t' + res["ID"] + '\t\t\t%-10s' % res["NAME"][0] + " %-10s" % (res["NAME"][1]).strip("/") + '\t\t' + res['birthday'])
if (birthday.month - current.month == 0 & birthday.day > current.day):
output('\t' + res["ID"] + '\t\t' + res["NAME"][0] + " " + (res["NAME"][1]).strip("/") + '\t\t%30s' % res['birthday'])