mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-26 19:14:30 +00:00
Removed wierd hack
This commit is contained in:
parent
bca8dc039a
commit
8d060af46c
@ -327,28 +327,22 @@ class UserAccountView(UserAccountBase):
|
|||||||
|
|
||||||
def expense_by_month(self, obj, calc):
|
def expense_by_month(self, obj, calc):
|
||||||
stats = []
|
stats = []
|
||||||
joined = self.object.date_joined.year
|
|
||||||
|
|
||||||
years = datetime.now().year - joined
|
for year in obj.datetimes('date', 'year', order='ASC'):
|
||||||
|
|
||||||
years = range(0, years + 1)
|
|
||||||
months = range(1, 12)
|
|
||||||
|
|
||||||
for y in years:
|
|
||||||
stats.append([])
|
stats.append([])
|
||||||
for m in months:
|
i = 0
|
||||||
|
for month in obj.filter(date__year=year.year).datetimes(
|
||||||
|
'date', 'month', order='ASC'):
|
||||||
q = obj.filter(
|
q = obj.filter(
|
||||||
date__year=joined + y,
|
date__year=month.year,
|
||||||
date__month=m,
|
date__month=month.month
|
||||||
)
|
)
|
||||||
stats[y].append(
|
stats[i].append((
|
||||||
(
|
|
||||||
sum([calc(p) for p in q]),
|
sum([calc(p) for p in q]),
|
||||||
date(joined + y, m, 17)
|
month
|
||||||
)
|
))
|
||||||
)
|
i += 1
|
||||||
|
|
||||||
print(stats)
|
|
||||||
return stats
|
return stats
|
||||||
|
|
||||||
def buyings_calc(self, query):
|
def buyings_calc(self, query):
|
||||||
|
Loading…
Reference in New Issue
Block a user