some polishing
This commit is contained in:
parent
532c1da85d
commit
772a9196a6
@ -84,9 +84,9 @@ class Participation(object):
|
|||||||
|
|
||||||
def __check(self):
|
def __check(self):
|
||||||
if "student" not in self._role and self.gwinner_award:
|
if "student" not in self._role and self.gwinner_award:
|
||||||
self._conflicts.append("Gwinner award selected but not student!")
|
self._conflicts.append("Gwinner award selected but participant not student!")
|
||||||
if (self._food_vegan or self._food_gluten or self._food_vegi) and self._food_normal:
|
if (self._food_vegan or self._food_gluten or self._food_vegi) and self._food_normal:
|
||||||
self._conflicts.append("Conflict in food preferences!")
|
self._conflicts.append("Possible conflict in food preferences!")
|
||||||
|
|
||||||
def __calc_fee(self):
|
def __calc_fee(self):
|
||||||
fee = .0
|
fee = .0
|
||||||
@ -247,7 +247,7 @@ def process_registrations(M):
|
|||||||
return participations
|
return participations
|
||||||
|
|
||||||
msgs = msgs[0].decode('ascii').split()
|
msgs = msgs[0].decode('ascii').split()
|
||||||
print("Found %i registration mails" % len(msgs))
|
print("\tFound %i registration mails" % len(msgs), file=log_file)
|
||||||
for msg_index in msgs:
|
for msg_index in msgs:
|
||||||
participations.append(process_message(M, msg_index))
|
participations.append(process_message(M, msg_index))
|
||||||
return participations
|
return participations
|
||||||
@ -256,7 +256,7 @@ def process_registrations(M):
|
|||||||
def send_confirmation(p=None, csv_file=None):
|
def send_confirmation(p=None, csv_file=None):
|
||||||
if p is not None:
|
if p is not None:
|
||||||
assert(isinstance(p, Participation))
|
assert(isinstance(p, Participation))
|
||||||
content = "Dear %s," % (p.name if p else "participant")
|
content = "Dear %s,\n\n" % (p.name if p else "participant")
|
||||||
with open("response.txt") as fp:
|
with open("response.txt") as fp:
|
||||||
content += fp.read()
|
content += fp.read()
|
||||||
content += "\n"
|
content += "\n"
|
||||||
@ -281,11 +281,13 @@ def send_confirmation(p=None, csv_file=None):
|
|||||||
csv_msg['To'] = p._email # FIXME this is wrong!!! needs to be EMAIL_REPLY
|
csv_msg['To'] = p._email # FIXME this is wrong!!! needs to be EMAIL_REPLY
|
||||||
content = ""
|
content = ""
|
||||||
if p and not p.valid:
|
if p and not p.valid:
|
||||||
content += "Registration contains inconsistencies!\n"
|
content += "Registration contains inconsistencies!\n\t"
|
||||||
content += p.inconsistencies
|
content += p.inconsistencies
|
||||||
content += "\n"
|
content += "\n\n"
|
||||||
if p and len(p.message) > 0:
|
if p and len(p.message) > 0:
|
||||||
content += "Participant left a message:\n %s \n\n" % p.message
|
content += "Participant left a message:\n %s \n\n" % p.message
|
||||||
|
if "_" in csv_file:
|
||||||
|
content += "This seems to be a duplication or correction of an existing registration!\n"
|
||||||
csv_msg.set_content(content)
|
csv_msg.set_content(content)
|
||||||
with open(csv_file, 'rb') as fp:
|
with open(csv_file, 'rb') as fp:
|
||||||
file_data = fp.read()
|
file_data = fp.read()
|
||||||
@ -312,7 +314,7 @@ def check_for_mails():
|
|||||||
|
|
||||||
new_participations = process_registrations(M)
|
new_participations = process_registrations(M)
|
||||||
for p in new_participations:
|
for p in new_participations:
|
||||||
print("New registration by %s" % p.name, file=log_file)
|
print("\tNew registration by %s" % p.name, file=log_file)
|
||||||
csv_file = p.save_to_csv()
|
csv_file = p.save_to_csv()
|
||||||
send_confirmation(p, csv_file)
|
send_confirmation(p, csv_file)
|
||||||
M.close()
|
M.close()
|
||||||
|
Loading…
Reference in New Issue
Block a user