ma conso added

This commit is contained in:
Qwann 2016-12-20 22:46:38 +01:00
parent 0c3c41a812
commit ccf7c4a484
5 changed files with 284 additions and 14 deletions

View file

@ -52,7 +52,7 @@ def daynames(dates):
# Pareil mais pour une liste de dates
# dans un dico ordonné
def weeksnames(dates):
def weeknames(dates):
names = {}
for i in dates:
names[i] = weekname(dates[i])
@ -89,11 +89,18 @@ def lastweeks(nb):
return mondays
# def lastmonths(nb):
# first_month_day = this_first_month_day()
# fisrt_days = {}
# for i in range(1, nb+1):
# days[i] =
def lastmonths(nb):
first_month_day = this_first_month_day()
first_days = {}
this_year = first_month_day.year
this_month = first_month_day.month
for i in range(1, nb+1):
month = this_month - (nb - i) % 12
year = this_year + (nb - i) // 12
first_days[i] = timezone.datetime(year=year,
month=month,
day=1)
return first_days
def this_first_month_day():