check for double registrations ...
i.e. do not overwrite but store and send a different csv
This commit is contained in:
parent
32bc459bb1
commit
c05b3d4e7f
@ -10,6 +10,7 @@ from email.message import EmailMessage
|
|||||||
import re
|
import re
|
||||||
import datetime as dt
|
import datetime as dt
|
||||||
import time
|
import time
|
||||||
|
import glob
|
||||||
|
|
||||||
EMAIL_ACCOUNT = "bzigr02"
|
EMAIL_ACCOUNT = "bzigr02"
|
||||||
EMAIL_FOLDER = "INBOX"
|
EMAIL_FOLDER = "INBOX"
|
||||||
@ -154,7 +155,13 @@ class Participation(object):
|
|||||||
if not os.path.exists(PARTICIPANTS_FOLDER):
|
if not os.path.exists(PARTICIPANTS_FOLDER):
|
||||||
os.mkdir(PARTICIPANTS_FOLDER)
|
os.mkdir(PARTICIPANTS_FOLDER)
|
||||||
if not filename:
|
if not filename:
|
||||||
filename = os.path.join(PARTICIPANTS_FOLDER, "".join(self.name.split())) + ".csv"
|
stub = os.path.join(PARTICIPANTS_FOLDER, "".join(self.name.split())) + "*"
|
||||||
|
matches = glob.glob(stub)
|
||||||
|
if len(matches) > 0:
|
||||||
|
filename = os.path.join(PARTICIPANTS_FOLDER, "".join(self.name.split())) + "_%i" % len(matches) + ".csv"
|
||||||
|
else:
|
||||||
|
filename = os.path.join(PARTICIPANTS_FOLDER, "".join(self.name.split())) + ".csv"
|
||||||
|
|
||||||
header = ["LastName", "FirstName", "eMail", "Phone", "Institute", "Street", "City",
|
header = ["LastName", "FirstName", "eMail", "Phone", "Institute", "Street", "City",
|
||||||
"RegDate", "CareerStage", "Fee", "FarewellEvent", "GwinnerAward", "LabTour",
|
"RegDate", "CareerStage", "Fee", "FarewellEvent", "GwinnerAward", "LabTour",
|
||||||
"FoodVegetarian", "FoodVegan", "FoodGlutenFree", "FoodNoPref"]
|
"FoodVegetarian", "FoodVegan", "FoodGlutenFree", "FoodNoPref"]
|
||||||
|
Loading…
Reference in New Issue
Block a user