mirror of
https://github.com/Xevion/runnerspace.git
synced 2025-12-08 04:08:24 -06:00
Add like counter to user profile
- Also fixed some issue with get_post_count() method? Weird.
This commit is contained in:
@@ -53,11 +53,11 @@ class User(UserMixin, db.Model):
|
||||
|
||||
def get_post_count(self) -> int:
|
||||
"""Returns the number of posts this user has made."""
|
||||
return Post.query.filter_by(user_id=self.id).count()
|
||||
return Post.query.filter_by(author=self).count()
|
||||
|
||||
def get_comment_count(self) -> int:
|
||||
"""Returns the number of comments this user has made."""
|
||||
return Comment.query.filter_by(user_id=self.id).count()
|
||||
return Comment.query.filter_by(author=self).count()
|
||||
|
||||
def get_post_likes(self) -> int:
|
||||
"""Returns the number of likes this user's posts have accumulated."""
|
||||
|
||||
Reference in New Issue
Block a user