コード例 #1
0
ファイル: models.py プロジェクト: heliodor/django-timetracker
    def activity_volumes_last_12_months(teams, year=None, month=None, activity=None):
        from timetracker.utils.calendar_utils import last12months
        if activity is None:
            return [0 for _ in range(12)]

        if year is None: # pragma: no cover
            year = datetime.today().year
        if month is None: # pragma: no cover
            month = datetime.today().month

        dates = last12months(year, month)
        return (
            ActivityEntry.activity_volumes(teams, date.year, date.month, activity) \
            for date in dates
        )
コード例 #2
0
ファイル: models.py プロジェクト: heliodor/django-timetracker
    def utilization_last_12_months(teams, year=None, month=None):
        from timetracker.utils.calendar_utils import last12months

        if year is None: # pragma: no cover
            year = datetime.today().year
        if month is None: # pragma: no cover
            month = datetime.today().month

        dates = last12months(year, month)
        utilization = OrderedDict()
        for date in dates:
            utilization[date] = ActivityEntry.utilization_calculation(
                teams, date.year, date.month
            )
        return utilization, dates