forked from rDrama/rDrama
fsd
parent
1147a73132
commit
9043d95e7a
|
@ -1331,6 +1331,6 @@ def chart(v):
|
||||||
posts_chart.legend(loc='upper left', frameon=True)
|
posts_chart.legend(loc='upper left', frameon=True)
|
||||||
comments_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()
|
plt.clf()
|
||||||
return send_file("../chart.webp")
|
return send_file("../chart.png")
|
|
@ -1150,11 +1150,12 @@ def save_post(pid, v):
|
||||||
|
|
||||||
post=get_post(pid)
|
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)
|
if not save:
|
||||||
|
new_save=SaveRelationship(user_id=v.id, submission_id=post.id, type=1)
|
||||||
g.db.commit()
|
g.db.add(new_save)
|
||||||
|
g.db.commit()
|
||||||
|
|
||||||
return {"message": "Post saved!"}
|
return {"message": "Post saved!"}
|
||||||
|
|
||||||
|
@ -1165,7 +1166,7 @@ def unsave_post(pid, v):
|
||||||
|
|
||||||
post=get_post(pid)
|
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:
|
if save:
|
||||||
g.db.delete(save)
|
g.db.delete(save)
|
||||||
|
|
Loading…
Reference in New Issue