This commit is contained in:
parent
3b0aedf959
commit
5f8ec549df
|
@ -25,7 +25,7 @@
|
|||
- services: views are not stored in core db anymore
|
||||
- schema: snake case in model fields names
|
||||
- schema: no DateTime scalar
|
||||
- resolvers: get_my_feed comments filter reactions body.is_not("")
|
||||
- resolvers: get_my_feed comments filter reactions body.is_not('')
|
||||
- resolvers: get_my_feed query fix
|
||||
- resolvers: LoadReactionsBy.days -> LoadReactionsBy.time_ago
|
||||
- resolvers: LoadShoutsBy.days -> LoadShoutsBy.time_ago
|
||||
|
|
|
@ -29,7 +29,7 @@ class ReactionKind(Enumeration):
|
|||
class Reaction(Base):
|
||||
__tablename__ = "reaction"
|
||||
|
||||
body = Column(String, nullable=True, comment="Reaction Body")
|
||||
body = Column(String, default='', comment="Reaction Body")
|
||||
created_at = Column(Integer, nullable=False, default=lambda: int(time.time()))
|
||||
created_by = Column(ForeignKey("author.id"), nullable=False, index=True)
|
||||
updated_at = Column(Integer, nullable=True, comment="Updated at")
|
||||
|
|
|
@ -39,7 +39,7 @@ def add_author_stat_columns(q):
|
|||
# )
|
||||
|
||||
q = q.add_columns(literal(0).label("commented_stat"))
|
||||
# q = q.outerjoin(Reaction, and_(Reaction.created_by == Author.id, Reaction.body.is_not(None))).add_columns(
|
||||
# q = q.outerjoin(Reaction, and_(Reaction.created_by == Author.id, Reaction.body.is_not(''))).add_columns(
|
||||
# func.count(distinct(Reaction.id)).label('commented_stat')
|
||||
# )
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ def add_community_stat_columns(q):
|
|||
# )
|
||||
|
||||
q = q.add_columns(literal(0).label("commented_stat"))
|
||||
# q = q.outerjoin(Reaction, and_(Reaction.created_by == Author.id, Reaction.body.is_not(None))).add_columns(
|
||||
# q = q.outerjoin(Reaction, and_(Reaction.created_by == Author.id, Reaction.body.is_not(''))).add_columns(
|
||||
# func.count(distinct(Reaction.id)).label('commented_stat')
|
||||
# )
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ def add_reaction_stat_columns(q):
|
|||
|
||||
q = q.outerjoin(aliased_reaction, Reaction.id == aliased_reaction.reply_to).add_columns(
|
||||
func.sum(aliased_reaction.id).label("reacted_stat"),
|
||||
func.sum(case((aliased_reaction.body.is_not(None), 1), else_=0)).label("commented_stat"),
|
||||
func.sum(case((aliased_reaction.body.is_not(''), 1), else_=0)).label("commented_stat"),
|
||||
func.sum(
|
||||
case(
|
||||
(aliased_reaction.kind == ReactionKind.AGREE, 1),
|
||||
|
@ -91,7 +91,7 @@ def is_published_author(session, author_id):
|
|||
return (
|
||||
session.query(Shout)
|
||||
.where(Shout.authors.contains(author_id))
|
||||
.filter(and_(Shout.published_at.is_not(None), Shout.deleted_at.is_(None)))
|
||||
.filter(and_(Shout.published_at.is_not(''), Shout.deleted_at.is_(None)))
|
||||
.count()
|
||||
> 0
|
||||
)
|
||||
|
|
|
@ -21,7 +21,7 @@ def add_stat_columns(q):
|
|||
func.sum(
|
||||
case(
|
||||
# do not count comments' reactions
|
||||
(aliased_reaction.body.is_not(""), 0),
|
||||
(aliased_reaction.body.is_not(''), 0),
|
||||
(aliased_reaction.kind == ReactionKind.AGREE, 1),
|
||||
(aliased_reaction.kind == ReactionKind.DISAGREE, -1),
|
||||
(aliased_reaction.kind == ReactionKind.PROOF, 1),
|
||||
|
|
Loading…
Reference in New Issue
Block a user