From 40b54b27f414f32182c28c93fa59dc4a13ce565f Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Thu, 26 Jun 2025 14:50:11 -0400 Subject: [PATCH] [tasks] Actually add the new utils file --- vrobbler/apps/tasks/utils.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 vrobbler/apps/tasks/utils.py diff --git a/vrobbler/apps/tasks/utils.py b/vrobbler/apps/tasks/utils.py new file mode 100644 index 0000000..acd9d0e --- /dev/null +++ b/vrobbler/apps/tasks/utils.py @@ -0,0 +1,19 @@ +import logging + +from tasks.constants import TODOIST_TITLE_LABELS + + +logger = logging.getLogger(__name__) + +def get_title_from_labels(labels: list[str]) -> str: + title = "Unknown" + for label in labels: + if label in TODOIST_TITLE_LABELS: + title = label.capitalize() + + if title == "Unknown": + logger.warning( + "Missing a prefix and suffix tag for task", + extra={"labels": labels}, + ) + return title