FEAT-4: sync inbreeding DTO to FEAT-1b InbreedingResult + anchor root card left so parents are visible on phone at load
Verified end-to-end against a DATA-2-contract mock (5-gen family, shared ancestor): phone/desktop, re-root, lazy expand, zoom/fit, print Ahnentafel, 404 state. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,20 +3,25 @@
|
||||
*
|
||||
* Der Inzuchtkoeffizient wird serverseitig über die VOLLE Ahnentiefe berechnet
|
||||
* (Board-Entscheidung; UI zeigt 4 Generationen, Koeffizient zählt alle).
|
||||
* Endpunkt entsteht in DATA-2-Folgearbeit — bis dahin antwortet er mit 404 und
|
||||
* die UI zeigt einen „wird berechnet …“-Zustand.
|
||||
* Endpunkt: FEAT-1b (InbreedingController, Wright-Pfadmethode).
|
||||
*/
|
||||
import { api, resources } from './client'
|
||||
|
||||
export interface InbreedingCoefficient {
|
||||
/** Koeffizient nach Wright, 0..1. */
|
||||
/** Spiegelt GerbilManagerWebAPI.Genetics.InbreedingResult. */
|
||||
export interface InbreedingResult {
|
||||
/** Koeffizient F nach Wright, 0..1. */
|
||||
coefficient: number
|
||||
/** F in Prozent (Server-Komfortfeld). */
|
||||
percent: number
|
||||
/** Tiefste bekannte Ahnen-Generation (Eltern = 1; 0 = keine erfasst). */
|
||||
generationsAvailable: number
|
||||
commonAncestors: { id: string; name: string; contribution: number }[]
|
||||
}
|
||||
|
||||
export async function getInbreedingCoefficient(gerbilId: string): Promise<number> {
|
||||
const raw = await api.get<InbreedingCoefficient | number>(
|
||||
const raw = await api.get<InbreedingResult | number>(
|
||||
`${resources.gerbils}/${gerbilId}/inbreeding-coefficient`,
|
||||
)
|
||||
// Defensiv: Endpunkt-Form ist noch nicht final (nacktes number vs. Objekt).
|
||||
// Defensiv gegen Vertragsdrift (nacktes number vs. Objekt).
|
||||
return typeof raw === 'number' ? raw : raw.coefficient
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user