[tasks] Actually add the new utils file
This commit is contained in:
19
vrobbler/apps/tasks/utils.py
Normal file
19
vrobbler/apps/tasks/utils.py
Normal file
@ -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
|
||||
Reference in New Issue
Block a user