-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start working with ttrack integration
- Loading branch information
Showing
4 changed files
with
65 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
*.env* | ||
__pycache__ | ||
.vscode/ | ||
data_test/.timetrackdb |
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,34 @@ | ||
""" | ||
import sqlite3 | ||
from humanfriendly import format_timespan | ||
TTRACK_DB = 'data_test/.timetrackdb' | ||
def _get_list_of_tasks_entries_with_time_in_seconds(sql_database): | ||
conn = sqlite3.connect(sql_database) | ||
cur = conn.cursor() | ||
entries_with_seconds = [] | ||
for row in cur.execute(f"SELECT name, (end - start) FROM tasks AS T" | ||
" INNER JOIN tasklog AS L ON T.id=L.task" | ||
" ORDER BY name"): | ||
entries_with_seconds.append(row) | ||
return entries_with_seconds | ||
def _isolate_same_tasks_in_list(): | ||
entries = _get_list_of_tasks_entries_with_time_in_seconds(TTRACK_DB) | ||
same = {t:0 for t, s in entries} | ||
for task, secs in entries: | ||
same[task] += secs | ||
result = list(map(tuple, same.items())) | ||
return result | ||
def _return_index_of_tasks_in_hours(): | ||
tasks = _isolate_same_tasks_in_list() | ||
for t, s in tasks: | ||
print(f'{t} ---- {format_timespan(s)}') | ||
_return_index_of_tasks_in_hours() | ||
""" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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