29 lines
536 B
Python
29 lines
536 B
Python
from dataclasses import dataclass
|
|
from datetime import datetime
|
|
|
|
|
|
@dataclass
|
|
class Activity:
|
|
id: str
|
|
task_id: int
|
|
task_title: str
|
|
description: str
|
|
time_spent: float
|
|
date: datetime = datetime.now()
|
|
|
|
@property
|
|
def is_tracked(self):
|
|
return self.description.startswith("*")
|
|
|
|
def __str__(self):
|
|
return f'{self.date}: {self.description.strip("*")} для задачи "{self.task_title}"'
|
|
|
|
|
|
@dataclass
|
|
class Tag:
|
|
id: str
|
|
title: str
|
|
|
|
def __str__(self):
|
|
return self.title
|