|
@@ -7,12 +7,13 @@ from .mixins import TemplateMixin, SchemaMixin, DbMixin
|
|
|
from .milestones import Milestone
|
|
from .milestones import Milestone
|
|
|
from .sprints import Sprint
|
|
from .sprints import Sprint
|
|
|
from planner import db
|
|
from planner import db
|
|
|
|
|
+from planner.utils import Term
|
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass(repr=False)
|
|
@dataclass(repr=False)
|
|
|
class Item(TemplateMixin, SchemaMixin, DbMixin):
|
|
class Item(TemplateMixin, SchemaMixin, DbMixin):
|
|
|
cache_keys = ('name', 'milestone_id', 'sprint_id')
|
|
cache_keys = ('name', 'milestone_id', 'sprint_id')
|
|
|
- template_term = """{{ obj.name }} {{ Fore.MAGENTA }}{{ obj.short_uuid }}{{ Style.RESET_ALL }}
|
|
|
|
|
|
|
+ template_term = """{{ obj.name }} {{ Term.uuid(obj.short_uuid) }} ({{ obj.term_priority }}, {{ obj.term_length }})
|
|
|
{% for comment in obj.comments %}
|
|
{% for comment in obj.comments %}
|
|
|
{{- comment.as_term }}
|
|
{{- comment.as_term }}
|
|
|
{%- endfor %}"""
|
|
{%- endfor %}"""
|
|
@@ -111,6 +112,25 @@ class Item(TemplateMixin, SchemaMixin, DbMixin):
|
|
|
|
|
|
|
|
return category_to_kls[document.get('category')]
|
|
return category_to_kls[document.get('category')]
|
|
|
|
|
|
|
|
|
|
+ @property
|
|
|
|
|
+ def term_priority(self):
|
|
|
|
|
+ if '-' in self.priority:
|
|
|
|
|
+ return Term.not_important(self.priority)
|
|
|
|
|
+ elif '+' in self.priority:
|
|
|
|
|
+ return Term.important(self.priority)
|
|
|
|
|
+ else:
|
|
|
|
|
+ return Term.mildly_important(self.priority)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ @property
|
|
|
|
|
+ def term_length(self):
|
|
|
|
|
+ if self.length in ['minutes', 'hours']:
|
|
|
|
|
+ return Term.not_important(self.length)
|
|
|
|
|
+ elif self.length in ['weeks', 'months']:
|
|
|
|
|
+ return Term.important(self.length)
|
|
|
|
|
+ else:
|
|
|
|
|
+ return Term.mildly_important(self.length or '')
|
|
|
|
|
+
|
|
|
def __repr__(self):
|
|
def __repr__(self):
|
|
|
return "{}(name='{}', milestone='{}')".format(self.__class__.__qualname__, self.name, repr(self.milestone))
|
|
return "{}(name='{}', milestone='{}')".format(self.__class__.__qualname__, self.name, repr(self.milestone))
|
|
|
|
|
|