fix(scan): confidence percentage display × 100 bug

ConfidenceTile multipliait par 100 une valeur déjà 0-100 (résultat 7000%).
Aligne le composant sur la convention 0-100 utilisée partout dans le projet
(useGameProgress, ScanCard, ScanDetail, ResultScreen, model.ts).

Corrige aussi mockSeed (0.94 → 94, etc.) pour matcher la convention.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Yanis 2026-05-01 00:02:05 +02:00
parent 6232068208
commit 036bc83618
2 changed files with 9 additions and 7 deletions

View file

@ -3,6 +3,7 @@ import { View, StyleSheet, Text } from 'react-native';
import { ProgressCircle } from '@/components/ui/ProgressCircle';
interface ConfidenceTileProps {
/** Confidence as a 0100 percentage (matches Detection.confidence convention). */
confidence: number;
fillColor: string;
arcColor?: string;
@ -17,7 +18,8 @@ export function ConfidenceTile({
size = 64,
scoreSize = 18,
}: ConfidenceTileProps) {
const score = Math.round(confidence * 100);
const score = Math.round(confidence);
const progress = Math.min(1, Math.max(0, confidence / 100));
const stroke = arcColor ?? darken(fillColor, 0.32);
return (
@ -31,7 +33,7 @@ export function ConfidenceTile({
<ProgressCircle
size={size}
strokeWidth={Math.max(4, Math.round(size * 0.09))}
progress={confidence}
progress={progress}
color={stroke}
trackColor="rgba(255,255,255,0.35)"
/>

View file

@ -20,7 +20,7 @@ export function buildMockScans(): ScanRecord[] {
customName: 'Vigne du potager',
detection: {
result: 'vine',
confidence: 0.94,
confidence: 94,
diseaseClass: 'healthy',
cepageId: 'cabernet_sauvignon',
timestamp: Date.now(),
@ -41,7 +41,7 @@ export function buildMockScans(): ScanRecord[] {
locationCapturedAt: isoMinusDays(1),
detection: {
result: 'vine',
confidence: 0.81,
confidence: 81,
diseaseClass: 'esca',
diseaseSlug: 'esca',
cepageId: 'merlot',
@ -64,7 +64,7 @@ export function buildMockScans(): ScanRecord[] {
customName: 'Pinot du grand-père',
detection: {
result: 'vine',
confidence: 0.88,
confidence: 88,
diseaseClass: 'healthy',
cepageId: 'pinot_noir',
timestamp: Date.now() - 2 * 86_400_000,
@ -85,7 +85,7 @@ export function buildMockScans(): ScanRecord[] {
locationCapturedAt: isoMinusDays(3),
detection: {
result: 'uncertain',
confidence: 0.55,
confidence: 55,
diseaseClass: 'leaf_blight',
diseaseSlug: 'leaf-blight',
cepageId: 'chardonnay',
@ -107,7 +107,7 @@ export function buildMockScans(): ScanRecord[] {
locationCapturedAt: isoMinusDays(4),
detection: {
result: 'vine',
confidence: 0.76,
confidence: 76,
diseaseClass: 'black_rot',
diseaseSlug: 'black-rot',
cepageId: 'cabernet_sauvignon',