Report on hashtags, followed and unfollowed, complete.
This commit is contained in:
parent
c7757efbf6
commit
0c23956dd2
35
app/urma.py
35
app/urma.py
@ -311,6 +311,37 @@ def report():
|
||||
f"({like * 100 / (like + dislike):.2f}% liked)"
|
||||
)
|
||||
|
||||
# Find the least popular hashtags that we do follow
|
||||
print()
|
||||
print("Hashtags you follow that feature in posts you don't like")
|
||||
print("--------------------------------------------------------")
|
||||
bottom_followed_tags = (
|
||||
session.execute(
|
||||
select(Hashtags, func.count(Hashtags.name))
|
||||
.join(PostTags).join(Posts)
|
||||
.where(Posts.favourited == 0, Hashtags.followed == 1)
|
||||
.group_by(Hashtags.name)
|
||||
.order_by(func.count(Hashtags.name).desc())
|
||||
.limit(Config.TOP_HASHTAGS_TO_REPORT))
|
||||
.all()
|
||||
)
|
||||
|
||||
# How many times was each hashtag in a post we did like?
|
||||
for (hashtag, dislike) in bottom_followed_tags:
|
||||
like = (
|
||||
session.execute(
|
||||
select(func.count(Posts.id))
|
||||
.join(PostTags).join(Hashtags)
|
||||
.where(Posts.favourited == 1, Hashtags.id == hashtag.id)
|
||||
).scalars()
|
||||
.all()[0]
|
||||
)
|
||||
|
||||
print(
|
||||
f"Hashtag {hashtag.name} {like=}, {dislike=} "
|
||||
f"({dislike * 100 / (like + dislike):.2f}% disliked)"
|
||||
)
|
||||
|
||||
|
||||
def update_followed_accounts(session: Session, mastapi: MastodonAPI) -> None:
|
||||
"""
|
||||
@ -374,8 +405,8 @@ def update_followed_hashtags(session: Session, mastapi: MastodonAPI) -> None:
|
||||
set(our_followed_hashtags_d.keys()) -
|
||||
set(mast_followed_hashtags_d.keys())
|
||||
):
|
||||
hashtag = hashtags.get_or_create(
|
||||
session, name, our_followed_hashtags_d[username].name)
|
||||
hashtag = Hashtags.get_or_create(
|
||||
session, name, our_followed_hashtags_d[name].name)
|
||||
hashtag.followed = False
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user