コード例 #1
0
 def create_today_and_tomorrow_dictionary():
     entry_hour = Utils.to_time("8:00")
     exit_hour = Utils.to_time("18:00")
     today = Day(date.today(), entry_hour, exit_hour)
     tomorrow = Day(date.today() + timedelta(days=1), entry_hour, exit_hour)
     days = dict()
     days[today.day_date] = today
     days[tomorrow.day_date] = tomorrow
     return days
コード例 #2
0
ファイル: day.py プロジェクト: mfernandriu/hour-monitor
 def create_from_json_dict(json_dict):
     day_date = Utils.to_date(json_dict[Day.day_date_attribute_name])
     if Day.entry_hour_attribute_name in json_dict.keys(
     ):  # todo refactor conditionals?
         entry_hour = Utils.to_time(
             json_dict[Day.entry_hour_attribute_name])
     else:
         entry_hour = None
     if Day.exit_hour_attribute_name in json_dict.keys():
         exit_hour = Utils.to_time(json_dict[Day.exit_hour_attribute_name])
     else:
         exit_hour = None
     return Day(day_date, entry_hour, exit_hour)
コード例 #3
0
 def update_exit_hour(self, day_date: str, new_exit_hour: str) -> None:
     day_date = Utils.to_date(day_date)
     new_exit_hour = Utils.to_time(new_exit_hour)
     day_to_update = self.days.get_day(day_date)
     day_to_update.exit_hour = new_exit_hour
     self.days.update_day(day_date, day_to_update)
コード例 #4
0
 def store_exit_hour(self, day_date: str, exit_hour: str) -> None:
     day_date = Utils.to_date(day_date)
     exit_hour = Utils.to_time(exit_hour)
     day_to_store = Day(day_date, exit_hour=exit_hour)
     self.store_day(day_date, day_to_store)