def _create_link_with_month(mode, year, month, role): link = "/user/list#/?" month += 1 if role: link = "%srole=%s&" % (link, role) date = datetime.date(year, month, 1) start_date = first_day_of_month(date).strftime('%d-%m-%Y') stop_date = last_day_of_month(date).strftime('%d-%m-%Y') date = "%s - %s" % (start_date, stop_date) link = "%s%s=%s" % (link, mode, date) return link
def _get_expected(self, first_day_of_work): def first_day_of_next_month(date): next_month = h.next_month(date) return datetime.date(next_month.year, next_month.month, 1) months = [] day = first_day_of_work while day < self.end: month_expected = h.get_working_days(day, idate.last_day_of_month(day)) months.append(month_expected * 8) day = first_day_of_next_month(day) empty_months = len(self.months) - len(months) months = [0] * empty_months + months quarters = sum(months[0:3]), sum(months[3:]) return quarters, months