fix: 각 점수에 중요도 배율을 반영해 화면 점수와 순위를 일치시킴
This commit is contained in:
1 parent
621a0cf90d
commit
d5f8b148b4
12 files changed
+68
-33
No files matched your search
@@ -18,13 +18,17 @@ _FALL_FLOOR = exp(-0.5)
|
||||
# 편한 범위 안에서 최적값 ±이만큼은 100점 (기온 °, 습도 %p)
|
||||
_TEMP_PLATEAU = 2
|
||||
_HUMIDITY_PLATEAU = 5
|
||||
# 각 중요도(index_definition.priority)별 순위 가중치: 1=상 2=중 3=하. 순위만 바꾸고 보이는 점수는 그대로 둔다.
|
||||
PRIORITY_WEIGHT = {1: 1.0, 2: 0.85, 3: 0.7}
|
||||
|
||||
|
||||
def rank_score(score: int, priority: int) -> float:
|
||||
"""각 순위를 정하는 값 = 점수 × 중요도 가중치."""
|
||||
return score * PRIORITY_WEIGHT[priority]
|
||||
def priority_score(score: int, priority: int) -> int:
|
||||
"""중요도 배율을 한 번 적용하고 정수로 반올림한 표시·순위 공통 점수."""
|
||||
return round(score * PRIORITY_WEIGHT[priority])
|
||||
|
||||
|
||||
def rank_score(score: int, priority: int) -> tuple[int, int]:
|
||||
"""중요도 반영이 끝난 표시 점수 내림차순. 동점이면 중요도 순."""
|
||||
return score, -priority
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
|
||||
Reference in new issue
Block a user