Changeset 3b76475 in flowtimer


Ignore:
Timestamp:
08/16/24 09:51:22 (9 months ago)
Author:
Enrico Schwass <ennoausberlin@…>
Branches:
guix
Children:
f959488
Parents:
37ae3b7
Message:

upcoming_phases() and time_left() added to Schedule

Location:
flowtimer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • flowtimer/RecurringPhaseSequence.py

    r37ae3b7 r3b76475  
    11import json
    22from copy import deepcopy
    3 from Phase import Phase
     3from flowtimer.Phase import Phase
    44
    55
  • flowtimer/Schedule.py

    r37ae3b7 r3b76475  
    4444
    4545    def time_left(self):
    46         return self.current_phase.time_left + sum([phase.time_left for phase in self.upcoming_phases])
     46        return self.current_phase.time_left + sum([phase.time_left for phase in self.upcoming_phases()])
    4747
    4848    def upcoming_phases(self):
    4949        index = self.phase_list.index(self.current_phase)
    50         return self.phase_list[index:]
     50        if index < len(self.phase_list):
     51            return self.phase_list[index+1:]
     52        return []
    5153
    5254    def current_phase_is_final(self):
Note: See TracChangeset for help on using the changeset viewer.