-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add ability for interactively explore project when calling `terka show project` command. * Simplify the codebase: * Add `is_stale`, `is_overdue` and `completion_date` properties to Task (and remove their calculation from `printer`) * Add `total_time_spent` property to project * Make `TerkaTask` view neater, remove not working `Comment` section * Add `formatter` module to extract formatting operations
- Loading branch information
1 parent
2993ead
commit 6f2620b
Showing
7 changed files
with
279 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
class Formatter: | ||
|
||
@staticmethod | ||
def calculate_time_spent(entity) -> str: | ||
time_spent_sum = sum( | ||
[entry.time_spent_minutes for entry in entity.time_spent]) | ||
return Formatter.format_time_spent(time_spent_sum) | ||
|
||
@staticmethod | ||
def format_time_spent(time_spent: int) -> str: | ||
time_spent_hours = time_spent // 60 | ||
time_spent_minutes = time_spent % 60 | ||
if time_spent_hours and time_spent_minutes: | ||
time_spent = f"{time_spent_hours}H:{time_spent_minutes}M" | ||
elif time_spent_hours: | ||
time_spent = f"{time_spent_hours}H:00M" | ||
elif time_spent_minutes: | ||
time_spent = f"00H:{time_spent_minutes}M" | ||
else: | ||
time_spent = "" | ||
return time_spent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.