To test the production for prediction issue2

This commit is contained in:
Your Name 2026-07-26 00:47:15 +02:00
parent 764e3fcb7c
commit 1d8d228341
3 changed files with 29 additions and 4 deletions

View File

@ -571,6 +571,14 @@ export async function updateAdminConfig(body: Record<string, unknown>) {
: undefined,
});
// Global enable toggles should win over stale per-interval "on/off" overrides.
if (
typeof body.tieToleranceMinEnabled === 'boolean' ||
typeof body.tieToleranceMaxEnabled === 'boolean'
) {
await repo.clearIntervalNeutralityEnabledOverrides();
}
if (config.redis.enabled) {
const activeIntervals = await loadResolvedIntervals(updated, true);
await Promise.all(

View File

@ -208,6 +208,19 @@ export async function updateConfig(update: ConfigUpdate): Promise<CandlePredictC
return rows[0];
}
/**
* Clear per-interval enable overrides so global Neutral round toggles take effect.
* Interval rows keep optional percent overrides; only the boolean enables are reset to inherit.
*/
export async function clearIntervalNeutralityEnabledOverrides(): Promise<void> {
await query(
`UPDATE candle_predict_intervals
SET tie_tolerance_min_enabled = NULL,
tie_tolerance_max_enabled = NULL,
updated_at = NOW()`
);
}
export async function getRoundByOpenMs(
openMs: number,
intervalMinutes: number

View File

@ -18,10 +18,12 @@ export function AdminPoolInsights({ config, interval, round }: Props) {
const parts: string[] = [];
const tieTolerancePercent = interval.tieTolerancePercent ?? config.tieTolerancePercent ?? 0;
const tieToleranceMaxPercent = interval.tieToleranceMaxPercent ?? config.tieToleranceMaxPercent ?? 100;
// Prefer resolved interval flags (same as settlement). Do not default to "on"
// when the global catalog explicitly disabled the rules.
const tieToleranceMinEnabled =
interval.tieToleranceMinEnabled ?? config.tieToleranceMinEnabled ?? true;
interval.tieToleranceMinEnabled ?? config.tieToleranceMinEnabled ?? false;
const tieToleranceMaxEnabled =
interval.tieToleranceMaxEnabled ?? config.tieToleranceMaxEnabled ?? true;
interval.tieToleranceMaxEnabled ?? config.tieToleranceMaxEnabled ?? false;
if (tieToleranceMinEnabled) {
parts.push(t('candlePredict.adminInsights.neutralMin', { percent: tieTolerancePercent }));
@ -31,7 +33,9 @@ export function AdminPoolInsights({ config, interval, round }: Props) {
}
const neutralityRulesSummary =
parts.length > 0 ? parts.join(' · ') : t('candlePredict.adminInsights.neutralNone');
parts.length > 0
? `${parts.join(' · ')}. ${t('candlePredict.adminInsights.neutralBehavior')}`
: t('candlePredict.adminInsights.neutralNone');
const poolWinnerLabel =
config.poolWinnerRule === 'majority'
@ -48,7 +52,7 @@ export function AdminPoolInsights({ config, interval, round }: Props) {
<Chip size="small" label={poolWinnerLabel} color="warning" />
</Stack>
<Typography variant="body2" sx={{ opacity: 0.85 }}>
{neutralityRulesSummary}. {t('candlePredict.adminInsights.neutralBehavior')}
{neutralityRulesSummary}
</Typography>
<Typography variant="caption" sx={{ display: 'block', mt: 0.75, opacity: 0.65 }}>
{t('candlePredict.adminInsights.footer')}