forked from rDrama/rDrama
fdsfds
parent
e1bbbe1ced
commit
2ac2718ee9
|
@ -74,7 +74,7 @@ def participation_stats(v):
|
||||||
@app.get("/chart")
|
@app.get("/chart")
|
||||||
@auth_required
|
@auth_required
|
||||||
def chart(v):
|
def chart(v):
|
||||||
days = int(request.values.get("day", 0))
|
days = int(request.values.get("days", 0))
|
||||||
file = cached_chart(days)
|
file = cached_chart(days)
|
||||||
return send_file(file)
|
return send_file(file)
|
||||||
|
|
||||||
|
@ -104,13 +104,13 @@ def cached_chart(days):
|
||||||
|
|
||||||
day_cutoffs.insert(0, calendar.timegm(now))
|
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]
|
daily_times = [time.strftime("%d/%m", time.gmtime(day_cutoffs[i + 1])) 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)][::-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]
|
||||||
|
|
||||||
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]
|
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]
|
||||||
|
|
||||||
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]
|
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]
|
||||||
|
|
||||||
plt.rcParams["figure.figsize"] = (20,20)
|
plt.rcParams["figure.figsize"] = (20,20)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue