fix: remove inflated confidence for unsynced results (impacts: sp, mxm-sp, local, lrclib, manual)
This commit is contained in:
@@ -10,6 +10,8 @@ from enum import Enum
|
|||||||
from typing import Optional, TYPE_CHECKING
|
from typing import Optional, TYPE_CHECKING
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
|
from lrx_cli.config import SCORE_W_SYNCED
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .lrc import LRCData
|
from .lrc import LRCData
|
||||||
|
|
||||||
@@ -67,3 +69,6 @@ class LyricResult:
|
|||||||
def __post_init__(self) -> None:
|
def __post_init__(self) -> None:
|
||||||
if self.status in (CacheStatus.NOT_FOUND, CacheStatus.NETWORK_ERROR):
|
if self.status in (CacheStatus.NOT_FOUND, CacheStatus.NETWORK_ERROR):
|
||||||
self.confidence = 0.0
|
self.confidence = 0.0
|
||||||
|
if self.status is CacheStatus.SUCCESS_UNSYNCED and self.confidence == 100.0:
|
||||||
|
# Fix: remove inflated confidence for unsynced results
|
||||||
|
self.confidence = 100 - SCORE_W_SYNCED
|
||||||
|
|||||||
+1
-1
@@ -314,7 +314,7 @@ def test_update_confidence_targets_specific_source(cache_db: CacheEngine) -> Non
|
|||||||
assert updated == 1
|
assert updated == 1
|
||||||
rows = {r["source"]: r for r in cache_db.query_track(track)}
|
rows = {r["source"]: r for r in cache_db.query_track(track)}
|
||||||
assert rows["s1"]["confidence"] == 75.0
|
assert rows["s1"]["confidence"] == 75.0
|
||||||
assert rows["s2"]["confidence"] == 100.0 # unchanged
|
assert rows["s2"]["confidence"] == 90.0 # unchanged (unsynced default)
|
||||||
|
|
||||||
|
|
||||||
def test_update_confidence_returns_zero_for_missing_source(
|
def test_update_confidence_returns_zero_for_missing_source(
|
||||||
|
|||||||
Reference in New Issue
Block a user