Compare commits
1 Commits
feature/d7
...
feature/li
| Author | SHA1 | Date | |
|---|---|---|---|
| 03f8e4de90 |
30
gerbil-manager-web/e2e/juvenile-details.spec.ts
Normal file
30
gerbil-manager-web/e2e/juvenile-details.spec.ts
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
/** LITTER-JUVENILE-DETAILS: Jungtier-Felder (Farbschlag/Abgabe/Verstorben) im Wurf-Detail. */
|
||||||
|
import { de, expect, skipUnlessMock, test } from './fixtures'
|
||||||
|
|
||||||
|
const t = de.pages.litters
|
||||||
|
|
||||||
|
test('Jungtier-Liste zeigt Farbschlag, Abgabedatum, Abnehmer, Todesdatum und Todesursache', async ({
|
||||||
|
page,
|
||||||
|
}) => {
|
||||||
|
skipUnlessMock()
|
||||||
|
await page.goto('/wuerfe/w-kruemel')
|
||||||
|
await expect(page.getByRole('heading', { name: 'Wurf K' })).toBeVisible()
|
||||||
|
|
||||||
|
// Krümel: Active, colorVarietyId cv-agouti → Farbschlag 'Agouti'
|
||||||
|
const kruemelCard = page.getByRole('link', { name: /Krümel/ })
|
||||||
|
await expect(kruemelCard).toBeVisible()
|
||||||
|
await expect(kruemelCard).toContainText(`${t.detail.juvenileFields.colorVariety}: Agouti`)
|
||||||
|
|
||||||
|
// Pippa: GivenAway, Gold, goHomeDate 2025-05-01, Abnehmer Familie Huber
|
||||||
|
const pippaCard = page.getByRole('link', { name: /Pippa/ })
|
||||||
|
await expect(pippaCard).toBeVisible()
|
||||||
|
await expect(pippaCard).toContainText(`${t.detail.juvenileFields.colorVariety}: Gold`)
|
||||||
|
await expect(pippaCard).toContainText(t.detail.juvenileFields.goHomeDate)
|
||||||
|
await expect(pippaCard).toContainText(`${t.detail.juvenileFields.receiver}: Familie Huber`)
|
||||||
|
|
||||||
|
// Benny: Deceased, no colorVarietyId, dateOfDeath + causeOfDeath
|
||||||
|
const bennyCard = page.getByRole('link', { name: /Benny/ })
|
||||||
|
await expect(bennyCard).toBeVisible()
|
||||||
|
await expect(bennyCard).toContainText(t.detail.juvenileFields.dateOfDeath)
|
||||||
|
await expect(bennyCard).toContainText(`${t.detail.juvenileFields.causeOfDeath}: Altersschwäche`)
|
||||||
|
})
|
||||||
@@ -151,6 +151,19 @@ export function seedDb(): MockDb {
|
|||||||
enclosureId: 'enc-leer',
|
enclosureId: 'enc-leer',
|
||||||
notes: 'neugieriger Entdecker',
|
notes: 'neugieriger Entdecker',
|
||||||
},
|
},
|
||||||
|
// LITTER-JUVENILE-DETAILS: Jungtiere für Wurf K mit Zusatzinfos.
|
||||||
|
{
|
||||||
|
...gerbil('pup-abgabe', 'Pippa', 'female', '2025-03-12', 'w-kruemel', 'cv-gold'),
|
||||||
|
status: 'GivenAway' as const,
|
||||||
|
goHomeDate: '2025-05-01',
|
||||||
|
receiverContactId: 'con-huber',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
...gerbil('pup-verstorben', 'Benny', 'male', '2025-03-12', 'w-kruemel', null),
|
||||||
|
status: 'Deceased' as const,
|
||||||
|
dateOfDeath: '2025-04-15',
|
||||||
|
causeOfDeath: 'Altersschwäche',
|
||||||
|
},
|
||||||
// UI-POLISH-1: Import-Stub ohne Namen — testet den '(ohne Namen)'-Platzhalter in Liste + Detail.
|
// UI-POLISH-1: Import-Stub ohne Namen — testet den '(ohne Namen)'-Platzhalter in Liste + Detail.
|
||||||
gerbil('nameless-stub', '', 'male', '2023-01-01', null, null),
|
gerbil('nameless-stub', '', 'male', '2023-01-01', null, null),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
import { useMemo } from 'react'
|
import { useCallback, useMemo } from 'react'
|
||||||
import { Link, useParams } from 'react-router-dom'
|
import { Link, useParams } from 'react-router-dom'
|
||||||
import { de } from '../strings/de'
|
import { de } from '../strings/de'
|
||||||
import { getLitter } from '../api/litters'
|
import { getLitter } from '../api/litters'
|
||||||
import { getGerbil, listGerbils } from '../api/gerbils'
|
import { getGerbil, listGerbils } from '../api/gerbils'
|
||||||
|
import { listColorVarieties, listContacts } from '../api/lookups'
|
||||||
import { condition } from '../api/gridify'
|
import { condition } from '../api/gridify'
|
||||||
import { useApi } from '../hooks/useApi'
|
import { useApi } from '../hooks/useApi'
|
||||||
import { formatDate } from '../format/labels'
|
import { formatDate, genderLabel } from '../format/labels'
|
||||||
import { isValidGenotype } from '../format/genotypeText'
|
import { isValidGenotype } from '../format/genotypeText'
|
||||||
import { breed, fromDisplayString, type BreedingResult } from '../genetics'
|
import { breed, fromDisplayString, genotypeToFarbschlag, UNKNOWN_FARBSCHLAG, type BreedingResult } from '../genetics'
|
||||||
import BreedingResultView from '../components/BreedingResultView'
|
import BreedingResultView from '../components/BreedingResultView'
|
||||||
|
|
||||||
export default function WurfDetailPage() {
|
export default function WurfDetailPage() {
|
||||||
@@ -43,6 +44,38 @@ export default function WurfDetailPage() {
|
|||||||
return breed(fromDisplayString(fg), fromDisplayString(mg))
|
return breed(fromDisplayString(fg), fromDisplayString(mg))
|
||||||
}, [father.data, mother.data])
|
}, [father.data, mother.data])
|
||||||
|
|
||||||
|
// Farbschlag + Abnehmer lookups for the juvenile list.
|
||||||
|
const colorVarieties = useApi(() => listColorVarieties(), [])
|
||||||
|
const contacts = useApi(() => listContacts(), [])
|
||||||
|
|
||||||
|
const colorNameById = useMemo(
|
||||||
|
() => new Map((colorVarieties.data ?? []).map((c) => [c.id, c.name])),
|
||||||
|
[colorVarieties.data],
|
||||||
|
)
|
||||||
|
const contactNameById = useMemo(
|
||||||
|
() => new Map((contacts.data ?? []).map((c) => [c.id, c.name])),
|
||||||
|
[contacts.data],
|
||||||
|
)
|
||||||
|
|
||||||
|
const farbschlagOf = useCallback(
|
||||||
|
(g: { colorVarietyId: string | null; genotype: string | null }): string | null => {
|
||||||
|
if (g.colorVarietyId) {
|
||||||
|
const name = colorNameById.get(g.colorVarietyId)
|
||||||
|
if (name) return name
|
||||||
|
}
|
||||||
|
if (g.genotype?.trim()) {
|
||||||
|
try {
|
||||||
|
const name = genotypeToFarbschlag(fromDisplayString(g.genotype))
|
||||||
|
return name === UNKNOWN_FARBSCHLAG ? null : name
|
||||||
|
} catch {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
},
|
||||||
|
[colorNameById],
|
||||||
|
)
|
||||||
|
|
||||||
if (litter.loading) return <p className="muted">{de.common.loading}</p>
|
if (litter.loading) return <p className="muted">{de.common.loading}</p>
|
||||||
if (litter.error || !litter.data) {
|
if (litter.error || !litter.data) {
|
||||||
return (
|
return (
|
||||||
@@ -117,14 +150,24 @@ export default function WurfDetailPage() {
|
|||||||
{!juveniles.loading && registered === 0 && <p className="muted">{t.detail.noJuveniles}</p>}
|
{!juveniles.loading && registered === 0 && <p className="muted">{t.detail.noJuveniles}</p>}
|
||||||
{registered > 0 && (
|
{registered > 0 && (
|
||||||
<ul className="card-list">
|
<ul className="card-list">
|
||||||
{(juveniles.data?.items ?? []).map((g) => (
|
{(juveniles.data?.items ?? []).map((g) => {
|
||||||
<li key={g.id}>
|
const farbe = farbschlagOf(g)
|
||||||
<Link to={`/rennmaeuse/${g.id}`} className="gerbil-card">
|
const receiver = g.receiverContactId ? contactNameById.get(g.receiverContactId) : null
|
||||||
<span className="gerbil-card__name">{g.name}</span>
|
const tJf = t.detail.juvenileFields
|
||||||
<span className="gerbil-card__meta">{de.pages.gerbils.genderLabels[g.gender]}</span>
|
return (
|
||||||
</Link>
|
<li key={g.id}>
|
||||||
</li>
|
<Link to={`/rennmaeuse/${g.id}`} className="gerbil-card">
|
||||||
))}
|
<span className="gerbil-card__name">{g.name}</span>
|
||||||
|
<span className="gerbil-card__meta">{genderLabel(g.gender)}</span>
|
||||||
|
{farbe && <span className="gerbil-card__meta">{tJf.colorVariety}: {farbe}</span>}
|
||||||
|
{g.goHomeDate && <span className="gerbil-card__meta">{tJf.goHomeDate}: {formatDate(g.goHomeDate)}</span>}
|
||||||
|
{receiver && <span className="gerbil-card__meta">{tJf.receiver}: {receiver}</span>}
|
||||||
|
{g.dateOfDeath && <span className="gerbil-card__meta">{tJf.dateOfDeath}: {formatDate(g.dateOfDeath)}</span>}
|
||||||
|
{g.causeOfDeath && <span className="gerbil-card__meta">{tJf.causeOfDeath}: {g.causeOfDeath}</span>}
|
||||||
|
</Link>
|
||||||
|
</li>
|
||||||
|
)
|
||||||
|
})}
|
||||||
</ul>
|
</ul>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
@@ -189,6 +189,14 @@ export const de = {
|
|||||||
edit: 'Bearbeiten',
|
edit: 'Bearbeiten',
|
||||||
back: 'Zurück zur Liste',
|
back: 'Zurück zur Liste',
|
||||||
notFound: 'Dieser Wurf wurde nicht gefunden.',
|
notFound: 'Dieser Wurf wurde nicht gefunden.',
|
||||||
|
// LITTER-JUVENILE-DETAILS: pro-Jungtier-Felder
|
||||||
|
juvenileFields: {
|
||||||
|
colorVariety: 'Farbschlag',
|
||||||
|
goHomeDate: 'Abgegeben',
|
||||||
|
receiver: 'Abnehmer',
|
||||||
|
dateOfDeath: 'Verstorben',
|
||||||
|
causeOfDeath: 'Todesursache',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
// Formular
|
// Formular
|
||||||
form: {
|
form: {
|
||||||
|
|||||||
@@ -102,9 +102,9 @@
|
|||||||
{
|
{
|
||||||
"name": "Skarlett von den Kleinen Chaoten",
|
"name": "Skarlett von den Kleinen Chaoten",
|
||||||
"dob": "14.07.2013",
|
"dob": "14.07.2013",
|
||||||
"decision": "birth 2013 + 4 years = death year 2017, no exact date → year-only convention (01.01.2017). Previous entry (17.04.2016) was wrong.",
|
"decision": "death date = 17.04.2016 (the '2018' variant was wrong — it had leaked as '/ +2018' into the genotype field; parse-leak already fixed in IMPORT-POLISH)",
|
||||||
"dateOfDeath": "01.01.2017",
|
"dateOfDeath": "17.04.2016",
|
||||||
"source": "Julian 2026-06-07 — HUMANQUESTION D7 (final Skarlett resolution)"
|
"source": "Julian 2026-06-07 — HUMANQUESTION D6"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Kazu von den Kleinen Chaoten",
|
"name": "Kazu von den Kleinen Chaoten",
|
||||||
@@ -162,57 +162,6 @@
|
|||||||
"decision": "Sterbedatum = 18.12.2020 (die 01.10.2020-Variante war falsch); Gencode war einig, taub-Flag bleibt via 'Vorhandensein gewinnt'",
|
"decision": "Sterbedatum = 18.12.2020 (die 01.10.2020-Variante war falsch); Gencode war einig, taub-Flag bleibt via 'Vorhandensein gewinnt'",
|
||||||
"dateOfDeath": "18.12.2020",
|
"dateOfDeath": "18.12.2020",
|
||||||
"source": "Julian/Züchterin 2026-06-07 — HUMANQUESTION D7"
|
"source": "Julian/Züchterin 2026-06-07 — HUMANQUESTION D7"
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Max von Privat",
|
|
||||||
"dob": "01.02.2013",
|
|
||||||
"decision": "Genotyp von der Züchterin bestätigt (D-=D-, P=PP); Todesjahr 2014 (kein genaues Datum → Jahr-only-Konvention 01.01.2014). Reject 4 on-file-Varianten: 04.02.2016 / 04.03.2016 / 2014-raw / 30.12.2015.",
|
|
||||||
"genotype": "aa c[chm]c[chm] D- EE GG PP spsp",
|
|
||||||
"dateOfDeath": "01.01.2014",
|
|
||||||
"source": "Julian/Züchterin 2026-06-07 — HUMANQUESTION D7 (resolved)"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Isa of Golden Lights",
|
|
||||||
"dob": "24.12.2014",
|
|
||||||
"decision": "Sterbedatum von der Züchterin (DOB-key war im extract teils leer; diese Zeile matcht die konfliktbehaftete Zeile mit dob=24.12.2014)",
|
|
||||||
"dateOfDeath": "21.07.2018",
|
|
||||||
"source": "Julian/Züchterin 2026-06-07 — HUMANQUESTION D7"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Jack II von den Kleinen Chaoten",
|
|
||||||
"dob": "14.02.2016",
|
|
||||||
"decision": "Sterbedatum von der Züchterin",
|
|
||||||
"dateOfDeath": "06.10.2019",
|
|
||||||
"source": "Julian/Züchterin 2026-06-07 — HUMANQUESTION D7"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Milon von den Kleinen Chaoten",
|
|
||||||
"dob": "27.11.2014",
|
|
||||||
"decision": "A-Locus = Aa (Quellen: Aa // aa — einziger strittiger Locus, Züchterin löst auf Aa); alle anderen Loci waren einig",
|
|
||||||
"genotype": "Aa Cc[chm] D- ee[f] gg Pp spsp",
|
|
||||||
"source": "Julian/Züchterin 2026-06-07 — HUMANQUESTION D7"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Sunny von PZ Karl",
|
|
||||||
"dob": "10.04.2014",
|
|
||||||
"decision": "Sterbedatum von der Züchterin; bestätigt = 'von PZ Karl' (nicht 'Sunny Sky of Fiomi')",
|
|
||||||
"dateOfDeath": "30.04.2018",
|
|
||||||
"source": "Julian/Züchterin 2026-06-07 — HUMANQUESTION D7 (Nachtrag)"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Dakota of sweet little mouse",
|
|
||||||
"dob": "30.01.2015",
|
|
||||||
"decision": "Genotyp von Julian/Züchterin: A-Locus=Aa, P-Locus=pp, Sp-Locus=Spsp (offene Loci); übrige bestätigt.",
|
|
||||||
"genotype": "Aa CC Dd Ee Gg pp Spsp",
|
|
||||||
"source": "Julian/Züchterin 2026-06-07 — HUMANQUESTION D7"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Banjo of Fiomi",
|
|
||||||
"dob": "06.07.2015",
|
|
||||||
"decision": "E-Locus Korrektur: Julian — 'Goldfuchs Starkschecke, nicht Gold Starkschecke' → E-Locus muss ee sein, nicht E-. Extract hatte AA CC DD E- Gg pp Spsp [WP]; korrigiert zu ee (Goldfuchs-Definition). Sohn von Dakota of sweet little mouse.",
|
|
||||||
"genotype": "AA CC DD ee Gg pp Spsp",
|
|
||||||
"farbschlag": "Goldfuchs Starkschecke",
|
|
||||||
"source": "Julian 2026-06-07 — HUMANQUESTION D7 (Sohn-Korrektur, nicht ursprüngliche D7-Liste)"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user