yagarea / Stopro

A simple utility which will help you with self control and build work ethic

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug when starting without existing state.yml and not locking

Yokto13 opened this issue · comments

Bug Description:
When I run Stopro without existing state.yml file and then stop it without locking in between, crash occurs.
Crash occurs because dateutil parser cannot parse 'locked_since' being 0.

Steps to Reproduce:

  1. delete state.yml
  2. start Stopro
  3. stop Stopro

The failing line is:

src/lock.py", line 28, in is_unlock_allowed
    can_be_open_after = parser.parse(state["lock"]["locked_since"]) + timedelta(seconds=state["lock"]["locked_for"])
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I'll try to fix this and submit a PR.