def add_waitlist_position(self): ''' This method calculates the current position of the person on the wait list and adds it to the mail. ''' wl = WaitList(self.db) pos = wl.get_pos_current(self.pid) if pos == 0: pos = '???' self.subs['<PLACEHOLDER_WAIT_POSITION>'] = str(pos) self.subs['<PLACEHOLDER_WAIT_STATUS>'] = wl.status_text(self.pid)
''' This function goes through the sorted wait list after its resolution. An denial email is sent to each person who did not get a sale number. ''' logger_bg.info('start with script "send_waitlist_denial_mail.py" ...') logger_bg.info('command line arguments: ' + str(sys.argv)) # extract limit from parameter if len(sys.argv) > 1: limit = int(sys.argv[1]) else: limit = 0 try: wl = WaitList(shotdb) if Numbers(shotdb, wl.eid).b_numbers_available(): logger_bg.warning('There are still sale numbers available! Nothing is done.') else: count = 0 for row in wl.get_denials(limit): shotdb(shotdb.wait.id == row.wait.id).update(denial_sent = True) shotdb.commit() m = WaitDenialMail(auth, row.person.id, mass = True) m.set_error_handling_parameters(number_attempts = config.bulk_email_number_attempts, delay_next_attempt = config.bulk_email_number_delay_next_attempt) if count == 0: # output account settings