Skip to content

Commit 8536bfe

Browse files
Merge pull request #53 from dvklopfenstein/dev
Improved `report` output
2 parents 842b945 + 4c49d35 commit 8536bfe

File tree

7 files changed

+18
-12
lines changed

7 files changed

+18
-12
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# Summary
44
* [**Unreleased**](#unreleased)
5+
* [**Release 2025-05-18 v0.5a7**](#release-2025-05-18-v05a7) Add starttime to `report`; Bug fix in `cancel`
56
* [**Release 2025-05-16 v0.5a6**](#release-2025-05-16-v05a6) Add options to `projects` command; Fix `report` command
67
* [**Release 2025-05-15 v0.5a5**](#release-2025-05-15-v05a5) Report command tested and updated; Get csv files for a single user tested and implemented
78
* **Release 2025-05-14 v0.5a4** Optimized getting csv files to report locally or globally for a single user
@@ -29,6 +30,10 @@
2930

3031
## Unreleased
3132

33+
## Release 2025-05-18 v0.5a7
34+
* ADDED start time to `report` stdout
35+
* FIXED incorrect param order in `cancel`
36+
3237
## Release 2025-05-16 v0.5a6
3338
* ADDED `trk project` option, `--exists` to mark which projects exist
3439
* ADDED `trk project` option, `--rm-missing` to

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
77
[project]
88
name = "timetracker-csv"
99
description = "Pandas-friendly time tracking from the CLI"
10-
version = "0.5a6"
10+
version = "0.5a7"
1111
license = "AGPL-3.0-or-later"
1212
authors = [
1313
{name = 'DV Klopfenstein, PhD', email = 'dvklopfenstein@protonmail.com'},

timetracker/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
__copyright__ = 'Copyright (C) 2025-present, DV Klopfenstein, PhD. All rights reserved'
44
__author__ = 'DV Klopfenstein, PhD'
5-
__version__ = '0.5a6'
5+
__version__ = '0.5a7'
66

77
# Copyright (C) 2025-present, DV Klopfenstein, PhD. All rights reserved

timetracker/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def _add_subparser_csv(self, subparsers):
246246

247247
def _add_subparser_report(self, subparsers):
248248
parser = subparsers.add_parser(name='report',
249-
help='Generate an report for all time units and include cumulative time',
249+
help='Generate a project report for time units and include cumulative time',
250250
formatter_class=ArgumentDefaultsHelpFormatter)
251251
return parser
252252

timetracker/cmd/cancel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def run_cancel(cfgproj, name=None):
2525
debug(yellow('RUNNING COMMAND CANCEL'))
2626
start_obj = cfgproj.get_starttime_obj(name)
2727
if start_obj and exists(start_obj.filename):
28-
prt_elapsed(f'{str_cancelled1()}; was', start_obj)
28+
prt_elapsed(start_obj, f'{str_cancelled1()}; was')
2929
remove(start_obj.filename)
3030
return start_obj.filename
3131
print(str_not_running())

timetracker/epoch/text.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def _get_nto(has_activity, has_tags, pnum):
3737

3838
def get_fstr(has_activity, has_tags, pnum):
3939
"""Get formatting for printing to stdout"""
40-
lst = ['{Day:3}', '{Date:10}', '{Span:>5}', '{Total:5}']
40+
lst = ['{Day:3}', '{Date:10}', '{Start:8}', '{Span:>5}', '{Total:5}']
4141
if pnum:
4242
lst.append('{Sum:5}')
4343
if has_activity:
@@ -48,7 +48,7 @@ def get_fstr(has_activity, has_tags, pnum):
4848
return ' '.join(lst)
4949

5050
def _get_nto_fieldnames(has_activity, has_tags, pnum):
51-
lst = ['Day', 'Date', 'Span', 'Total']
51+
lst = ['Day', 'Date', 'Start', 'Span', 'Total']
5252
if pnum:
5353
lst.append('Sum')
5454
if has_activity:
@@ -80,7 +80,8 @@ def _get_dfmttd_at010(nto, nts):
8080
debug(white('timetext: _get_dfmttd_at010'))
8181
tot = timedelta()
8282
return [nto._make(_nttxt(ntd) +
83-
(str_td(tot:=tot+ntd.duration), ntd.activity, ntd.message))
83+
(str_td(tot:=tot+ntd.duration),
84+
ntd.activity, ntd.message))
8485
for ntd in nts]
8586

8687
def _get_dfmttd_at001(nto, nts):
@@ -100,10 +101,10 @@ def _get_dfmttd_at011(nto, nts):
100101
for ntd in nts]
101102

102103
def _nttxt(ntd):
103-
weekday = ntd.start_datetime.strftime('%a')
104-
startdt = ntd.start_datetime.strftime('%Y-%m-%d') ### FMTDT12HM)
105-
span = str_td(ntd.duration)
106-
return (weekday, startdt, f'{span}')
104+
return (ntd.start_datetime.strftime('%a'), # weekday
105+
ntd.start_datetime.strftime('%Y-%m-%d'), # FMTDT12HM
106+
ntd.start_datetime.strftime('%I:%M %p'),
107+
f'{str_td(ntd.duration)}') # span (HH:MM)
107108

108109
FUNCS = {
109110
( True, False, False): _get_dfmttd_at100,

timetracker/report.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
__author__ = "DV Klopfenstein, PhD"
55

66

7-
FMT_STDOUT = '{Day:3} {Date:10} {Span:5} {Total:>7} {Description}'
7+
FMT_STDOUT = '{Day:3} {Date:10} {Start:8} {Span:5} {Total:>7} {Description}'
88

99
def prt_basic(timefmtd):
1010
"""Prints a basic time report to stdout"""

0 commit comments

Comments
 (0)