ziyadm / test-bot-repo

0 stars 0 forks source link

make a helper for calculating time in different #145

Open github-actions[bot] opened 1 year ago

github-actions[bot] commented 1 year ago

stages (code is mostly the same)

https://github.com/ziyadm/test-bot-repo/blob/58ffaf966d4712dd065a660a33d9804e622bbc11/mission.py#L198


    def time_in_stage(self, now: UtcTime) -> datetime.timedelta:
        return now.diff_to_nearest_second(self.fields.entered_stage_time)

    # TODO make a helper for calculating time in different
    # stages (code is mostly the same)
    def time_in_design(self) -> datetime.timedelta:
        completion_time = UtcTime.of_string(self.fields.design_completion_time)
        start_time = UtcTime.of_string(self.fields.start_time)
        return completion_time.diff_to_nearest_second(start_time)

    def time_in_design_review(self) -> datetime.timedelta:
        completion_time = UtcTime.of_string(self.fields.design_review_completion_time)
        start_time = UtcTime.of_string(self.fields.design_completion_time)
        return completion_time.diff_to_nearest_second(start_time)

    def time_in_code(self) -> datetime.timedelta:
        completion_time = UtcTime.of_string(self.fields.code_completion_time)
        start_time = UtcTime.of_string(self.fields.design_review_completion_time)
        return completion_time.diff_to_nearest_second(start_time)

    def time_in_code_review(self) -> datetime.timedelta:
        completion_time = UtcTime.of_string(self.fields.code_review_completion_time)
        start_time = UtcTime.of_string(self.fields.code_completion_time)
        return completion_time.diff_to_nearest_second(start_time)