Skip to content

Commit

Permalink
hot f
Browse files Browse the repository at this point in the history
  • Loading branch information
ohld committed Jun 1, 2024
1 parent 383df93 commit 2b4cdcb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/flows/rewards/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ async def get_all_uploaded_memes_weerly_ru() -> list[dict[str, Any]]:
S.added_by AS author_id,
U.nickname,
MS.nmemes_sent,
MS.nlikes * 1. / (MS.nlikes + MS.ndislikes) AS like_prc
MS.nlikes,
MS.ndislikes
FROM meme M
LEFT JOIN meme_source S
ON M.meme_source_id = S.id
Expand All @@ -29,6 +30,5 @@ async def get_all_uploaded_memes_weerly_ru() -> list[dict[str, Any]]:
AND M.created_at > NOW() - INTERVAL '7 days'
AND (UL.language_code = 'ru' OR M.language_code = 'ru')
AND MS.nmemes_sent >= 10
ORDER BY like_prc DESC
"""
return await fetch_all(text(select_statement))
2 changes: 1 addition & 1 deletion src/flows/rewards/uploaded_memes.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ async def reward_ru_users_for_weekly_top_uploaded_memes():

nuploaded = len(uploaded_memes)
nusers = len(set(m["author_id"] for m in uploaded_memes))
total_views = sum(m["nviews"] for m in uploaded_memes)
total_views = sum(m["nmemes_sent"] for m in uploaded_memes)
likes = sum(m["nlikes"] for m in uploaded_memes)
dislikes = sum(m["ndislikes"] for m in uploaded_memes)
avg_like = likes / (likes + dislikes) if likes + dislikes > 0 else 0
Expand Down
6 changes: 3 additions & 3 deletions src/storage/etl.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ async def insert_parsed_posts_from_ig(

for post in posts_to_update:
update_query = (
vk_posts.update()
.where(vk_posts.c.meme_source_id == meme_source_id)
.where(vk_posts.c.post_id == post["post_id"])
meme_raw_vk.update()
.where(meme_raw_vk.c.meme_source_id == meme_source_id)
.where(meme_raw_vk.c.post_id == post["post_id"])
.values(post)
)
await execute(update_query)
Expand Down

0 comments on commit 2b4cdcb

Please sign in to comment.