Skip to content

Commit

Permalink
fix 'activity@category, description' parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
ederag committed Nov 26, 2019
1 parent 42d3c05 commit 50ab84d
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/hamster/lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,18 +383,12 @@ def parse_fact(text, phase=None, res=None, date=None):
return parse_fact(head, "activity", res, date)

if "activity" in phases:
activity = re.split("@", text, 1)[0]
activity, sep, category = text.partition('@')
if looks_like_time(activity):
# want meaningful activities
return res

res["activity"] = activity
remaining_text = remove_fragment(text, activity)
return parse_fact(remaining_text, "category", res, date)

if "category" in phases:
category, _, description = text.partition(",")
res["category"] = category.lstrip("@").strip() or None
res["category"] = category
return res

return {}
Expand Down

0 comments on commit 50ab84d

Please sign in to comment.