fix: surface settled-outcome calibration in saved snapshots
This commit is contained in:
@@ -665,6 +665,7 @@ def recalibrate_daily_card_confidence_payload(card_payload: dict[str, Any]) -> d
|
||||
payload = dict(card_payload)
|
||||
bucket_names = ('safe_singles', 'high_risk_singles', 'safe_parlays', 'sgp_lotteries')
|
||||
changed_count = 0
|
||||
market_calibrated_count = 0
|
||||
|
||||
for bucket_name in bucket_names:
|
||||
next_group: list[dict[str, Any]] = []
|
||||
@@ -706,15 +707,28 @@ def recalibrate_daily_card_confidence_payload(card_payload: dict[str, Any]) -> d
|
||||
factors.append('信心分數已套用新版資料品質校準')
|
||||
item['confidence_factors'] = factors[:8]
|
||||
item = _apply_recent_market_calibration(item)
|
||||
if any(str(check).startswith('近7天玩法校準') for check in (item.get('data_checks') or [])):
|
||||
market_calibrated_count += 1
|
||||
except Exception:
|
||||
pass
|
||||
next_group.append(item)
|
||||
payload[bucket_name] = next_group
|
||||
|
||||
if changed_count:
|
||||
if changed_count or market_calibrated_count:
|
||||
quality_summary = dict(payload.get('data_quality_summary') or {})
|
||||
quality_summary['confidence_recalibrated_items'] = changed_count
|
||||
if changed_count:
|
||||
quality_summary['confidence_recalibrated_items'] = changed_count
|
||||
if market_calibrated_count:
|
||||
quality_summary['recent_market_calibrated_count'] = market_calibrated_count
|
||||
payload['data_quality_summary'] = quality_summary
|
||||
if market_calibrated_count:
|
||||
summary = str(payload.get('summary') or '')
|
||||
calibration_summary = (
|
||||
f' 已套用近 7 天賽後玩法校準 {market_calibrated_count} 組,'
|
||||
'近期低命中玩法會自動提高門檻並縮小注碼。'
|
||||
)
|
||||
if '近 7 天賽後玩法校準' not in summary:
|
||||
payload['summary'] = f'{summary}{calibration_summary}'
|
||||
return payload
|
||||
|
||||
def _confidence_band(score: float, has_market_odds: bool, risk_level: str) -> str:
|
||||
|
||||
Reference in New Issue
Block a user