forked from MarseyWorld/MarseyWorld
fdsfsd
parent
14adf80e12
commit
12de3e0ab8
|
@ -99,18 +99,22 @@ def cached_chart(days):
|
|||
nowstamp = int(time.time())
|
||||
days = int((nowstamp - firstsignup) / 86400)
|
||||
|
||||
if days > 31: day_cutoffs = [today_cutoff - 86400 - 86400 * 7 * i for i in range(31)]
|
||||
else: day_cutoffs = [today_cutoff - 86400 * i for i in range(31)]
|
||||
if days > 31:
|
||||
day_cutoffs = [today_cutoff - 86400 * 7 * i for i in range(31)]
|
||||
cutoff = 2
|
||||
else:
|
||||
day_cutoffs = [today_cutoff - 86400 * i for i in range(31)]
|
||||
cutoff = 1
|
||||
|
||||
day_cutoffs.insert(0, calendar.timegm(now))
|
||||
|
||||
daily_times = [time.strftime("%d/%m", time.gmtime(day_cutoffs[i + 1])) for i in range(len(day_cutoffs) - 1)][1:][::-1]
|
||||
daily_times = [time.strftime("%d/%m", time.gmtime(day_cutoffs[i + 1])) for i in range(len(day_cutoffs) - 1)][cutoff:][::-1]
|
||||
|
||||
daily_signups = [g.db.query(User.id).filter(User.created_utc < day_cutoffs[i], User.created_utc > day_cutoffs[i + 1]).count() for i in range(len(day_cutoffs) - 1)][1:][::-1]
|
||||
daily_signups = [g.db.query(User.id).filter(User.created_utc < day_cutoffs[i], User.created_utc > day_cutoffs[i + 1]).count() for i in range(len(day_cutoffs) - 1)][cutoff:][::-1]
|
||||
|
||||
post_stats = [g.db.query(Submission.id).filter(Submission.created_utc < day_cutoffs[i], Submission.created_utc > day_cutoffs[i + 1], Submission.is_banned == False).count() for i in range(len(day_cutoffs) - 1)][1:][::-1]
|
||||
post_stats = [g.db.query(Submission.id).filter(Submission.created_utc < day_cutoffs[i], Submission.created_utc > day_cutoffs[i + 1], Submission.is_banned == False).count() for i in range(len(day_cutoffs) - 1)][cutoff:][::-1]
|
||||
|
||||
comment_stats = [g.db.query(Comment.id).filter(Comment.created_utc < day_cutoffs[i], Comment.created_utc > day_cutoffs[i + 1],Comment.is_banned == False, Comment.author_id != 1).count() for i in range(len(day_cutoffs) - 1)][1:][::-1]
|
||||
comment_stats = [g.db.query(Comment.id).filter(Comment.created_utc < day_cutoffs[i], Comment.created_utc > day_cutoffs[i + 1],Comment.is_banned == False, Comment.author_id != 1).count() for i in range(len(day_cutoffs) - 1)][cutoff:][::-1]
|
||||
|
||||
plt.rcParams["figure.figsize"] = (20,20)
|
||||
|
||||
|
|
Loading…
Reference in New Issue