Commit 0a372d65 authored by Arnaud Delcasse's avatar Arnaud Delcasse

Reminder every week before the end of the vote

parent e6bbbba6
......@@ -18,7 +18,16 @@ for vote in c.execute('select id, id_group, date_end, title from votes where is_
date_today = datetime.today()
date_begin_reminder = date_end_vote + timedelta(days=-3)
if date_today >= date_begin_reminder and date_today <= date_end_vote:
date_cursor = date_today
is_anniversary = False
while not is_anniversary and date_cursor <= date_end_vote:
date_cursor = date_cursor + timedelta(days=7)
print date_cursor
if date_cursor >= date_end_vote and date_cursor <= date_end_vote + timedelta(days=1):
print "Is anniversary"
is_anniversary = True
if date_today >= date_begin_reminder and date_today <= date_end_vote or is_anniversary:
voting_group = (vote[1],)
for user in c.execute('select users.id, users.email, users.name from users join user_group on users.id=user_group.id_user where user_group.id_group = ?', voting_group).fetchall():
userchoice_request = (user[0], vote[0],)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment