コード例 #1
0
 def check_monthly_hours(self, day_date: str) -> float:
     day_date = Utils.to_date(day_date)
     first_day_of_the_month = HourMonitor.get_first_date_of_the_month(day_date)
     weekstarts = HourMonitor.get_week_starts(first_day_of_the_month)
     monthly_hours = 0
     for weekstart in weekstarts:
         weekstart = Utils.day_date_to_string(weekstart)
         monthly_hours += self.check_weekly_hours(weekstart)
     return monthly_hours
コード例 #2
0
ファイル: day.py プロジェクト: mfernandriu/hour-monitor
 def to_json_dict(self):
     json_writable_dict = dict()
     json_writable_dict[
         self.day_date_attribute_name] = Utils.day_date_to_string(
             self.day_date)
     if self.entry_hour is not None:
         json_writable_dict[
             self.entry_hour_attribute_name] = Utils.hour_to_string(
                 self.entry_hour)
     if self.exit_hour is not None:
         json_writable_dict[
             self.exit_hour_attribute_name] = Utils.hour_to_string(
                 self.exit_hour)
     return json_writable_dict