diff --git a/utt/components/report_args.py b/utt/components/report_args.py index c4c7f7b..3704a39 100644 --- a/utt/components/report_args.py +++ b/utt/components/report_args.py @@ -227,12 +227,6 @@ def parse_week(today, weekstring): return (start, end) -def week_dates(date): - week_start_date = date + datetime.timedelta(-date.weekday()) - week_end_date = date + datetime.timedelta(6 - date.weekday()) - return week_start_date, week_end_date - - DAY_NAMES = [ "MONDAY", "TUESDAY", diff --git a/utt/data_structures/activity.py b/utt/data_structures/activity.py index ac0b01f..cc969b8 100644 --- a/utt/data_structures/activity.py +++ b/utt/data_structures/activity.py @@ -33,21 +33,6 @@ def __init__( self.is_current_activity = is_current_activity self.comment = comment - def __eq__(self, other): - return ( - self.name == other.name - and self.start == other.start - and self.end == other.end - and self.duration == other.duration - and self.type == other.type - ) - - def __str__(self): - return "Activity(" + ", ".join(map(str, [self.name, self.start, self.end, self.duration, self.type])) + ")" - - def __repr__(self): - return self.__str__() - @staticmethod def _type_from_name(name): if name[-3:] == "***": diff --git a/utt/data_structures/name.py b/utt/data_structures/name.py index 79e941d..f5d8bb2 100644 --- a/utt/data_structures/name.py +++ b/utt/data_structures/name.py @@ -24,6 +24,3 @@ def __eq__(self, other): def __str__(self): return self.name - - def __repr__(self): - return "Name(" + ", ".join([self.name, self.task, self.project]) + ")" diff --git a/utt/report/common.py b/utt/report/common.py index 9f994f7..b2d3c38 100644 --- a/utt/report/common.py +++ b/utt/report/common.py @@ -16,35 +16,6 @@ def print_dicts(dcts: List[Dict], output: Output) -> None: print(format_string.format(**dict(context, **dct)), file=output) -def clip_activities_by_range( - start_date: datetime.date, - end_date: datetime.date, - activities: List[Activity], -) -> List[Activity]: - """Clip a list of Activity with the given range, remove activities - which have zero durations - - Parameters - ---------- - start_date : datetime.date - end_date : datetime.date - activities : list of Activity - - Returns - ------- - clipped: list of Activity - """ - delta = datetime.timedelta() - start_dt = datetime.datetime(start_date.year, start_date.month, start_date.day) - end_dt = datetime.datetime(end_date.year, end_date.month, end_date.day, 23, 59, 59, 99999) - new_activities = [] - for activity in activities: - clipped = activity.clip(start_dt, end_dt) - if clipped.duration > delta: - new_activities.append(clipped) - return new_activities - - def filter_activities_by_type(activities: List[Activity], activity_type: str) -> List[Activity]: """Filter a list of Activity with the given activity type. diff --git a/utt/report/per_day/csv_view.py b/utt/report/per_day/csv_view.py deleted file mode 100644 index 9a46af7..0000000 --- a/utt/report/per_day/csv_view.py +++ /dev/null @@ -1,25 +0,0 @@ -import csv - -from ...components.output import Output -from ..common import timedelta_to_billable -from .model import PerDayModel - - -class CSVPerDayView: - def __init__(self, model: PerDayModel): - self._model = model - - def render(self, output: Output) -> None: - if not self._model.dates: - print(" -- No activities for this time range --", file=output) - return - - fieldnames = ["date", "hours", "duration", "projects", "tasks"] - writer = csv.DictWriter(output, fieldnames=fieldnames) - - # Write header - writer.writerow({fn: fn.capitalize() for fn in fieldnames}) - - for date_activities in self._model.dates: - date_activities["hours"] = timedelta_to_billable(date_activities["hours"]).strip() - writer.writerow(date_activities)