-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement basic clocking support #302
base: master
Are you sure you want to change the base?
Conversation
Added four new commands: - Start clocking in the current heading - Stop last unfinished line in the current heading - Recalculate duration after manual change of clock line - Display total time for the current heading
Codecov Report
@@ Coverage Diff @@
## master #302 +/- ##
==========================================
- Coverage 84.38% 83.91% -0.47%
==========================================
Files 49 50 +1
Lines 6794 6863 +69
==========================================
+ Hits 5733 5759 +26
- Misses 1061 1104 +43
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've left some minor comments but in general LGTM ;)
from orgmode.py3compat.unicode_compatibility import * | ||
|
||
|
||
def get_total_time(heading): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use generators:
total = sum(clockline for clockline in heading.logbook if not clockline.finished)
return total + sum(get_total_time(child) for child in heading.logbook)
# -2 to skip heading itself and :LOGBOOK: | ||
clockline_index = position - current_heading.start - 2 | ||
|
||
if clockline_index < 0 or clockline_index >= len(current_heading.logbook): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
len(current_heading.logbook) <= clockline_index < 0
self.logbook.clear() | ||
for i, line in enumerate(self.document._content[self.start + 1:heading_end + 1]): | ||
line_date = _text2orgdate(line) | ||
if line_date is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if line_date:
is enough or if line_date is None: continue
with unindenting the current if block
Added four new commands:
Please review whether my changes fit your architecture and style guides :)