Exemplo n.º 1
0
 def add_period(self, period):
     start_day = convert_date(period['startmoment'])
     end_day = convert_date(period['finishmoment'])
     if end_day < self.start_datetime or start_day > self.end_datetime:
         return
     if start_day < self.start_datetime:
         start_day = self.start_datetime
     if end_day > self.end_datetime:
         end_day = self.end_datetime
     for halfday in xhalfdays(start_day, end_day):
         self.days[halfday] = PeriodActivity(
             activity_type=period['type'],
             verbose_type=self.period_legend.get(period['type']),
             label=period.get('label')
         )
Exemplo n.º 2
0
 def add_period(self, period):
     start_day = convert_date(period['startmoment'])
     end_day = convert_date(period['finishmoment'])
     if end_day < self.start_datetime or start_day > self.end_datetime:
         return
     if start_day < self.start_datetime:
         start_day = self.start_datetime
     if end_day > self.end_datetime:
         end_day = self.end_datetime
     for halfday in xhalfdays(start_day, end_day):
         self.days[halfday] = {
             'nature': 'period',
             'type': period['type'],
             'verbose_type': self.period_legend.get(period['type']),
             'label': period.get('label'),
         }
Exemplo n.º 3
0
 def __init__(self, start_date, end_date, period_legend, symbol_legend):
     self.period_legend = period_legend
     self.symbol_legend = symbol_legend
     self.start_date = start_date
     self.end_date = end_date
     self.days = {}
     self.start_datetime = datetime(
         start_date.year,
         start_date.month,
         start_date.day,
         9
     )
     self.end_datetime = datetime(
         end_date.year,
         end_date.month,
         end_date.day,
         17
     )
     for halfday in xhalfdays(self.start_datetime, self.end_datetime):
         self.days[halfday] = self.get_blank_activity()