Esempio n. 1
0
 def acknowledge(self, info=None, days=None, date=None, user=None):
     if date is not None and info is None:
         # info required if custom date used
         info = fake.paragraph()
     new_due_date = self.__get_new_due_date(days, date)
     return self.__extend(determination_type.ACKNOWLEDGMENT, new_due_date,
                          user, {"status": request_status.IN_PROGRESS},
                          info)
Esempio n. 2
0
 def add_instructions(self,
                      content=None,
                      privacy=response_privacy.PRIVATE,
                      user=None):
     response = Instructions(self.request.id,
                             privacy,
                             content=content or fake.paragraph())
     create_object(response)
     self.__create_event(event_type.INSTRUCTIONS_ADDED, response, user)
     return response
Esempio n. 3
0
 def add_note(self,
              content=None,
              privacy=response_privacy.PRIVATE,
              user=None):
     response = Notes(self.request.id,
                      privacy,
                      content=content or fake.paragraph())
     create_object(response)
     self.__create_event(event_type.NOTE_ADDED, response, user)
     return response
Esempio n. 4
0
 def extend(self, reason=None, days=None, date=None, user=None):
     new_due_date = self.__get_new_due_date(days, date)
     days_until_due = calendar.busdaycount(
         datetime.utcnow(),
         new_due_date.replace(hour=23, minute=59, second=59))
     if new_due_date < datetime.utcnow():
         new_status = request_status.OVERDUE
     elif days_until_due <= current_app.config['DUE_SOON_DAYS_THRESHOLD']:
         new_status = request_status.DUE_SOON
     else:
         new_status = request_status.IN_PROGRESS
     return self.__extend(determination_type.EXTENSION, new_due_date, user,
                          {"status": new_status}, reason
                          or fake.paragraph())