72 lines
1.3 KiB
Python
72 lines
1.3 KiB
Python
from dataclasses import dataclass
|
|
from datetime import datetime, timedelta
|
|
|
|
from enums import ClockifyProjects, VetroProjects
|
|
|
|
|
|
@dataclass
|
|
class Activity:
|
|
"""Описывает одну активность, полученную из Clockify."""
|
|
|
|
id: str
|
|
author_id: int
|
|
vetro_project_id: VetroProjects
|
|
task_id: int
|
|
tag_id: str
|
|
description: str
|
|
project_id: ClockifyProjects
|
|
time_spent: float
|
|
date_start: datetime
|
|
date_end: datetime = None
|
|
is_tracked: bool = False
|
|
|
|
def __str__(self):
|
|
return f'({self.task_id}) - "{self.description}"'[:60]
|
|
|
|
|
|
@dataclass
|
|
class AggregatedActivity(Activity):
|
|
"""Представляет несколько активностей Clockify одной записью Redmine."""
|
|
|
|
source_activities: tuple[Activity, ...] = ()
|
|
|
|
|
|
@dataclass
|
|
class Tag:
|
|
id: str
|
|
title: str
|
|
|
|
def __str__(self):
|
|
return self.title
|
|
|
|
|
|
@dataclass
|
|
class ActivityType:
|
|
id: int
|
|
title: str
|
|
|
|
def __str__(self):
|
|
return self.title
|
|
|
|
@dataclass
|
|
class VetroProject:
|
|
id: str
|
|
title: str
|
|
|
|
def __str__(self):
|
|
return self.title
|
|
|
|
@dataclass
|
|
class Task:
|
|
id: int
|
|
subject: str
|
|
description: str
|
|
status: str
|
|
priority: str
|
|
author: str
|
|
tracker: str
|
|
project: str
|
|
|
|
def __str__(self):
|
|
return f"#{self.id}: {self.subject}"
|