diff --git a/files/classes/submission.py b/files/classes/submission.py index 626453e82..a5bef9608 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -462,5 +462,4 @@ class SaveRelationship(Base): id=Column(Integer, primary_key=True) user_id=Column(Integer) submission_id=Column(Integer) - comment_id=Column(Integer) - type=Column(Integer) \ No newline at end of file + comment_id=Column(Integer) \ No newline at end of file diff --git a/files/classes/user.py b/files/classes/user.py index 3a9794a6d..1be1cfc80 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -551,12 +551,12 @@ class User(Base): @property @lazy def saved_count(self): - return g.db.query(SaveRelationship.submission_id).filter(SaveRelationship.user_id == self.id).count() + return g.db.query(SaveRelationship.submission_id).filter(SaveRelationship.user_id == self.id, SaveRelationship.submission_id != None).count() @property @lazy def saved_comment_count(self): - return g.db.query(SaveRelationship.comment_id).filter(SaveRelationship.user_id == self.id).count() + return g.db.query(SaveRelationship.comment_id).filter(SaveRelationship.user_id == self.id, SaveRelationship.comment_id != None).count() @lazy def saved_idlist(self, page=1): diff --git a/files/routes/comments.py b/files/routes/comments.py index 314dca141..630d0b753 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -876,10 +876,10 @@ def save_comment(cid, v): comment=get_comment(cid) - save=g.db.query(SaveRelationship).filter_by(user_id=v.id, comment_id=comment.id, type=2).one_or_none() + save=g.db.query(SaveRelationship).filter_by(user_id=v.id, comment_id=comment.id).one_or_none() if not save: - new_save=SaveRelationship(user_id=v.id, comment_id=comment.id, type=2) + new_save=SaveRelationship(user_id=v.id, comment_id=comment.id) g.db.add(new_save) try: g.db.commit() @@ -894,7 +894,7 @@ def unsave_comment(cid, v): comment=get_comment(cid) - save=g.db.query(SaveRelationship).filter_by(user_id=v.id, comment_id=comment.id, type=2).one_or_none() + save=g.db.query(SaveRelationship).filter_by(user_id=v.id, comment_id=comment.id).one_or_none() if save: g.db.delete(save) diff --git a/files/routes/posts.py b/files/routes/posts.py index ba1b22da1..857920d24 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -1254,10 +1254,10 @@ def save_post(pid, v): post=get_post(pid) - save = g.db.query(SaveRelationship).filter_by(user_id=v.id, submission_id=post.id, type=1).one_or_none() + save = g.db.query(SaveRelationship).filter_by(user_id=v.id, submission_id=post.id).one_or_none() if not save: - new_save=SaveRelationship(user_id=v.id, submission_id=post.id, type=1) + new_save=SaveRelationship(user_id=v.id, submission_id=post.id) g.db.add(new_save) g.db.commit() @@ -1270,7 +1270,7 @@ def unsave_post(pid, v): post=get_post(pid) - save = g.db.query(SaveRelationship).filter_by(user_id=v.id, submission_id=post.id, type=1).one_or_none() + save = g.db.query(SaveRelationship).filter_by(user_id=v.id, submission_id=post.id).one_or_none() if save: g.db.delete(save) diff --git a/files/templates/comments.html b/files/templates/comments.html index 02e7f3159..9dcc3777e 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -264,8 +264,10 @@ {% elif blackjack_status == 'lost' %} Lost {{wager}} Coins. {% elif blackjack_status == 'won' %} + {% set wager = wager|int*2 %} Won {{wager}} Coins. {% elif blackjack_status == 'blackjack' %} + {% set wager = wager|int*5/2 %} Blackjack! Won {{wager}} Coins.