fix: 각 점수에 중요도 배율을 반영해 화면 점수와 순위를 일치시킴
This commit is contained in:
1 parent
621a0cf90d
commit
d5f8b148b4
12 files changed
+68
-33
No files matched your search
@@ -242,7 +242,7 @@ def _by_position(posts: list[Post]) -> list[Post]:
|
||||
|
||||
|
||||
def _tomorrow_best(board: IndexBoard, day: date) -> Optional[tuple[IndexItem, IndexScore]]:
|
||||
"""내일 하루 점수로 1위인 각과 그 점수 (점수 × 중요도)."""
|
||||
"""내일 하루 점수로 1위인 각과 그 점수 (동점이면 중요도 순)."""
|
||||
best = None
|
||||
for i in board.items:
|
||||
s = next((x for x in i.trend if x.score_date == day), None)
|
||||
@@ -340,7 +340,7 @@ class FeedService:
|
||||
now = now_kst()
|
||||
sunset_at = sun_times(now.date(), float(region.lat), float(region.lon)).sunset_at
|
||||
slot = slot_of(now, sunset_at)
|
||||
key = f"feed:{region.code}:time-weight-v2:{slot}"
|
||||
key = f"feed:{region.code}:priority-score-v4:{slot}"
|
||||
try:
|
||||
cached = await REDIS.conn.get(key)
|
||||
if cached:
|
||||
@@ -813,7 +813,7 @@ _CLOUDY = {Sky.CLEAR: 0.0, Sky.PARTLY: 0.5, Sky.CLOUDY: 1.0}
|
||||
|
||||
|
||||
def _day_gaks(board: Optional[IndexBoard], day: date, n: int = 3) -> list[WeekGak]:
|
||||
"""그날 대표 각: 각 상세의 날짜별 점수(하루 중 가장 좋은 시간대)를 점수 × 중요도 순으로."""
|
||||
"""그날 대표 각: 날짜별 표시 점수 내림차순, 동점이면 중요도 순으로."""
|
||||
scored = [(i.definition, s) for i in (board.items if board else []) for s in i.trend if s.score_date == day]
|
||||
scored.sort(key=lambda x: rank_score(x[1].score, x[0].priority), reverse=True)
|
||||
return [WeekGak(index_id=d.index_id, name=d.name, icon=d.icon, score=s.score) for d, s in scored[:n]]
|
||||
|
||||
Reference in new issue
Block a user