-
Notifications
You must be signed in to change notification settings - Fork 0
Fix[#31]: 데일리 가중치 스케줄러와 사용자 가중치 동시 업데이트 시 업데이트 누락 방지 #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
7421da2
856a280
6ceac15
83402ef
bffe653
cd2b3b6
ff4ed7f
5963d46
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,6 @@ | ||
| from typing import List, Dict | ||
| from motor.motor_asyncio import AsyncIOMotorClient, AsyncIOMotorCollection | ||
| from pymongo import UpdateOne | ||
|
|
||
| from app.models import db_w2v_mapper | ||
| from motor.motor_asyncio import AsyncIOMotorClient, AsyncIOMotorCollection | ||
|
|
||
|
|
||
| class UserWeightRepository: | ||
|
|
@@ -15,7 +13,6 @@ def update_user_weights( | |
| ): | ||
| operations = [] | ||
| for meta_id, name in meta_info: | ||
| name = db_w2v_mapper.translate_genre(name) | ||
| operations.append( | ||
| UpdateOne( | ||
| {"user_id": user_id, "meta_info_id": meta_id}, | ||
|
|
@@ -36,8 +33,7 @@ async def update_user_weights_from_log(self, log: dict, weight: float): | |
| operations = [] | ||
|
|
||
| # 1. 장르 | ||
| for genre in meta_info.get("genres", []): | ||
| name = db_w2v_mapper.translate_genre(genre) | ||
| for name in meta_info.get("genres", []): | ||
| operations.append( | ||
| UpdateOne( | ||
| {"user_id": user_id, "name": name}, | ||
|
|
@@ -86,9 +82,9 @@ async def find_by_user_id(self, user_id: int) -> List[Dict]: | |
| results = await cursor.to_list(length=None) | ||
| return results | ||
|
|
||
| async def reset_weight(self, user_id: int, genre: str, weight: float): | ||
| filter = {"user_id": user_id, "name": genre} | ||
| update = {"$set": {"weight": weight}} | ||
| async def update_user_weight(self, user_id: int, meta_info_name: str, diff: float): | ||
| filter = {"user_id": user_id, "name": meta_info_name} | ||
|
||
| update = {"$inc": {"weight": diff}} | ||
| await self.collection.update_one(filter, update, upsert=True) | ||
|
|
||
| async def decrease_user_weights_from_log(self, log: dict, weight: float): | ||
|
|
@@ -97,8 +93,7 @@ async def decrease_user_weights_from_log(self, log: dict, weight: float): | |
|
|
||
| operations = [] | ||
|
|
||
| for genre in meta_info.get("genres", []): | ||
| name = db_w2v_mapper.translate_genre(genre) | ||
| for name in meta_info.get("genres", []): | ||
| operations.append( | ||
| UpdateOne( | ||
| {"user_id": user_id, "name": name}, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: reset_weight 메서드가 UserWeightRepository에서 제거되었는데
daily_wieght_resizer.py의 실패 로그 재시도 부분(124줄)에서 사용되고 있습니다! 확인 부탁드립니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
미처 확인하지 못한 부분이네요. 반영 완료했습니다!