def post(self): creator = users.get_current_user() title = self.request.get('title') descrip = self.request.get('descrip') start = util.convert_htmldatetime(self.request.get('start')) end = util.convert_htmldatetime(self.request.get('end')) slot_minutes = int(self.request.get('slot_minutes')) topic = Topic( creator=creator, title=title, descrip=descrip, start=start, end=end, slot_minutes=slot_minutes) topic.put() # Now create slots current_slot = start while (current_slot < end): slot = TopicSlot(start=current_slot, topic=topic) slot.put() current_slot += datetime.timedelta(minutes=slot_minutes) self.redirect(topic.full_link)
def post(self, slot_id): topic_slot = TopicSlot.get_by_id(int(slot_id)) counter = self.request.get("counter") if counter: topic_slot.counter = int(counter) topic_slot.save() self.render_slot_page(topic_slot)
def get(self): # look for slots starting in 24 hours, notify them that their slots are empty start_looking = datetime.datetime.now() + datetime.timedelta( minutes=60 * 24) stop_looking = start_looking + datetime.timedelta(minutes=60) slots = TopicSlot.get_between_times(start_looking, stop_looking) for slot in slots: if slot.topic.slot_capacity == 1: return slot_subject = EMPTY_SUBJECT % (slot.topic.title) rsvps = slot.rsvps.fetch(3) if len(rsvps) > 1: return for rsvp in rsvps: if not rsvp.notified_empty: slot_body = EMPTY_BODY % (slot.topic.title, rsvp.local_time, slot.full_link) taskqueue.add(url='/email/send', params={ 'email': rsvp.attendee, 'subject': slot_subject, 'body': slot_body }) rsvp.notified_empty = True rsvp.save()
def get(self): start_looking = datetime.datetime.now() + datetime.timedelta(minutes=120) stop_looking = start_looking + datetime.timedelta(minutes=60) slots = TopicSlot.get_between_times(start_looking, stop_looking) for slot in slots: slot_subject = REMINDER_SUBJECT % (slot.topic.title) for rsvp in slot.rsvps.fetch(10000): if not rsvp.notified: slot_body = REMINDER_BODY % (slot.topic.title, rsvp.local_time, slot.full_link) taskqueue.add(url='/email/reminder', params={'email': rsvp.attendee, 'subject': slot_subject, 'body': slot_body}) rsvp.notified = True rsvp.save()
def get(self): start_looking = datetime.datetime.now() - datetime.timedelta(minutes=5) stop_looking = start_looking + datetime.timedelta(minutes=15) slots = TopicSlot.get_between_times(start_looking, stop_looking) for slot in slots: slot_subject = SETUP_REMINDER_SUBJECT % (slot.topic.title) for rsvp in slot.rsvps.fetch(10000): if not rsvp.notified_setup: slot_body = SETUP_REMINDER_BODY % (slot.topic.title, util.get_host() + '/help/setup', slot.topic.full_link) taskqueue.add(url='/email/send', params={'email': rsvp.attendee, 'subject': slot_subject, 'body': slot_body}) rsvp.notified_setup = True rsvp.save()
def post(self, topic_id): slot_id = int(self.request.get("slot_id")) local_time = self.request.get("local_time") action = self.request.get("action") topic_slot = TopicSlot.get_by_id(slot_id) rsvp = TopicRSVP.get_for_user_and_slot(users.get_current_user(), topic_slot) if not rsvp and action == "signup": rsvp = TopicRSVP(slot=topic_slot, attendee=users.get_current_user(), local_time=local_time) rsvp.put() self.redirect(topic_slot.full_link) if rsvp and action == "unsignup": rsvp.delete() self.render_signup(topic_id)
def post(self): creator = users.get_current_user() title = self.request.get('title') descrip = self.request.get('descrip') start = util.convert_htmldatetime(self.request.get('start')) end = util.convert_htmldatetime(self.request.get('end')) slot_minutes = int(self.request.get('slot_minutes')) topic = Topic(creator=creator, title=title, descrip=descrip, start=start, end=end, slot_minutes=slot_minutes) topic.put() # Now create slots current_slot = start while (current_slot < end): slot = TopicSlot(start=current_slot, topic=topic) slot.put() current_slot += datetime.timedelta(minutes=slot_minutes) self.redirect(topic.full_link)
def get(self): # look for slots starting in 24 hours, notify them that their slots are empty start_looking = datetime.datetime.now() + datetime.timedelta(minutes=60*24) stop_looking = start_looking + datetime.timedelta(minutes=60) slots = TopicSlot.get_between_times(start_looking, stop_looking) for slot in slots: if slot.topic.slot_capacity == 1: return slot_subject = EMPTY_SUBJECT % (slot.topic.title) rsvps = slot.rsvps.fetch(3) if len(rsvps) > 1: return for rsvp in rsvps: if not rsvp.notified_empty: slot_body = EMPTY_BODY % (slot.topic.title, rsvp.local_time, slot.full_link) taskqueue.add(url='/email/send', params={'email': rsvp.attendee, 'subject': slot_subject, 'body': slot_body}) rsvp.notified_empty = True rsvp.save()
def get(self): start_looking = datetime.datetime.now() + datetime.timedelta( minutes=120) stop_looking = start_looking + datetime.timedelta(minutes=60) slots = TopicSlot.get_between_times(start_looking, stop_looking) for slot in slots: slot_subject = REMINDER_SUBJECT % (slot.topic.title) for rsvp in slot.rsvps.fetch(10000): if not rsvp.notified: slot_body = REMINDER_BODY % ( slot.topic.title, rsvp.local_time, slot.full_link) taskqueue.add(url='/email/reminder', params={ 'email': rsvp.attendee, 'subject': slot_subject, 'body': slot_body }) rsvp.notified = True rsvp.save()
def get(self): start_looking = datetime.datetime.now() - datetime.timedelta(minutes=5) stop_looking = start_looking + datetime.timedelta(minutes=15) slots = TopicSlot.get_between_times(start_looking, stop_looking) for slot in slots: slot_subject = SETUP_REMINDER_SUBJECT % (slot.topic.title) for rsvp in slot.rsvps.fetch(10000): if not rsvp.notified_setup: slot_body = SETUP_REMINDER_BODY % ( slot.topic.title, util.get_host() + '/help/setup', slot.topic.full_link) taskqueue.add(url='/email/send', params={ 'email': rsvp.attendee, 'subject': slot_subject, 'body': slot_body }) rsvp.notified_setup = True rsvp.save()
def get(self, slot_id): topic_slot = TopicSlot.get_by_id(int(slot_id)) self.render_slot_page(topic_slot)