forked from rDrama/rDrama
1
0
Fork 0
master
Aevann1 2021-09-24 18:18:55 +02:00
parent 1147a73132
commit 9043d95e7a
2 changed files with 8 additions and 7 deletions

View File

@ -1331,6 +1331,6 @@ def chart(v):
posts_chart.legend(loc='upper left', frameon=True)
comments_chart.legend(loc='upper left', frameon=True)
plt.savefig("chart.webp")
plt.savefig("chart.png")
plt.clf()
return send_file("../chart.webp")
return send_file("../chart.png")

View File

@ -1150,11 +1150,12 @@ def save_post(pid, v):
post=get_post(pid)
new_save=SaveRelationship(user_id=v.id, submission_id=post.id, type=1)
save = g.db.query(SaveRelationship).options(lazyload('*')).filter_by(user_id=v.id, submission_id=post.id, type=1).first()
g.db.add(new_save)
g.db.commit()
if not save:
new_save=SaveRelationship(user_id=v.id, submission_id=post.id, type=1)
g.db.add(new_save)
g.db.commit()
return {"message": "Post saved!"}
@ -1165,7 +1166,7 @@ def unsave_post(pid, v):
post=get_post(pid)
save=g.db.query(SaveRelationship).options(lazyload('*')).filter_by(user_id=v.id, submission_id=post.id, type=1).first()
save = g.db.query(SaveRelationship).options(lazyload('*')).filter_by(user_id=v.id, submission_id=post.id, type=1).first()
if save:
g.db.delete(save)