|
|
|
@ -0,0 +1,35 @@ |
|
|
|
import datetime |
|
|
|
|
|
|
|
from gapi.apis.calendar_api.models import Event |
|
|
|
from .constants import WEEKDAYS, WEEK |
|
|
|
|
|
|
|
|
|
|
|
class Workday: |
|
|
|
def __init__( |
|
|
|
self, start_time: datetime.datetime, end_time: datetime.datetime, location |
|
|
|
): |
|
|
|
self.start_time = start_time |
|
|
|
self.end_time = end_time |
|
|
|
self.location = location |
|
|
|
|
|
|
|
def convert_to_Event(self) -> Event: |
|
|
|
e = Event(self.start_time, self.end_time, location=self.location) |
|
|
|
e.add_reminder(60) |
|
|
|
return e |
|
|
|
|
|
|
|
|
|
|
|
class PaneraWeek: |
|
|
|
def __init__(self, start_date: datetime.date, work_location): |
|
|
|
if start_date.weekday() != WEEKDAYS.W: |
|
|
|
|
|
|
|
raise ValueError( |
|
|
|
('"start_date is" on a "{:%A}" instead of Wednesday'.format(start_date)) |
|
|
|
) |
|
|
|
self.start_date = start_date |
|
|
|
self.workdays = [] |
|
|
|
|
|
|
|
def get_week_end(self): |
|
|
|
return self.start_date + datetime.timedelta(days=7 - 1) |
|
|
|
|
|
|
|
def add_workday(self, workday: Workday): |
|
|
|
self.workdays.append(workday) |