From 50ab84d49cc35247d613b2f264d86614e4f3d479 Mon Sep 17 00:00:00 2001 From: ederag Date: Tue, 26 Nov 2019 18:10:49 +0100 Subject: [PATCH] fix 'activity@category, description' parsing --- src/hamster/lib/__init__.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/hamster/lib/__init__.py b/src/hamster/lib/__init__.py index e2e5c19e7..6c42fc341 100644 --- a/src/hamster/lib/__init__.py +++ b/src/hamster/lib/__init__.py @@ -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 {}