forked from rDrama/rDrama
fsd
parent
1147a73132
commit
9043d95e7a
|
@ -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")
|
|
@ -1150,10 +1150,11 @@ def save_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()
|
||||
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue