eatgrass / obsidian-pomodoro-timer

A pomodoro timer that helps manage your daily focus
MIT License
127 stars 11 forks source link

Add the ability to log interrupted periods. #1

Closed Fertion closed 9 months ago

Fertion commented 9 months ago

For example, only 16 minutes out of 25 have passed, when the counter is reset, those 16 minutes are logged. Unfinished pomodoro are marked differently so that they can be counted

eatgrass commented 9 months ago

Hi! I understand that logging requirements can vary, so I am considering implementing a more generic approach, such as a log template. What do you think?

Fertion commented 9 months ago

Hi. Yeah, that sounds great.

Probably need the ability to create multiple templates then.

A template if the timer has expired. Template if the timer has been reset

eatgrass commented 9 months ago

@Fertion I've just released an update, and I believe this template script wil cover the case you mentioned. Modify it as necessary.

Please ensure that the Templater plugin is installed, as this script relies on it.

<%* 
if (log.mode == "WORK") {
  if (!log.finished) {
    tR = `🟡 Focused ${log.duration} / ${log.session} minutes`;
  } else {
    tR = `🍅 Focused ${log.duration} minutes`;
  }
} else {
  tR = `☕️ Took a break from ${log.begin.format("HH:mm")} to ${log.end.format(
    "HH:mm"
  )}`;
} 
%>

Here are some references that might be helpful:

Readme - Custom log template Templater - Documentation

Fertion commented 9 months ago

Just what I need, thanks. This works if you press button 1, but does not work if you press button 2 with the timer running. image

eatgrass commented 9 months ago

That was intentional actually. I plan to disable the mode switching while the timer is running to avoid any mix-ups and keep the timer from getting reset by mistake.