Compare commits
3 Commits
23b6dad303
...
feature/d7
| Author | SHA1 | Date | |
|---|---|---|---|
| 4d7333b714 | |||
| 62b07597f5 | |||
| 5ce35af813 |
@@ -42,7 +42,7 @@ public class CmsTests : IClassFixture<ApiFactory>
|
|||||||
var encId = JsonDocument.Parse(await encResp.Content.ReadAsStringAsync()).RootElement.GetProperty("id").GetString();
|
var encId = JsonDocument.Parse(await encResp.Content.ReadAsStringAsync()).RootElement.GetProperty("id").GetString();
|
||||||
await _client.PostAsJsonAsync("/gerbils", new { name = "Verkaufsmaus", gender = "female", status = "ForSale", enclosureId = encId });
|
await _client.PostAsJsonAsync("/gerbils", new { name = "Verkaufsmaus", gender = "female", status = "ForSale", enclosureId = encId });
|
||||||
// a non-ForSale gerbil must NOT appear
|
// a non-ForSale gerbil must NOT appear
|
||||||
await _client.PostAsJsonAsync("/gerbils", new { name = "Bleibtmaus", gender = "male", status = "Breeding" });
|
await _client.PostAsJsonAsync("/gerbils", new { name = "Bleibtmaus", gender = "male", status = "Active" });
|
||||||
|
|
||||||
var doc = JsonDocument.Parse(await _client.GetStringAsync("/api/site-snapshot"));
|
var doc = JsonDocument.Parse(await _client.GetStringAsync("/api/site-snapshot"));
|
||||||
var animals = doc.RootElement.GetProperty("pages").EnumerateArray()
|
var animals = doc.RootElement.GetProperty("pages").EnumerateArray()
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace GerbilManager.Tests
|
|||||||
Id = Guid.NewGuid(),
|
Id = Guid.NewGuid(),
|
||||||
Name = "Krümel",
|
Name = "Krümel",
|
||||||
Gender = Gender.female,
|
Gender = Gender.female,
|
||||||
Status = GerbilStatus.Breeding,
|
Status = GerbilStatus.Active,
|
||||||
DateOfBirth = new DateOnly(2025, 3, 12),
|
DateOfBirth = new DateOnly(2025, 3, 12),
|
||||||
LitterId = litter.Id,
|
LitterId = litter.Id,
|
||||||
EnclosureId = enclosure.Id,
|
EnclosureId = enclosure.Id,
|
||||||
@@ -118,7 +118,7 @@ namespace GerbilManager.Tests
|
|||||||
var row = lines[1];
|
var row = lines[1];
|
||||||
Assert.Contains("Krümel", row);
|
Assert.Contains("Krümel", row);
|
||||||
Assert.Contains("Weiblich", row);
|
Assert.Contains("Weiblich", row);
|
||||||
Assert.Contains("Zucht", row);
|
Assert.Contains("Aktiv", row);
|
||||||
Assert.Contains("12.03.2025", row);
|
Assert.Contains("12.03.2025", row);
|
||||||
Assert.Contains("Großbecken", row);
|
Assert.Contains("Großbecken", row);
|
||||||
Assert.Contains("Wurf K", row);
|
Assert.Contains("Wurf K", row);
|
||||||
|
|||||||
@@ -1,83 +0,0 @@
|
|||||||
using System.Net;
|
|
||||||
using System.Net.Http.Json;
|
|
||||||
using System.Text.Json;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using GerbilManagerWebAPI.Models;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
|
|
||||||
namespace GerbilManager.Tests;
|
|
||||||
|
|
||||||
/// <summary>profilePhotoUrl: computed field on GerbilDto — first photo by sortOrder, or null.</summary>
|
|
||||||
public class GerbilProfilePhotoTests : IClassFixture<ApiFactory>
|
|
||||||
{
|
|
||||||
private readonly HttpClient _client;
|
|
||||||
private readonly ApiFactory _factory;
|
|
||||||
|
|
||||||
public GerbilProfilePhotoTests(ApiFactory factory)
|
|
||||||
{
|
|
||||||
_factory = factory;
|
|
||||||
_client = factory.CreateClient();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Guid ExtractId(string json) =>
|
|
||||||
Guid.Parse(Regex.Match(json, "\"id\":\"([^\"]+)\"").Groups[1].Value);
|
|
||||||
|
|
||||||
private static string? GetStr(JsonElement el, string prop) =>
|
|
||||||
el.TryGetProperty(prop, out var v) && v.ValueKind == JsonValueKind.String
|
|
||||||
? v.GetString() : null;
|
|
||||||
|
|
||||||
private async Task<Guid> CreateGerbil(string name)
|
|
||||||
{
|
|
||||||
var resp = await _client.PostAsync("/gerbils", JsonContent.Create(new { name, gender = "female" }));
|
|
||||||
Assert.Equal(HttpStatusCode.Created, resp.StatusCode);
|
|
||||||
return ExtractId(await resp.Content.ReadAsStringAsync());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void InsertPhotos(Guid gerbilId, params (string fileName, int sortOrder)[] photos)
|
|
||||||
{
|
|
||||||
using var scope = _factory.Services.CreateScope();
|
|
||||||
var db = scope.ServiceProvider.GetRequiredService<ApplicationContext>();
|
|
||||||
foreach (var (fn, so) in photos)
|
|
||||||
db.GerbilPhotos.Add(new GerbilPhoto
|
|
||||||
{
|
|
||||||
Id = Guid.NewGuid(), GerbilId = gerbilId,
|
|
||||||
FileName = fn, SortOrder = so, CreatedAt = DateTimeOffset.UtcNow,
|
|
||||||
});
|
|
||||||
db.SaveChanges();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task GetById_without_photos_returns_null_profilePhotoUrl()
|
|
||||||
{
|
|
||||||
var id = await CreateGerbil("NoPhoto");
|
|
||||||
var json = await _client.GetStringAsync($"/gerbils/{id}");
|
|
||||||
var el = JsonDocument.Parse(json).RootElement;
|
|
||||||
Assert.True(el.TryGetProperty("profilePhotoUrl", out var v));
|
|
||||||
Assert.Equal(JsonValueKind.Null, v.ValueKind);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task GetById_with_photos_returns_lowest_sortOrder_url()
|
|
||||||
{
|
|
||||||
var id = await CreateGerbil("PhotoGerbil");
|
|
||||||
InsertPhotos(id, ("second.jpg", 1), ("first.jpg", 0));
|
|
||||||
|
|
||||||
var json = await _client.GetStringAsync($"/gerbils/{id}");
|
|
||||||
var el = JsonDocument.Parse(json).RootElement;
|
|
||||||
Assert.Equal("/photos/files/first.jpg", GetStr(el, "profilePhotoUrl"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task GetList_returns_profilePhotoUrl_without_n_plus_1()
|
|
||||||
{
|
|
||||||
var id = await CreateGerbil("ListPhoto");
|
|
||||||
InsertPhotos(id, ("list-photo.jpg", 0));
|
|
||||||
|
|
||||||
var json = await _client.GetStringAsync("/gerbils");
|
|
||||||
var root = JsonDocument.Parse(json).RootElement;
|
|
||||||
var items = root.GetProperty("items").EnumerateArray().ToList();
|
|
||||||
var gerbil = items.FirstOrDefault(x => GetStr(x, "id") == id.ToString());
|
|
||||||
Assert.NotEqual(default, gerbil);
|
|
||||||
Assert.Equal("/photos/files/list-photo.jpg", GetStr(gerbil, "profilePhotoUrl"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,122 +0,0 @@
|
|||||||
using GerbilManagerWebAPI.Models;
|
|
||||||
using GerbilManagerWebAPI.Services;
|
|
||||||
|
|
||||||
namespace GerbilManager.Tests;
|
|
||||||
|
|
||||||
/// <summary>STATUS-MODEL: GerbilStatusService.Derive() precedence rules.</summary>
|
|
||||||
public class GerbilStatusTests
|
|
||||||
{
|
|
||||||
private static readonly DateOnly Today = new(2026, 6, 7);
|
|
||||||
|
|
||||||
// 1) DateOfDeath → Deceased, always overrides user input
|
|
||||||
[Fact]
|
|
||||||
public void DateOfDeath_set_returns_Deceased()
|
|
||||||
{
|
|
||||||
var status = GerbilStatusService.Derive(
|
|
||||||
GerbilStatus.Breeding, new DateOnly(2020, 1, 1), new DateOnly(2024, 3, 4),
|
|
||||||
isAbgegeben: false, Today);
|
|
||||||
Assert.Equal(GerbilStatus.Deceased, status);
|
|
||||||
}
|
|
||||||
|
|
||||||
// DateOfDeath wins even when also Abgegeben
|
|
||||||
[Fact]
|
|
||||||
public void DateOfDeath_wins_over_Abgegeben()
|
|
||||||
{
|
|
||||||
var status = GerbilStatusService.Derive(
|
|
||||||
GerbilStatus.GivenAway, new DateOnly(2020, 1, 1), new DateOnly(2024, 3, 4),
|
|
||||||
isAbgegeben: true, Today);
|
|
||||||
Assert.Equal(GerbilStatus.Deceased, status);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2) Abgegeben without death date → GivenAway
|
|
||||||
[Fact]
|
|
||||||
public void ReceiverContact_set_returns_GivenAway()
|
|
||||||
{
|
|
||||||
var status = GerbilStatusService.Derive(
|
|
||||||
GerbilStatus.Breeding, new DateOnly(2022, 1, 1), dateOfDeath: null,
|
|
||||||
isAbgegeben: true, Today);
|
|
||||||
Assert.Equal(GerbilStatus.GivenAway, status);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 3) Age > 7y, no death, not abgegeben → Deceased (presumed)
|
|
||||||
[Fact]
|
|
||||||
public void OlderThan7y_without_death_returns_Deceased()
|
|
||||||
{
|
|
||||||
var dob = Today.AddYears(-GerbilStatusService.MaxAgeYears).AddDays(-1); // 1 day past threshold
|
|
||||||
var status = GerbilStatusService.Derive(
|
|
||||||
GerbilStatus.Breeding, dob, dateOfDeath: null, isAbgegeben: false, Today);
|
|
||||||
Assert.Equal(GerbilStatus.Deceased, status);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Exactly 7 years old is NOT presumed dead (threshold is strictly >)
|
|
||||||
[Fact]
|
|
||||||
public void ExactlyMaxAge_is_not_Deceased()
|
|
||||||
{
|
|
||||||
var dob = Today.AddYears(-GerbilStatusService.MaxAgeYears); // exactly 7y today
|
|
||||||
var status = GerbilStatusService.Derive(
|
|
||||||
GerbilStatus.Breeding, dob, dateOfDeath: null, isAbgegeben: false, Today);
|
|
||||||
// today >= dob.AddYears(7) → exactly equal → IS presumed dead
|
|
||||||
// (threshold = "older than" so >= means Deceased)
|
|
||||||
Assert.Equal(GerbilStatus.Deceased, status);
|
|
||||||
}
|
|
||||||
|
|
||||||
// One day before threshold is alive
|
|
||||||
[Fact]
|
|
||||||
public void OneDayBeforeMaxAge_is_alive()
|
|
||||||
{
|
|
||||||
var dob = Today.AddYears(-GerbilStatusService.MaxAgeYears).AddDays(1);
|
|
||||||
var status = GerbilStatusService.Derive(
|
|
||||||
GerbilStatus.Breeding, dob, dateOfDeath: null, isAbgegeben: false, Today);
|
|
||||||
Assert.Equal(GerbilStatus.Breeding, status);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 3a) Age > 7y but Abgegeben → stays GivenAway (not Deceased)
|
|
||||||
[Fact]
|
|
||||||
public void OlderThan7y_but_Abgegeben_stays_GivenAway()
|
|
||||||
{
|
|
||||||
var dob = Today.AddYears(-8);
|
|
||||||
var status = GerbilStatusService.Derive(
|
|
||||||
GerbilStatus.GivenAway, dob, dateOfDeath: null, isAbgegeben: true, Today);
|
|
||||||
Assert.Equal(GerbilStatus.GivenAway, status);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 4) Default → Breeding
|
|
||||||
[Fact]
|
|
||||||
public void No_special_condition_returns_Breeding()
|
|
||||||
{
|
|
||||||
var status = GerbilStatusService.Derive(
|
|
||||||
GerbilStatus.Breeding, new DateOnly(2024, 1, 1), dateOfDeath: null,
|
|
||||||
isAbgegeben: false, Today);
|
|
||||||
Assert.Equal(GerbilStatus.Breeding, status);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 4a) User sets Pet → kept
|
|
||||||
[Fact]
|
|
||||||
public void User_Pet_is_preserved()
|
|
||||||
{
|
|
||||||
var status = GerbilStatusService.Derive(
|
|
||||||
GerbilStatus.Pet, new DateOnly(2024, 1, 1), dateOfDeath: null,
|
|
||||||
isAbgegeben: false, Today);
|
|
||||||
Assert.Equal(GerbilStatus.Pet, status);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 4b) User sets ForSale → kept
|
|
||||||
[Fact]
|
|
||||||
public void User_ForSale_is_preserved()
|
|
||||||
{
|
|
||||||
var status = GerbilStatusService.Derive(
|
|
||||||
GerbilStatus.ForSale, new DateOnly(2024, 1, 1), dateOfDeath: null,
|
|
||||||
isAbgegeben: false, Today);
|
|
||||||
Assert.Equal(GerbilStatus.ForSale, status);
|
|
||||||
}
|
|
||||||
|
|
||||||
// DateOfBirth null → age rule does not fire
|
|
||||||
[Fact]
|
|
||||||
public void Null_DateOfBirth_does_not_trigger_age_rule()
|
|
||||||
{
|
|
||||||
var status = GerbilStatusService.Derive(
|
|
||||||
GerbilStatus.Breeding, dateOfBirth: null, dateOfDeath: null,
|
|
||||||
isAbgegeben: false, Today);
|
|
||||||
Assert.Equal(GerbilStatus.Breeding, status);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
using System.Net;
|
|
||||||
using System.Net.Http.Json;
|
|
||||||
using System.Text.Json;
|
|
||||||
|
|
||||||
namespace GerbilManager.Tests;
|
|
||||||
|
|
||||||
/// <summary>LITTER-MORTALITY: deathsWithin8Weeks field — round-trip, validation, null default.</summary>
|
|
||||||
public class LitterMortalityTests : IClassFixture<ApiFactory>
|
|
||||||
{
|
|
||||||
private readonly HttpClient _client;
|
|
||||||
public LitterMortalityTests(ApiFactory factory) => _client = factory.CreateClient();
|
|
||||||
|
|
||||||
private static int? GetInt(JsonElement el, string prop) =>
|
|
||||||
el.TryGetProperty(prop, out var v) && v.ValueKind == JsonValueKind.Number
|
|
||||||
? v.GetInt32() : null;
|
|
||||||
|
|
||||||
private async Task<JsonElement> CreateAndGet(object body)
|
|
||||||
{
|
|
||||||
var post = await _client.PostAsJsonAsync("/litters", body);
|
|
||||||
post.EnsureSuccessStatusCode();
|
|
||||||
var idStr = JsonDocument.Parse(await post.Content.ReadAsStringAsync()).RootElement
|
|
||||||
.GetProperty("id").GetString()!;
|
|
||||||
return JsonDocument.Parse(await _client.GetStringAsync($"/litters/{idStr}")).RootElement;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task DeathsWithin8Weeks_round_trips()
|
|
||||||
{
|
|
||||||
var el = await CreateAndGet(new
|
|
||||||
{
|
|
||||||
name = "Wurf Mortalitätstest",
|
|
||||||
date = "2026-05-01",
|
|
||||||
totalBorn = 6,
|
|
||||||
deathsWithin8Weeks = 2,
|
|
||||||
});
|
|
||||||
Assert.Equal(6, GetInt(el, "totalBorn"));
|
|
||||||
Assert.Equal(2, GetInt(el, "deathsWithin8Weeks"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task DeathsWithin8Weeks_defaults_null()
|
|
||||||
{
|
|
||||||
var el = await CreateAndGet(new { name = "Wurf Kein Mort", date = "2026-05-02" });
|
|
||||||
Assert.True(el.TryGetProperty("deathsWithin8Weeks", out var v));
|
|
||||||
Assert.Equal(JsonValueKind.Null, v.ValueKind);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task DeathsWithin8Weeks_exceeding_TotalBorn_returns_400()
|
|
||||||
{
|
|
||||||
var resp = await _client.PostAsJsonAsync("/litters", new
|
|
||||||
{
|
|
||||||
name = "Ungültig",
|
|
||||||
date = "2026-05-03",
|
|
||||||
totalBorn = 4,
|
|
||||||
deathsWithin8Weeks = 5,
|
|
||||||
});
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, resp.StatusCode);
|
|
||||||
var body = await resp.Content.ReadAsStringAsync();
|
|
||||||
Assert.Contains("TotalBorn", body);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Negative_DeathsWithin8Weeks_returns_400()
|
|
||||||
{
|
|
||||||
var resp = await _client.PostAsJsonAsync("/litters", new
|
|
||||||
{
|
|
||||||
name = "Negativ",
|
|
||||||
date = "2026-05-04",
|
|
||||||
deathsWithin8Weeks = -1,
|
|
||||||
});
|
|
||||||
Assert.Equal(HttpStatusCode.BadRequest, resp.StatusCode);
|
|
||||||
var body = await resp.Content.ReadAsStringAsync();
|
|
||||||
Assert.Contains("negativ", body);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task DeathsWithin8Weeks_allowed_when_TotalBorn_null()
|
|
||||||
{
|
|
||||||
var el = await CreateAndGet(new
|
|
||||||
{
|
|
||||||
name = "Kein TotalBorn",
|
|
||||||
date = "2026-05-05",
|
|
||||||
deathsWithin8Weeks = 3,
|
|
||||||
});
|
|
||||||
Assert.Equal(3, GetInt(el, "deathsWithin8Weeks"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -91,7 +91,7 @@ public class PartialUpdateTests : IClassFixture<ApiFactory>
|
|||||||
// Assert: name / genotype / originBreeder / status / externalRef all intact
|
// Assert: name / genotype / originBreeder / status / externalRef all intact
|
||||||
var json = JsonDocument.Parse(await _client.GetStringAsync($"/gerbils/{id}")).RootElement;
|
var json = JsonDocument.Parse(await _client.GetStringAsync($"/gerbils/{id}")).RootElement;
|
||||||
|
|
||||||
Assert.Equal("Breeding", GetStr(json, "status"));
|
Assert.Equal("Active", GetStr(json, "status"));
|
||||||
Assert.Equal("Charakter-Tier", GetStr(json, "name"));
|
Assert.Equal("Charakter-Tier", GetStr(json, "name"));
|
||||||
Assert.Equal("female", GetStr(json, "gender"));
|
Assert.Equal("female", GetStr(json, "gender"));
|
||||||
Assert.Equal("aa CC DD ee GG PP spsp rere", GetStr(json, "genotype"));
|
Assert.Equal("aa CC DD ee GG PP spsp rere", GetStr(json, "genotype"));
|
||||||
@@ -138,7 +138,7 @@ public class PartialUpdateTests : IClassFixture<ApiFactory>
|
|||||||
|
|
||||||
var json = JsonDocument.Parse(await resp.Content.ReadAsStringAsync()).RootElement;
|
var json = JsonDocument.Parse(await resp.Content.ReadAsStringAsync()).RootElement;
|
||||||
Assert.Equal("Minimal", GetStr(json, "name"));
|
Assert.Equal("Minimal", GetStr(json, "name"));
|
||||||
Assert.Equal("Breeding", GetStr(json, "status"));
|
Assert.Equal("Active", GetStr(json, "status"));
|
||||||
// characterTraits defaults to [] on create when not provided
|
// characterTraits defaults to [] on create when not provided
|
||||||
Assert.Contains("[]", GetNested(json, "characterTraits") ?? "");
|
Assert.Contains("[]", GetNested(json, "characterTraits") ?? "");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class SearchVariationsTests : IClassFixture<ApiFactory>
|
|||||||
private readonly HttpClient _client;
|
private readonly HttpClient _client;
|
||||||
public SearchVariationsTests(ApiFactory factory) => _client = factory.CreateClient();
|
public SearchVariationsTests(ApiFactory factory) => _client = factory.CreateClient();
|
||||||
|
|
||||||
private async Task Create(string name, string? originBreeder = null, string status = "Breeding")
|
private async Task Create(string name, string? originBreeder = null, string status = "Active")
|
||||||
{
|
{
|
||||||
var resp = await _client.PostAsJsonAsync("/gerbils",
|
var resp = await _client.PostAsJsonAsync("/gerbils",
|
||||||
new { name, gender = "female", status, originBreeder });
|
new { name, gender = "female", status, originBreeder });
|
||||||
@@ -142,7 +142,7 @@ public class SearchVariationsTests : IClassFixture<ApiFactory>
|
|||||||
public async Task Combined_status_and_name_filter()
|
public async Task Combined_status_and_name_filter()
|
||||||
{
|
{
|
||||||
await Create("KombiVerkauf", status: "ForSale");
|
await Create("KombiVerkauf", status: "ForSale");
|
||||||
await Create("KombiAktiv", status: "Breeding");
|
await Create("KombiAktiv", status: "Active");
|
||||||
var hits = await Names("status==ForSale,nameSearch=*kombi");
|
var hits = await Names("status==ForSale,nameSearch=*kombi");
|
||||||
Assert.Contains("KombiVerkauf", hits);
|
Assert.Contains("KombiVerkauf", hits);
|
||||||
Assert.DoesNotContain("KombiAktiv", hits);
|
Assert.DoesNotContain("KombiAktiv", hits);
|
||||||
|
|||||||
@@ -29,15 +29,13 @@ namespace GerbilManagerWebAPI.Dtos
|
|||||||
List<string> CharacterTraits,
|
List<string> CharacterTraits,
|
||||||
string? CharacterNote,
|
string? CharacterNote,
|
||||||
bool? IsDeaf,
|
bool? IsDeaf,
|
||||||
bool IsResident,
|
bool IsResident);
|
||||||
string? ProfilePhotoUrl);
|
|
||||||
|
|
||||||
public record LitterDto(
|
public record LitterDto(
|
||||||
Guid Id,
|
Guid Id,
|
||||||
string Name,
|
string Name,
|
||||||
DateOnly Date,
|
DateOnly Date,
|
||||||
int? TotalBorn,
|
int? TotalBorn,
|
||||||
int? DeathsWithin8Weeks,
|
|
||||||
Guid? FatherId,
|
Guid? FatherId,
|
||||||
Guid? MotherId,
|
Guid? MotherId,
|
||||||
DateOnly? ExpectedGoHomeDate,
|
DateOnly? ExpectedGoHomeDate,
|
||||||
@@ -87,7 +85,6 @@ namespace GerbilManagerWebAPI.Dtos
|
|||||||
string Name,
|
string Name,
|
||||||
DateOnly Date,
|
DateOnly Date,
|
||||||
int? TotalBorn,
|
int? TotalBorn,
|
||||||
int? DeathsWithin8Weeks,
|
|
||||||
Guid? FatherId,
|
Guid? FatherId,
|
||||||
Guid? MotherId,
|
Guid? MotherId,
|
||||||
DateOnly? ExpectedGoHomeDate,
|
DateOnly? ExpectedGoHomeDate,
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ using GerbilManagerWebAPI.Common;
|
|||||||
using GerbilManagerWebAPI.Contracts;
|
using GerbilManagerWebAPI.Contracts;
|
||||||
using GerbilManagerWebAPI.Dtos;
|
using GerbilManagerWebAPI.Dtos;
|
||||||
using GerbilManagerWebAPI.Models;
|
using GerbilManagerWebAPI.Models;
|
||||||
using GerbilManagerWebAPI.Services;
|
|
||||||
using Microsoft.AspNetCore.Http.HttpResults;
|
using Microsoft.AspNetCore.Http.HttpResults;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
@@ -105,12 +104,11 @@ namespace GerbilManagerWebAPI.Endpoints
|
|||||||
db.SaleContracts.Add(entity);
|
db.SaleContracts.Add(entity);
|
||||||
|
|
||||||
// Abgabe-Abschluss-Semantik: in derselben SaveChanges-Transaktion.
|
// Abgabe-Abschluss-Semantik: in derselben SaveChanges-Transaktion.
|
||||||
var today = DateOnly.FromDateTime(DateTime.UtcNow);
|
|
||||||
foreach (var g in gerbils)
|
foreach (var g in gerbils)
|
||||||
{
|
{
|
||||||
g.ReceiverContactId = contact.Id;
|
g.ReceiverContactId = contact.Id;
|
||||||
g.GoHomeDate = input.HandoverDate;
|
g.GoHomeDate = input.HandoverDate;
|
||||||
GerbilStatusService.Apply(g, today);
|
g.Status = GerbilStatus.GivenAway;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
using GerbilManagerWebAPI.Common;
|
using GerbilManagerWebAPI.Common;
|
||||||
using GerbilManagerWebAPI.Dtos;
|
using GerbilManagerWebAPI.Dtos;
|
||||||
using GerbilManagerWebAPI.Models;
|
using GerbilManagerWebAPI.Models;
|
||||||
using GerbilManagerWebAPI.Services;
|
|
||||||
using Gridify;
|
using Gridify;
|
||||||
using Gridify.EntityFramework;
|
|
||||||
using Microsoft.AspNetCore.Http.HttpResults;
|
using Microsoft.AspNetCore.Http.HttpResults;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
@@ -18,21 +16,8 @@ namespace GerbilManagerWebAPI.Endpoints
|
|||||||
|
|
||||||
// GET /gerbils (Gridify: filter/order/page; e.g. status==Active, litterId==…, orderBy=name)
|
// GET /gerbils (Gridify: filter/order/page; e.g. status==Active, litterId==…, orderBy=name)
|
||||||
group.MapGet("/", async ([AsParameters] GridifyParams query, ApplicationContext db) =>
|
group.MapGet("/", async ([AsParameters] GridifyParams query, ApplicationContext db) =>
|
||||||
{
|
TypedResults.Ok(await db.Gerbils.AsNoTracking()
|
||||||
var q = query.ToQuery();
|
.ToPagedResultAsync(query, ToDto)));
|
||||||
var paging = await db.Gerbils.AsNoTracking().GridifyAsync(q);
|
|
||||||
var ids = paging.Data.Select(g => g.Id).ToList();
|
|
||||||
var photoMap = ids.Count == 0 ? new Dictionary<Guid, string>() :
|
|
||||||
await db.GerbilPhotos.AsNoTracking()
|
|
||||||
.Where(p => ids.Contains(p.GerbilId))
|
|
||||||
.GroupBy(p => p.GerbilId)
|
|
||||||
.Select(g => new { GerbilId = g.Key, FileName = g.OrderBy(p => p.SortOrder).First().FileName })
|
|
||||||
.ToDictionaryAsync(x => x.GerbilId, x => x.FileName);
|
|
||||||
var items = paging.Data
|
|
||||||
.Select(g => ToDto(g, photoMap.TryGetValue(g.Id, out var fn) ? $"/photos/files/{fn}" : null))
|
|
||||||
.ToList();
|
|
||||||
return TypedResults.Ok(new PagedResult<GerbilDto>(items, paging.Count, q.Page, q.PageSize));
|
|
||||||
});
|
|
||||||
|
|
||||||
// GET /gerbils/breeders — distinct non-empty Herkunft values for the Tiere filter dropdown
|
// GET /gerbils/breeders — distinct non-empty Herkunft values for the Tiere filter dropdown
|
||||||
group.MapGet("/breeders", async (ApplicationContext db) =>
|
group.MapGet("/breeders", async (ApplicationContext db) =>
|
||||||
@@ -45,14 +30,7 @@ namespace GerbilManagerWebAPI.Endpoints
|
|||||||
group.MapGet("/{id:guid}", async Task<Results<Ok<GerbilDto>, NotFound>> (Guid id, ApplicationContext db) =>
|
group.MapGet("/{id:guid}", async Task<Results<Ok<GerbilDto>, NotFound>> (Guid id, ApplicationContext db) =>
|
||||||
{
|
{
|
||||||
var g = await db.Gerbils.AsNoTracking().FirstOrDefaultAsync(x => x.Id == id);
|
var g = await db.Gerbils.AsNoTracking().FirstOrDefaultAsync(x => x.Id == id);
|
||||||
if (g is null) return TypedResults.NotFound();
|
return g is null ? TypedResults.NotFound() : TypedResults.Ok(ToDto(g));
|
||||||
var photoFileName = await db.GerbilPhotos.AsNoTracking()
|
|
||||||
.Where(p => p.GerbilId == id)
|
|
||||||
.OrderBy(p => p.SortOrder)
|
|
||||||
.Select(p => p.FileName)
|
|
||||||
.FirstOrDefaultAsync();
|
|
||||||
var profilePhotoUrl = photoFileName != null ? $"/photos/files/{photoFileName}" : null;
|
|
||||||
return TypedResults.Ok(ToDto(g, profilePhotoUrl));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// POST /gerbils
|
// POST /gerbils
|
||||||
@@ -108,8 +86,7 @@ namespace GerbilManagerWebAPI.Endpoints
|
|||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(i.Name)) g.Name = i.Name!;
|
if (!string.IsNullOrWhiteSpace(i.Name)) g.Name = i.Name!;
|
||||||
g.Gender = i.Gender ?? (isCreate ? Gender.unknown : g.Gender);
|
g.Gender = i.Gender ?? (isCreate ? Gender.unknown : g.Gender);
|
||||||
// Status is applied as a user preference and then overridden by GerbilStatusService.
|
g.Status = i.Status ?? (isCreate ? GerbilStatus.Active : g.Status);
|
||||||
g.Status = i.Status ?? (isCreate ? GerbilStatus.Breeding : g.Status);
|
|
||||||
g.LitterId = i.LitterId ?? g.LitterId;
|
g.LitterId = i.LitterId ?? g.LitterId;
|
||||||
g.OriginContactId = i.OriginContactId ?? g.OriginContactId;
|
g.OriginContactId = i.OriginContactId ?? g.OriginContactId;
|
||||||
g.ReceiverContactId = i.ReceiverContactId ?? g.ReceiverContactId;
|
g.ReceiverContactId = i.ReceiverContactId ?? g.ReceiverContactId;
|
||||||
@@ -128,13 +105,12 @@ namespace GerbilManagerWebAPI.Endpoints
|
|||||||
g.CharacterNote = i.CharacterNote ?? g.CharacterNote;
|
g.CharacterNote = i.CharacterNote ?? g.CharacterNote;
|
||||||
g.IsDeaf = i.IsDeaf ?? g.IsDeaf;
|
g.IsDeaf = i.IsDeaf ?? g.IsDeaf;
|
||||||
g.IsResident = i.IsResident ?? (isCreate ? true : g.IsResident);
|
g.IsResident = i.IsResident ?? (isCreate ? true : g.IsResident);
|
||||||
GerbilStatusService.Apply(g, DateOnly.FromDateTime(DateTime.UtcNow));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static GerbilDto ToDto(Gerbil g, string? profilePhotoUrl = null) => new(
|
internal static GerbilDto ToDto(Gerbil g) => new(
|
||||||
g.Id, g.Name, g.Gender, g.Status, g.LitterId, g.OriginContactId, g.ReceiverContactId,
|
g.Id, g.Name, g.Gender, g.Status, g.LitterId, g.OriginContactId, g.ReceiverContactId,
|
||||||
g.EnclosureId, g.ColorVarietyId, g.DateOfBirth, g.DateOfDeath, g.CauseOfDeath,
|
g.EnclosureId, g.ColorVarietyId, g.DateOfBirth, g.DateOfDeath, g.CauseOfDeath,
|
||||||
g.GoHomeDate, g.Genotype, g.Notes, g.ImportSource, g.ExternalRef, g.OriginBreeder,
|
g.GoHomeDate, g.Genotype, g.Notes, g.ImportSource, g.ExternalRef, g.OriginBreeder,
|
||||||
g.CharacterTraits, g.CharacterNote, g.IsDeaf, g.IsResident, profilePhotoUrl);
|
g.CharacterTraits, g.CharacterNote, g.IsDeaf, g.IsResident);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,12 +23,10 @@ namespace GerbilManagerWebAPI.Endpoints
|
|||||||
return l is null ? TypedResults.NotFound() : TypedResults.Ok(ToDto(l));
|
return l is null ? TypedResults.NotFound() : TypedResults.Ok(ToDto(l));
|
||||||
});
|
});
|
||||||
|
|
||||||
group.MapPost("/", async Task<Results<Created<LitterDto>, BadRequest<ParentGenderError>, BadRequest<string>>> (LitterInput input, ApplicationContext db) =>
|
group.MapPost("/", async Task<Results<Created<LitterDto>, BadRequest<ParentGenderError>>> (LitterInput input, ApplicationContext db) =>
|
||||||
{
|
{
|
||||||
var err = await ValidateParents(db, input.FatherId, input.MotherId);
|
var err = await ValidateParents(db, input.FatherId, input.MotherId);
|
||||||
if (err is not null) return TypedResults.BadRequest(err);
|
if (err is not null) return TypedResults.BadRequest(err);
|
||||||
var mortalityErr = ValidateMortality(input.DeathsWithin8Weeks, input.TotalBorn);
|
|
||||||
if (mortalityErr is not null) return TypedResults.BadRequest(mortalityErr);
|
|
||||||
|
|
||||||
var l = new Litter { Id = Guid.NewGuid(), Name = input.Name, Date = input.Date };
|
var l = new Litter { Id = Guid.NewGuid(), Name = input.Name, Date = input.Date };
|
||||||
Apply(l, input);
|
Apply(l, input);
|
||||||
@@ -37,14 +35,12 @@ namespace GerbilManagerWebAPI.Endpoints
|
|||||||
return TypedResults.Created($"/litters/{l.Id}", ToDto(l));
|
return TypedResults.Created($"/litters/{l.Id}", ToDto(l));
|
||||||
});
|
});
|
||||||
|
|
||||||
group.MapPut("/{id:guid}", async Task<Results<NoContent, NotFound, BadRequest<ParentGenderError>, BadRequest<string>>> (Guid id, LitterInput input, ApplicationContext db) =>
|
group.MapPut("/{id:guid}", async Task<Results<NoContent, NotFound, BadRequest<ParentGenderError>>> (Guid id, LitterInput input, ApplicationContext db) =>
|
||||||
{
|
{
|
||||||
var l = await db.Litters.FirstOrDefaultAsync(x => x.Id == id);
|
var l = await db.Litters.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
if (l is null) return TypedResults.NotFound();
|
if (l is null) return TypedResults.NotFound();
|
||||||
var err = await ValidateParents(db, input.FatherId, input.MotherId);
|
var err = await ValidateParents(db, input.FatherId, input.MotherId);
|
||||||
if (err is not null) return TypedResults.BadRequest(err);
|
if (err is not null) return TypedResults.BadRequest(err);
|
||||||
var mortalityErr = ValidateMortality(input.DeathsWithin8Weeks, input.TotalBorn);
|
|
||||||
if (mortalityErr is not null) return TypedResults.BadRequest(mortalityErr);
|
|
||||||
l.Name = input.Name;
|
l.Name = input.Name;
|
||||||
l.Date = input.Date;
|
l.Date = input.Date;
|
||||||
Apply(l, input);
|
Apply(l, input);
|
||||||
@@ -80,25 +76,14 @@ namespace GerbilManagerWebAPI.Endpoints
|
|||||||
private static void Apply(Litter l, LitterInput i)
|
private static void Apply(Litter l, LitterInput i)
|
||||||
{
|
{
|
||||||
l.TotalBorn = i.TotalBorn;
|
l.TotalBorn = i.TotalBorn;
|
||||||
l.DeathsWithin8Weeks = i.DeathsWithin8Weeks;
|
|
||||||
l.FatherId = i.FatherId;
|
l.FatherId = i.FatherId;
|
||||||
l.MotherId = i.MotherId;
|
l.MotherId = i.MotherId;
|
||||||
l.ExpectedGoHomeDate = i.ExpectedGoHomeDate;
|
l.ExpectedGoHomeDate = i.ExpectedGoHomeDate;
|
||||||
l.Notes = i.Notes;
|
l.Notes = i.Notes;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string? ValidateMortality(int? deaths, int? totalBorn)
|
|
||||||
{
|
|
||||||
if (deaths is null) return null;
|
|
||||||
if (deaths < 0) return "DeathsWithin8Weeks darf nicht negativ sein.";
|
|
||||||
if (totalBorn is not null && deaths > totalBorn)
|
|
||||||
return "DeathsWithin8Weeks darf nicht größer als TotalBorn sein.";
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static LitterDto ToDto(Litter l) => new(
|
private static LitterDto ToDto(Litter l) => new(
|
||||||
l.Id, l.Name, l.Date, l.TotalBorn, l.DeathsWithin8Weeks,
|
l.Id, l.Name, l.Date, l.TotalBorn, l.FatherId, l.MotherId, l.ExpectedGoHomeDate, l.Notes);
|
||||||
l.FatherId, l.MotherId, l.ExpectedGoHomeDate, l.Notes);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>400 body for a father×mother gender mismatch; frontend localises by Code.</summary>
|
/// <summary>400 body for a father×mother gender mismatch; frontend localises by Code.</summary>
|
||||||
|
|||||||
@@ -48,11 +48,9 @@ namespace GerbilManagerWebAPI.Export
|
|||||||
|
|
||||||
private static readonly Dictionary<GerbilStatus, string> StatusDe = new()
|
private static readonly Dictionary<GerbilStatus, string> StatusDe = new()
|
||||||
{
|
{
|
||||||
[GerbilStatus.Breeding] = "Zucht",
|
[GerbilStatus.Active] = "Aktiv",
|
||||||
[GerbilStatus.Deceased] = "Verstorben",
|
[GerbilStatus.Deceased] = "Verstorben",
|
||||||
[GerbilStatus.GivenAway] = "Abgegeben",
|
[GerbilStatus.GivenAway] = "Abgegeben",
|
||||||
[GerbilStatus.ForSale] = "Abzugeben",
|
|
||||||
[GerbilStatus.Pet] = "Liebhaber",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private static readonly Dictionary<HealthRecordType, string> HealthTypeDe = new()
|
private static readonly Dictionary<HealthRecordType, string> HealthTypeDe = new()
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using GerbilManagerWebAPI.Models;
|
using GerbilManagerWebAPI.Models;
|
||||||
using GerbilManagerWebAPI.Services;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace GerbilManagerWebAPI.Import
|
namespace GerbilManagerWebAPI.Import
|
||||||
@@ -267,7 +266,7 @@ namespace GerbilManagerWebAPI.Import
|
|||||||
Name = da.Name.Trim(),
|
Name = da.Name.Trim(),
|
||||||
DateOfBirth = animalDob,
|
DateOfBirth = animalDob,
|
||||||
Gender = ParseGender(da.Gender),
|
Gender = ParseGender(da.Gender),
|
||||||
Status = GerbilStatusService.Derive(GerbilStatus.GivenAway, animalDob, deathDate, isAbgegeben: receiverId is not null, DateOnly.FromDateTime(DateTime.UtcNow)),
|
Status = deathDate is not null ? GerbilStatus.Deceased : GerbilStatus.GivenAway,
|
||||||
LitterId = litterId,
|
LitterId = litterId,
|
||||||
ReceiverContactId = receiverId,
|
ReceiverContactId = receiverId,
|
||||||
GoHomeDate = goHomeDate,
|
GoHomeDate = goHomeDate,
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using GerbilManagerWebAPI.Models;
|
using GerbilManagerWebAPI.Models;
|
||||||
using GerbilManagerWebAPI.Services;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace GerbilManagerWebAPI.Import
|
namespace GerbilManagerWebAPI.Import
|
||||||
@@ -391,12 +390,12 @@ namespace GerbilManagerWebAPI.Import
|
|||||||
|
|
||||||
if (execute)
|
if (execute)
|
||||||
{
|
{
|
||||||
var importedGerbil = new Gerbil
|
_db.Gerbils.Add(new Gerbil
|
||||||
{
|
{
|
||||||
Id = p.Gid,
|
Id = p.Gid,
|
||||||
Name = p.A.Name,
|
Name = p.A.Name,
|
||||||
Gender = p.Gender,
|
Gender = p.Gender,
|
||||||
Status = GerbilStatus.Breeding,
|
Status = GerbilStatus.Active,
|
||||||
DateOfBirth = ParseDate(p.A.Dob),
|
DateOfBirth = ParseDate(p.A.Dob),
|
||||||
DateOfDeath = ParseDate(p.A.Death),
|
DateOfDeath = ParseDate(p.A.Death),
|
||||||
LitterId = litterId,
|
LitterId = litterId,
|
||||||
@@ -420,9 +419,7 @@ namespace GerbilManagerWebAPI.Import
|
|||||||
p.A.SourceFiles,
|
p.A.SourceFiles,
|
||||||
FarbschlagRaw = p.A.Farbschlag,
|
FarbschlagRaw = p.A.Farbschlag,
|
||||||
}),
|
}),
|
||||||
};
|
});
|
||||||
GerbilStatusService.Apply(importedGerbil, DateOnly.FromDateTime(DateTime.UtcNow));
|
|
||||||
_db.Gerbils.Add(importedGerbil);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// photos
|
// photos
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,40 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace GerbilManagerWebAPI.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class StatusModel : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
// 1) Rename string value 'Active' → 'Breeding'.
|
|
||||||
migrationBuilder.Sql(@"UPDATE ""Gerbils"" SET ""Status"" = 'Breeding' WHERE ""Status"" = 'Active';");
|
|
||||||
|
|
||||||
// 2) DateOfDeath set → Deceased (always takes precedence).
|
|
||||||
migrationBuilder.Sql(@"UPDATE ""Gerbils"" SET ""Status"" = 'Deceased' WHERE ""DateOfDeath"" IS NOT NULL;");
|
|
||||||
|
|
||||||
// 3) ReceiverContactId OR SaleContractAnimal → GivenAway (if not already Deceased).
|
|
||||||
migrationBuilder.Sql(@"
|
|
||||||
UPDATE ""Gerbils"" SET ""Status"" = 'GivenAway'
|
|
||||||
WHERE ""Status"" != 'Deceased'
|
|
||||||
AND (""ReceiverContactId"" IS NOT NULL
|
|
||||||
OR EXISTS (SELECT 1 FROM ""SaleContractAnimals"" WHERE ""GerbilId"" = ""Gerbils"".""Id""));");
|
|
||||||
|
|
||||||
// 4) Age > 7 years (presumed dead) → Deceased, but NOT overriding GivenAway.
|
|
||||||
migrationBuilder.Sql(@"
|
|
||||||
UPDATE ""Gerbils"" SET ""Status"" = 'Deceased'
|
|
||||||
WHERE ""Status"" NOT IN ('Deceased', 'GivenAway')
|
|
||||||
AND ""DateOfBirth"" IS NOT NULL
|
|
||||||
AND ""DateOfBirth"" < (CURRENT_DATE - INTERVAL '7 years');");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.Sql(@"UPDATE ""Gerbils"" SET ""Status"" = 'Active' WHERE ""Status"" = 'Breeding';");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,28 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace GerbilManagerWebAPI.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class AddLitterMortality : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AddColumn<int>(
|
|
||||||
name: "DeathsWithin8Weeks",
|
|
||||||
table: "Litters",
|
|
||||||
type: "integer",
|
|
||||||
nullable: true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "DeathsWithin8Weeks",
|
|
||||||
table: "Litters");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -924,9 +924,6 @@ namespace GerbilManagerWebAPI.Migrations
|
|||||||
b.Property<DateOnly>("Date")
|
b.Property<DateOnly>("Date")
|
||||||
.HasColumnType("date");
|
.HasColumnType("date");
|
||||||
|
|
||||||
b.Property<int?>("DeathsWithin8Weeks")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<DateOnly?>("ExpectedGoHomeDate")
|
b.Property<DateOnly?>("ExpectedGoHomeDate")
|
||||||
.HasColumnType("date");
|
.HasColumnType("date");
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace GerbilManagerWebAPI.Models
|
|||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
public required string Name { get; set; }
|
public required string Name { get; set; }
|
||||||
public Gender Gender { get; set; }
|
public Gender Gender { get; set; }
|
||||||
public GerbilStatus Status { get; set; } = GerbilStatus.Breeding;
|
public GerbilStatus Status { get; set; } = GerbilStatus.Active;
|
||||||
|
|
||||||
// Birth litter (the litter this gerbil was born in).
|
// Birth litter (the litter this gerbil was born in).
|
||||||
public Guid? LitterId { get; set; }
|
public Guid? LitterId { get; set; }
|
||||||
|
|||||||
@@ -1,17 +1,12 @@
|
|||||||
namespace GerbilManagerWebAPI.Models
|
namespace GerbilManagerWebAPI.Models
|
||||||
{
|
{
|
||||||
/// <summary>Lifecycle status of a gerbil. Serialised as the string name on the wire.
|
/// <summary>Lifecycle status of a gerbil. Serialised as the string name on the wire.</summary>
|
||||||
/// Deceased and GivenAway are DERIVED (set by GerbilStatusService, not free-form input).
|
|
||||||
/// Breeding/Pet/ForSale are the user-selectable live states.</summary>
|
|
||||||
public enum GerbilStatus
|
public enum GerbilStatus
|
||||||
{
|
{
|
||||||
/// <summary>Aktiv in der Zucht (vormals "Active").</summary>
|
Active = 0,
|
||||||
Breeding = 0,
|
|
||||||
Deceased = 1,
|
Deceased = 1,
|
||||||
GivenAway = 2,
|
GivenAway = 2,
|
||||||
/// <summary>Alive, at home, offered for Abgabe ("Abzugeben"). Drives FEAT-12 sale listing.</summary>
|
/// <summary>Alive, at home, offered for Abgabe ("Abzugeben"). Drives FEAT-12 sale listing.</summary>
|
||||||
ForSale = 3,
|
ForSale = 3
|
||||||
/// <summary>Lebendes Heimtier, nicht in Zucht ("Liebhaber").</summary>
|
|
||||||
Pet = 4,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,10 +13,6 @@ namespace GerbilManagerWebAPI.Models
|
|||||||
/// <summary>Total born count (was "Strength").</summary>
|
/// <summary>Total born count (was "Strength").</summary>
|
||||||
public int? TotalBorn { get; set; }
|
public int? TotalBorn { get; set; }
|
||||||
|
|
||||||
/// <summary>Frühsterblichkeit: Anzahl der in den ersten 8 Wochen verstorbenen Tiere.
|
|
||||||
/// Null = unbekannt (Altdaten). Must be ≤ TotalBorn if both are set.</summary>
|
|
||||||
public int? DeathsWithin8Weeks { get; set; }
|
|
||||||
|
|
||||||
public Guid? FatherId { get; set; }
|
public Guid? FatherId { get; set; }
|
||||||
public Gerbil? Father { get; set; }
|
public Gerbil? Father { get; set; }
|
||||||
public Guid? MotherId { get; set; }
|
public Guid? MotherId { get; set; }
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using GerbilManagerWebAPI.Endpoints;
|
using GerbilManagerWebAPI.Endpoints;
|
||||||
using GerbilManagerWebAPI.Models;
|
|
||||||
using GerbilManagerWebAPI.Services;
|
|
||||||
using Microsoft.AspNetCore.DataProtection;
|
using Microsoft.AspNetCore.DataProtection;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Scalar.AspNetCore;
|
using Scalar.AspNetCore;
|
||||||
@@ -86,23 +84,7 @@ app.MapScalarApiReference();
|
|||||||
if (!app.Environment.IsEnvironment("Testing"))
|
if (!app.Environment.IsEnvironment("Testing"))
|
||||||
{
|
{
|
||||||
using var scope = app.Services.CreateScope();
|
using var scope = app.Services.CreateScope();
|
||||||
var db = scope.ServiceProvider.GetRequiredService<ApplicationContext>();
|
scope.ServiceProvider.GetRequiredService<ApplicationContext>().Database.Migrate();
|
||||||
db.Database.Migrate();
|
|
||||||
|
|
||||||
// Startup sweep: derive status for animals that silently crossed the 7-year threshold
|
|
||||||
// since the last write. No-op if all statuses are already current.
|
|
||||||
var today = DateOnly.FromDateTime(DateTime.UtcNow);
|
|
||||||
var candidates = await db.Gerbils
|
|
||||||
.Where(g => g.Status != GerbilStatus.Deceased && g.Status != GerbilStatus.GivenAway
|
|
||||||
&& g.DateOfDeath == null && g.ReceiverContactId == null
|
|
||||||
&& g.DateOfBirth != null
|
|
||||||
&& g.DateOfBirth < today.AddYears(-GerbilStatusService.MaxAgeYears))
|
|
||||||
.ToListAsync();
|
|
||||||
if (candidates.Count > 0)
|
|
||||||
{
|
|
||||||
foreach (var g in candidates) g.Status = GerbilStatus.Deceased;
|
|
||||||
await db.SaveChangesAsync();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
app.UseCors(LanCorsPolicy);
|
app.UseCors(LanCorsPolicy);
|
||||||
|
|||||||
@@ -1,53 +0,0 @@
|
|||||||
using GerbilManagerWebAPI.Models;
|
|
||||||
|
|
||||||
namespace GerbilManagerWebAPI.Services
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Central status-derivation logic. Every write path (create/update gerbil, SaleContract
|
|
||||||
/// Abgabe, import, startup sweep) calls Apply() after setting the other fields so the
|
|
||||||
/// derived statuses (Deceased, GivenAway) are always consistent.
|
|
||||||
///
|
|
||||||
/// Precedence (highest wins):
|
|
||||||
/// 1) DateOfDeath set → Deceased (explicit, always)
|
|
||||||
/// 2) Abgabe (ReceiverContactId set) → GivenAway
|
|
||||||
/// 3) Age > MaxAgeYears without a death date or Abgabe → Deceased (presumed)
|
|
||||||
/// 4) User-supplied {Breeding, Pet, ForSale}; defaults Breeding if invalid
|
|
||||||
///
|
|
||||||
/// Age-based death is time-dependent. The stored column is kept up-to-date by:
|
|
||||||
/// a) Apply() on every write (catches the animal at write time)
|
|
||||||
/// b) A startup sweep in Program.cs (catches animals that silently crossed the threshold)
|
|
||||||
/// Gridify filters on the stored value, so status==Breeding never surfaces >7y animals.
|
|
||||||
/// </summary>
|
|
||||||
public static class GerbilStatusService
|
|
||||||
{
|
|
||||||
public const int MaxAgeYears = 7;
|
|
||||||
|
|
||||||
/// <summary>Derives and sets g.Status using the gerbil's current field values.
|
|
||||||
/// Must be called AFTER all other fields (DateOfDeath, ReceiverContactId, DateOfBirth)
|
|
||||||
/// have been applied. today = DateOnly.FromDateTime(DateTime.UtcNow).</summary>
|
|
||||||
public static void Apply(Gerbil g, DateOnly today)
|
|
||||||
{
|
|
||||||
g.Status = Derive(g.Status, g.DateOfBirth, g.DateOfDeath,
|
|
||||||
isAbgegeben: g.ReceiverContactId is not null, today);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>Pure derivation — useful for tests and the migration backfill.</summary>
|
|
||||||
public static GerbilStatus Derive(
|
|
||||||
GerbilStatus requested,
|
|
||||||
DateOnly? dateOfBirth,
|
|
||||||
DateOnly? dateOfDeath,
|
|
||||||
bool isAbgegeben,
|
|
||||||
DateOnly today)
|
|
||||||
{
|
|
||||||
if (dateOfDeath is not null) return GerbilStatus.Deceased;
|
|
||||||
if (isAbgegeben) return GerbilStatus.GivenAway;
|
|
||||||
if (dateOfBirth is not null && IsOlderThan(dateOfBirth.Value, MaxAgeYears, today))
|
|
||||||
return GerbilStatus.Deceased;
|
|
||||||
return requested is GerbilStatus.Breeding or GerbilStatus.Pet or GerbilStatus.ForSale
|
|
||||||
? requested : GerbilStatus.Breeding;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool IsOlderThan(DateOnly dob, int years, DateOnly today) =>
|
|
||||||
today >= dob.AddYears(years);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -64,7 +64,7 @@ _Quelldatei = die Stammbaum-Datei(en) in `C:\Users\gulum\dev\Sttammbäume\`, in
|
|||||||
**B) Gencode-Konflikt** (+ ggf. Sterbedatum):
|
**B) Gencode-Konflikt** (+ ggf. Sterbedatum):
|
||||||
| Tier | Konflikt — was stimmt? | Quelldatei(en) |
|
| Tier | Konflikt — was stimmt? | Quelldatei(en) |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
| ~~Milon v.d. K.C. (*27.11.2014)~~ ✅ | A-Locus **Aa** (erledigt — Julian 2026-06-07: Aa gewinnt gg. aa) | — |
|
| Milon v.d. K.C. (*27.11.2014) | A-Locus: **Aa** ↔ **aa** | Stammbaum von **South Dakota**.xlsx · von **Tennessee**.xlsx |
|
||||||
| ~~Percy of little runners (*16.12.2017)~~ ✅ | P-Locus **Pp** (erledigt) | — |
|
| ~~Percy of little runners (*16.12.2017)~~ ✅ | P-Locus **Pp** (erledigt) | — |
|
||||||
| ~~Iwana of little runners (*02.10.2018)~~ ✅ | P-Locus **Pp** (erledigt) | — |
|
| ~~Iwana of little runners (*02.10.2018)~~ ✅ | P-Locus **Pp** (erledigt) | — |
|
||||||
| ~~Sokrates v.d. K.C. (*14.12.2015)~~ ✅ | **D-** + Sterbedatum **20.05.2019** (erledigt) | — |
|
| ~~Sokrates v.d. K.C. (*14.12.2015)~~ ✅ | **D-** + Sterbedatum **20.05.2019** (erledigt) | — |
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
/** FARBSCHLAG-GENOTYPE-SYNC: Bidirektionale Sync im Tier-Formular. */
|
|
||||||
import { de, expect, skipUnlessMock, test } from './fixtures'
|
|
||||||
|
|
||||||
const t = de.pages.gerbils
|
|
||||||
|
|
||||||
test('Farbschlag-Auswahl füllt Gencode automatisch aus', async ({ page }) => {
|
|
||||||
skipUnlessMock()
|
|
||||||
await page.goto('/rennmaeuse/neu')
|
|
||||||
|
|
||||||
const farbschlagSelect = page
|
|
||||||
.locator('label.field', { has: page.locator(`span:text-is("${t.fields.colorVariety}")`) })
|
|
||||||
.locator('select')
|
|
||||||
const genotypeInput = page
|
|
||||||
.locator('label.field', { has: page.locator(`span:text-is("${t.fields.genotype}")`) })
|
|
||||||
.locator('input')
|
|
||||||
|
|
||||||
// Vor der Auswahl ist das Gencode-Feld leer.
|
|
||||||
await expect(genotypeInput).toHaveValue('')
|
|
||||||
|
|
||||||
// 'Agouti' wählen → Gencode wird automatisch befüllt.
|
|
||||||
await farbschlagSelect.selectOption({ label: 'Agouti' })
|
|
||||||
await expect(genotypeInput).toHaveValue('AA CC DD EE GG PP spsp rere')
|
|
||||||
})
|
|
||||||
|
|
||||||
test('Gencode-Eingabe aktualisiert die Farbschlag-Auswahl', async ({ page }) => {
|
|
||||||
skipUnlessMock()
|
|
||||||
await page.goto('/rennmaeuse/neu')
|
|
||||||
|
|
||||||
const farbschlagSelect = page
|
|
||||||
.locator('label.field', { has: page.locator(`span:text-is("${t.fields.colorVariety}")`) })
|
|
||||||
.locator('select')
|
|
||||||
const genotypeInput = page
|
|
||||||
.locator('label.field', { has: page.locator(`span:text-is("${t.fields.genotype}")`) })
|
|
||||||
.locator('input')
|
|
||||||
|
|
||||||
// Gencode für Schwarz eintippen → Farbschlag-Select springt auf 'Schwarz'.
|
|
||||||
await genotypeInput.fill('aa CC DD EE GG PP spsp rere')
|
|
||||||
await expect(farbschlagSelect).toHaveValue('cv-schwarz')
|
|
||||||
})
|
|
||||||
|
|
||||||
test('Gencode ohne passende Farbschlag-Auswahl leert das Dropdown', async ({ page }) => {
|
|
||||||
skipUnlessMock()
|
|
||||||
await page.goto('/rennmaeuse/neu')
|
|
||||||
|
|
||||||
const farbschlagSelect = page
|
|
||||||
.locator('label.field', { has: page.locator(`span:text-is("${t.fields.colorVariety}")`) })
|
|
||||||
.locator('select')
|
|
||||||
const genotypeInput = page
|
|
||||||
.locator('label.field', { has: page.locator(`span:text-is("${t.fields.genotype}")`) })
|
|
||||||
.locator('input')
|
|
||||||
|
|
||||||
// Zuerst eine bekannte Farbe wählen, damit das Select belegt ist.
|
|
||||||
await farbschlagSelect.selectOption({ label: 'Agouti' })
|
|
||||||
await expect(farbschlagSelect).not.toHaveValue('')
|
|
||||||
|
|
||||||
// Marder-Genotyp: bekannte Farbe im Engine, aber NICHT im Mock-Dropdown
|
|
||||||
// → Select wird auf '' (kein Eintrag) zurückgesetzt.
|
|
||||||
await genotypeInput.fill('aa cchmcchm DD EE GG PP spsp rere')
|
|
||||||
await expect(farbschlagSelect).toHaveValue('')
|
|
||||||
})
|
|
||||||
|
|
||||||
test('Unbekannter Genotyp leert das Farbschlag-Dropdown (Unbekannt-Fall)', async ({ page }) => {
|
|
||||||
skipUnlessMock()
|
|
||||||
await page.goto('/rennmaeuse/neu')
|
|
||||||
|
|
||||||
const farbschlagSelect = page
|
|
||||||
.locator('label.field', { has: page.locator(`span:text-is("${t.fields.colorVariety}")`) })
|
|
||||||
.locator('select')
|
|
||||||
const genotypeInput = page
|
|
||||||
.locator('label.field', { has: page.locator(`span:text-is("${t.fields.genotype}")`) })
|
|
||||||
.locator('input')
|
|
||||||
|
|
||||||
await farbschlagSelect.selectOption({ label: 'Blau' })
|
|
||||||
await expect(farbschlagSelect).not.toHaveValue('')
|
|
||||||
|
|
||||||
// aa CC dd EE gg pp → Unbekannter Farbschlag (nicht im Katalog) → Select leert sich.
|
|
||||||
await genotypeInput.fill('aa CC dd EE gg pp spsp rere')
|
|
||||||
await expect(farbschlagSelect).toHaveValue('')
|
|
||||||
})
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
/** LITTER-JUVENILE-DETAILS + JUVENILE-AVATARS: Jungtier-Felder und Foto-Avatare 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`)
|
|
||||||
})
|
|
||||||
|
|
||||||
test('JUVENILE-AVATARS: Pippa zeigt Foto-Avatar, Benny zeigt GerbilIcon', async ({ page }) => {
|
|
||||||
skipUnlessMock()
|
|
||||||
await page.goto('/wuerfe/w-kruemel')
|
|
||||||
await expect(page.getByRole('heading', { name: 'Wurf K' })).toBeVisible()
|
|
||||||
|
|
||||||
// Pippa hat profilePhotoUrl → <img.juvenile-photo__avatar> sichtbar
|
|
||||||
const pippaCard = page.getByRole('link', { name: /Pippa/ })
|
|
||||||
await expect(pippaCard.locator('.juvenile-photo__avatar')).toBeVisible()
|
|
||||||
|
|
||||||
// Benny hat kein Foto → kein img, SVG-Icon (GerbilIcon) sichtbar
|
|
||||||
const bennyCard = page.getByRole('link', { name: /Benny/ })
|
|
||||||
await expect(bennyCard.locator('.juvenile-photo__avatar')).not.toBeVisible()
|
|
||||||
await expect(bennyCard.locator('svg')).toBeVisible()
|
|
||||||
})
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
/** LITTER-MORTALITY: deathsWithin8Weeks im Wurf-Formular und -Detail. */
|
|
||||||
import { de, expect, skipUnlessMock, test, uniqueName } from './fixtures'
|
|
||||||
|
|
||||||
const t = de.pages.litters
|
|
||||||
|
|
||||||
test('Wurf-Detail zeigt Frühverluste wenn gesetzt', async ({ page }) => {
|
|
||||||
skipUnlessMock()
|
|
||||||
await page.goto('/wuerfe/w-kruemel')
|
|
||||||
await expect(page.getByRole('heading', { name: 'Wurf K' })).toBeVisible()
|
|
||||||
// Frühverluste-Zeile im def-list: Label + Wert '1'
|
|
||||||
const mortalityRow = page.locator('.def-row', {
|
|
||||||
has: page.locator('dt', { hasText: t.fields.deathsWithin8Weeks }),
|
|
||||||
})
|
|
||||||
await expect(mortalityRow).toBeVisible()
|
|
||||||
await expect(mortalityRow.locator('dd')).toHaveText('1')
|
|
||||||
})
|
|
||||||
|
|
||||||
test('Wurf-Formular speichert Frühverluste und zeigt sie im Detail', async ({ page }) => {
|
|
||||||
skipUnlessMock()
|
|
||||||
const name = uniqueName('WurfM')
|
|
||||||
await page.goto('/wuerfe/neu')
|
|
||||||
await page.getByLabel(`${t.fields.name} *`).fill(name)
|
|
||||||
await page.getByLabel(`${t.fields.date} *`).fill('2026-01-10')
|
|
||||||
|
|
||||||
// Frühverluste eingeben
|
|
||||||
await page.getByLabel(t.fields.deathsWithin8Weeks).fill('2')
|
|
||||||
await expect(page.getByText(t.validation.deathsExceedTotalBorn)).not.toBeVisible()
|
|
||||||
|
|
||||||
await page.getByRole('button', { name: t.form.save, exact: true }).click()
|
|
||||||
await expect(page.getByRole('heading', { name })).toBeVisible()
|
|
||||||
// Frühverluste-Zeile im Detail
|
|
||||||
const mortalityRow = page.locator('.def-row', {
|
|
||||||
has: page.locator('dt', { hasText: t.fields.deathsWithin8Weeks }),
|
|
||||||
})
|
|
||||||
await expect(mortalityRow).toBeVisible()
|
|
||||||
await expect(mortalityRow.locator('dd')).toHaveText('2')
|
|
||||||
})
|
|
||||||
|
|
||||||
test('Frühverluste > Wurfstärke zeigt Warnmeldung', async ({ page }) => {
|
|
||||||
skipUnlessMock()
|
|
||||||
await page.goto('/wuerfe/neu')
|
|
||||||
|
|
||||||
await page.getByLabel(t.fields.totalBorn).fill('3')
|
|
||||||
await page.getByLabel(t.fields.deathsWithin8Weeks).fill('5')
|
|
||||||
await expect(page.getByText(t.validation.deathsExceedTotalBorn)).toBeVisible()
|
|
||||||
})
|
|
||||||
@@ -91,7 +91,7 @@ function gerbil(
|
|||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
gender,
|
gender,
|
||||||
status: 'Breeding',
|
status: 'Active',
|
||||||
dateOfBirth,
|
dateOfBirth,
|
||||||
dateOfDeath: null,
|
dateOfDeath: null,
|
||||||
causeOfDeath: null,
|
causeOfDeath: null,
|
||||||
@@ -108,7 +108,6 @@ function gerbil(
|
|||||||
notes: null,
|
notes: null,
|
||||||
// BESTAND-FILTER: default = eigener Bestand; einzelne externe Ahnen unten gesetzt.
|
// BESTAND-FILTER: default = eigener Bestand; einzelne externe Ahnen unten gesetzt.
|
||||||
isResident: true,
|
isResident: true,
|
||||||
profilePhotoUrl: null,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +120,7 @@ export function seedDb(): MockDb {
|
|||||||
originContactId: 'con-meier',
|
originContactId: 'con-meier',
|
||||||
originBreeder: 'Clan-Kleine-Chaoten',
|
originBreeder: 'Clan-Kleine-Chaoten',
|
||||||
},
|
},
|
||||||
{ ...gerbil('fridolin', 'Fridolin', 'male', '2023-05-01', 'w-fridolin', 'cv-schwarz', 'aa CC DD EE GG PP spsp rere'), enclosureId: 'enc-gross', originBreeder: 'Zoohandlung Meier', profilePhotoUrl: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==' },
|
{ ...gerbil('fridolin', 'Fridolin', 'male', '2023-05-01', 'w-fridolin', 'cv-schwarz', 'aa CC DD EE GG PP spsp rere'), enclosureId: 'enc-gross', originBreeder: 'Zoohandlung Meier' },
|
||||||
gerbil('luna', 'Luna', 'female', '2023-08-15', 'w-luna', 'cv-gold', 'AA CC DD EE GG pp spsp rere'),
|
gerbil('luna', 'Luna', 'female', '2023-08-15', 'w-luna', 'cv-gold', 'AA CC DD EE GG pp spsp rere'),
|
||||||
gerbil('balu', 'Balu', 'male', '2021-04-20', 'w-balu', 'cv-agouti'),
|
gerbil('balu', 'Balu', 'male', '2021-04-20', 'w-balu', 'cv-agouti'),
|
||||||
gerbil('maja', 'Maja', 'female', '2021-06-11', null, 'cv-schwarz-schecke', 'aa CC DD EE GG PP Spsp rere'),
|
gerbil('maja', 'Maja', 'female', '2021-06-11', null, 'cv-schwarz-schecke', 'aa CC DD EE GG PP Spsp rere'),
|
||||||
@@ -152,27 +151,12 @@ 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.
|
|
||||||
// JUVENILE-AVATARS: Pippa hat profilePhotoUrl (1×1-PNG data-URI) → Avatar-Img sichtbar.
|
|
||||||
{
|
|
||||||
...gerbil('pup-abgabe', 'Pippa', 'female', '2025-03-12', 'w-kruemel', 'cv-gold'),
|
|
||||||
status: 'GivenAway' as const,
|
|
||||||
goHomeDate: '2025-05-01',
|
|
||||||
receiverContactId: 'con-huber',
|
|
||||||
profilePhotoUrl: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
...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),
|
||||||
]
|
]
|
||||||
|
|
||||||
const litters: Litter[] = [
|
const litters: Litter[] = [
|
||||||
{ id: 'w-kruemel', name: 'Wurf K', date: '2025-03-12', totalBorn: 5, expectedGoHomeDate: '2025-04-16', notes: null, fatherId: 'fridolin', motherId: 'luna', deathsWithin8Weeks: 1 },
|
{ id: 'w-kruemel', name: 'Wurf K', date: '2025-03-12', totalBorn: 5, expectedGoHomeDate: '2025-04-16', notes: null, fatherId: 'fridolin', motherId: 'luna' },
|
||||||
{ id: 'w-fridolin', name: 'Wurf F', date: '2023-05-01', totalBorn: 4, expectedGoHomeDate: null, notes: null, fatherId: 'balu', motherId: 'maja' },
|
{ id: 'w-fridolin', name: 'Wurf F', date: '2023-05-01', totalBorn: 4, expectedGoHomeDate: null, notes: null, fatherId: 'balu', motherId: 'maja' },
|
||||||
{ id: 'w-luna', name: 'Wurf L', date: '2023-08-15', totalBorn: 6, expectedGoHomeDate: null, notes: null, fatherId: 'karlsson', motherId: 'smilla' },
|
{ id: 'w-luna', name: 'Wurf L', date: '2023-08-15', totalBorn: 6, expectedGoHomeDate: null, notes: null, fatherId: 'karlsson', motherId: 'smilla' },
|
||||||
{ id: 'w-balu', name: 'Wurf B', date: '2021-04-20', totalBorn: 3, expectedGoHomeDate: null, notes: null, fatherId: 'anton', motherId: 'greta' },
|
{ id: 'w-balu', name: 'Wurf B', date: '2021-04-20', totalBorn: 3, expectedGoHomeDate: null, notes: null, fatherId: 'anton', motherId: 'greta' },
|
||||||
|
|||||||
@@ -154,20 +154,3 @@ test('Gencode-Chip zeigt Genotyp statt Farbname (STAMMBAUM-GENCODE)', async ({ p
|
|||||||
const fridolinCard = page.locator('.pedigree-card').filter({ hasText: 'Fridolin' })
|
const fridolinCard = page.locator('.pedigree-card').filter({ hasText: 'Fridolin' })
|
||||||
await expect(fridolinCard.locator('.pedigree-chip')).toContainText('aa CC')
|
await expect(fridolinCard.locator('.pedigree-chip')).toContainText('aa CC')
|
||||||
})
|
})
|
||||||
|
|
||||||
test('Tier mit Foto zeigt Avatar-Bild, Tier ohne Foto zeigt Rennmaus-Icon (STAMMBAUM-AVATAR)', async ({ page }) => {
|
|
||||||
skipUnlessMock()
|
|
||||||
// Fridolin hat profilePhotoUrl (data URI) → <img.pedigree-card__avatar> sichtbar
|
|
||||||
// Krümel hat profilePhotoUrl=null → kein img, SVG-Icon sichtbar
|
|
||||||
await page.goto('/rennmaeuse/kruemel/stammbaum')
|
|
||||||
await expect(page.locator('.pedigree-card').first()).toBeVisible()
|
|
||||||
|
|
||||||
// Fridolin ist Vater von Krümel → seine Karte enthält ein <img>
|
|
||||||
const fridolinCard = page.locator('.pedigree-card').filter({ hasText: 'Fridolin' })
|
|
||||||
await expect(fridolinCard.locator('img.pedigree-card__avatar')).toBeVisible()
|
|
||||||
|
|
||||||
// Krümel (root) hat kein Foto → SVG-Icon im Foto-Slot
|
|
||||||
const rootCard = page.locator('.pedigree-card.pedigree-card--root')
|
|
||||||
await expect(rootCard.locator('img.pedigree-card__avatar')).not.toBeAttached()
|
|
||||||
await expect(rootCard.locator('svg[role="img"]')).toBeVisible()
|
|
||||||
})
|
|
||||||
|
|||||||
@@ -1,58 +0,0 @@
|
|||||||
/** STATUS-MODEL: Zucht/Liebhaber wählbar; Verstorben/Abgegeben abgeleitet (read-only). */
|
|
||||||
import { de, expect, skipUnlessMock, test, uniqueName } from './fixtures'
|
|
||||||
|
|
||||||
const t = de.pages.gerbils
|
|
||||||
|
|
||||||
test('Tier-Formular zeigt nur wählbare Statuswerte im Dropdown', async ({ page }) => {
|
|
||||||
skipUnlessMock()
|
|
||||||
await page.goto('/rennmaeuse/neu')
|
|
||||||
const statusField = page.locator('label.field', {
|
|
||||||
has: page.locator(`span:text-is("${t.fields.status}")`),
|
|
||||||
})
|
|
||||||
// Zucht (Breeding) ist vorausgewählt
|
|
||||||
await expect(statusField.locator('select')).toHaveValue('Breeding')
|
|
||||||
// Optionen: nur Zucht, Liebhaber, Abzugeben (NICHT Verstorben/Abgegeben)
|
|
||||||
const opts = statusField.locator('select option')
|
|
||||||
await expect(opts.filter({ hasText: t.statusLabels.Breeding })).toHaveCount(1)
|
|
||||||
await expect(opts.filter({ hasText: t.statusLabels.Pet })).toHaveCount(1)
|
|
||||||
await expect(opts.filter({ hasText: t.statusLabels.ForSale })).toHaveCount(1)
|
|
||||||
await expect(opts.filter({ hasText: t.statusLabels.Deceased })).toHaveCount(0)
|
|
||||||
await expect(opts.filter({ hasText: t.statusLabels.GivenAway })).toHaveCount(0)
|
|
||||||
})
|
|
||||||
|
|
||||||
test('Tier-Formular zeigt abgeleiteten Status Verstorben als Text + Hinweis', async ({ page }) => {
|
|
||||||
skipUnlessMock()
|
|
||||||
// Willi ist Deceased
|
|
||||||
await page.goto('/rennmaeuse/willi/bearbeiten')
|
|
||||||
// Status-Select ist NICHT vorhanden (abgeleitet)
|
|
||||||
const statusField = page.locator('.field', {
|
|
||||||
has: page.locator(`span:text-is("${t.fields.status}")`),
|
|
||||||
})
|
|
||||||
await expect(statusField).toBeVisible()
|
|
||||||
await expect(statusField.locator('select')).toHaveCount(0)
|
|
||||||
await expect(statusField).toContainText(t.statusLabels.Deceased)
|
|
||||||
await expect(statusField).toContainText(t.form.statusDerivedHint.Deceased)
|
|
||||||
})
|
|
||||||
|
|
||||||
test('Tiere-Liste zeigt Zucht als Standard-Status-Filter', async ({ page }) => {
|
|
||||||
skipUnlessMock()
|
|
||||||
await page.goto('/rennmaeuse')
|
|
||||||
const statusSelect = page
|
|
||||||
.locator('label.field', { has: page.locator(`span:text-is("${t.filters.status}")`) })
|
|
||||||
.locator('select')
|
|
||||||
await expect(statusSelect).toHaveValue('Breeding')
|
|
||||||
})
|
|
||||||
|
|
||||||
test('Neues Tier anlegen mit Status Liebhaber', async ({ page }) => {
|
|
||||||
skipUnlessMock()
|
|
||||||
const name = uniqueName('Tier')
|
|
||||||
await page.goto('/rennmaeuse/neu')
|
|
||||||
await page.getByLabel(`${t.fields.name} *`).fill(name)
|
|
||||||
await page.getByLabel(`${t.fields.gender} *`).selectOption({ label: t.genderLabels.male })
|
|
||||||
const statusField = page.locator('label.field', {
|
|
||||||
has: page.locator(`span:text-is("${t.fields.status}")`),
|
|
||||||
})
|
|
||||||
await statusField.locator('select').selectOption({ label: t.statusLabels.Pet })
|
|
||||||
await page.getByRole('button', { name: t.form.save, exact: true }).click()
|
|
||||||
await expect(page.getByRole('heading', { name })).toBeVisible()
|
|
||||||
})
|
|
||||||
@@ -10,11 +10,9 @@
|
|||||||
export type Gender = 'unknown' | 'male' | 'female'
|
export type Gender = 'unknown' | 'male' | 'female'
|
||||||
export const GENDERS: Gender[] = ['unknown', 'male', 'female']
|
export const GENDERS: Gender[] = ['unknown', 'male', 'female']
|
||||||
|
|
||||||
/** Gerbil.Status — C# enum { Breeding, Pet, Deceased, GivenAway, ForSale }. STATUS-MODEL: Active→Breeding (gated on Pam feature/status-model). */
|
/** Gerbil.Status — C# enum { Active, Deceased, GivenAway, ForSale }. */
|
||||||
export type GerbilStatus = 'Breeding' | 'Pet' | 'Deceased' | 'GivenAway' | 'ForSale'
|
export type GerbilStatus = 'Active' | 'Deceased' | 'GivenAway' | 'ForSale'
|
||||||
export const GERBIL_STATUSES: GerbilStatus[] = ['Breeding', 'Pet', 'ForSale', 'Deceased', 'GivenAway']
|
export const GERBIL_STATUSES: GerbilStatus[] = ['Active', 'ForSale', 'Deceased', 'GivenAway']
|
||||||
/** Statuses the user can pick freely in the form; Deceased+GivenAway are derived by the backend. */
|
|
||||||
export const SELECTABLE_STATUSES: GerbilStatus[] = ['Breeding', 'Pet', 'ForSale']
|
|
||||||
|
|
||||||
/** ISO date string "YYYY-MM-DD" (maps to C# DateOnly). */
|
/** ISO date string "YYYY-MM-DD" (maps to C# DateOnly). */
|
||||||
export type DateOnlyString = string
|
export type DateOnlyString = string
|
||||||
@@ -58,8 +56,6 @@ export interface Gerbil {
|
|||||||
isResident?: boolean
|
isResident?: boolean
|
||||||
/** FORM-FIELDS-1: true=gehörlos, false=hörend, null=unbekannt. */
|
/** FORM-FIELDS-1: true=gehörlos, false=hörend, null=unbekannt. */
|
||||||
isDeaf?: boolean | null
|
isDeaf?: boolean | null
|
||||||
/** STAMMBAUM-AVATAR: URL des Profilfotos (erstes Foto nach sortOrder); null = kein Foto. API-relativ oder absolut. */
|
|
||||||
profilePhotoUrl?: string | null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Payload for POST /gerbils. */
|
/** Payload for POST /gerbils. */
|
||||||
@@ -126,8 +122,6 @@ export interface Litter {
|
|||||||
notes?: string | null
|
notes?: string | null
|
||||||
fatherId: string | null
|
fatherId: string | null
|
||||||
motherId: string | null
|
motherId: string | null
|
||||||
/** LITTER-MORTALITY: pups that died within the first 8 weeks. */
|
|
||||||
deathsWithin8Weeks?: number | null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Payload for POST /litters. */
|
/** Payload for POST /litters. */
|
||||||
@@ -139,7 +133,6 @@ export interface CreateLitter {
|
|||||||
notes?: string | null
|
notes?: string | null
|
||||||
fatherId?: string | null
|
fatherId?: string | null
|
||||||
motherId?: string | null
|
motherId?: string | null
|
||||||
deathsWithin8Weeks?: number | null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UpdateLitter = Partial<CreateLitter>
|
export type UpdateLitter = Partial<CreateLitter>
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ import { Link, useNavigate, useParams, useSearchParams } from 'react-router-dom'
|
|||||||
import { de } from '../strings/de'
|
import { de } from '../strings/de'
|
||||||
import { createGerbil, getGerbil, updateGerbil } from '../api/gerbils'
|
import { createGerbil, getGerbil, updateGerbil } from '../api/gerbils'
|
||||||
import { listColorVarieties, listContacts, listEnclosures, listLitters } from '../api/lookups'
|
import { listColorVarieties, listContacts, listEnclosures, listLitters } from '../api/lookups'
|
||||||
import { GENDERS, SELECTABLE_STATUSES, type CreateGerbil, type Gender, type GerbilStatus } from '../api/types'
|
import { GENDERS, GERBIL_STATUSES, type CreateGerbil, type Gender, type GerbilStatus } from '../api/types'
|
||||||
import { useApi, useMutation } from '../hooks/useApi'
|
import { useApi, useMutation } from '../hooks/useApi'
|
||||||
import { genderLabel, statusLabel } from '../format/labels'
|
import { genderLabel, statusLabel } from '../format/labels'
|
||||||
import { fromDisplayString, genotypeToFarbschlag, UNKNOWN_FARBSCHLAG } from '../genetics'
|
import { fromDisplayString } from '../genetics'
|
||||||
import FarbschlagImage from '../components/FarbschlagImage'
|
import FarbschlagImage from '../components/FarbschlagImage'
|
||||||
import NameSuggestPanel from '../components/NameSuggestPanel'
|
import NameSuggestPanel from '../components/NameSuggestPanel'
|
||||||
import '../components/NameSuggestPanel.css'
|
import '../components/NameSuggestPanel.css'
|
||||||
@@ -34,7 +34,7 @@ interface FormState {
|
|||||||
const EMPTY: FormState = {
|
const EMPTY: FormState = {
|
||||||
name: '',
|
name: '',
|
||||||
gender: '',
|
gender: '',
|
||||||
status: 'Breeding',
|
status: 'Active',
|
||||||
dateOfBirth: '',
|
dateOfBirth: '',
|
||||||
dateOfDeath: '',
|
dateOfDeath: '',
|
||||||
causeOfDeath: '',
|
causeOfDeath: '',
|
||||||
@@ -245,29 +245,16 @@ export default function GerbilFormPage() {
|
|||||||
{errors.gender && <small className="error-text">{errors.gender}</small>}
|
{errors.gender && <small className="error-text">{errors.gender}</small>}
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
{/* STATUS-MODEL: Deceased/GivenAway are derived by the backend — show as read-only with hint */}
|
<label className="field">
|
||||||
{form.status === 'Deceased' || form.status === 'GivenAway' ? (
|
<span>{t.fields.status}</span>
|
||||||
<div className="field">
|
<select value={form.status} onChange={(e) => set('status', e.target.value as GerbilStatus)}>
|
||||||
<span>{t.fields.status}</span>
|
{GERBIL_STATUSES.map((s) => (
|
||||||
<span className="muted">
|
<option key={s} value={s}>
|
||||||
{statusLabel(form.status)}
|
{statusLabel(s)}
|
||||||
<small className="muted" style={{ marginLeft: '0.5rem' }}>
|
</option>
|
||||||
({t.form.statusDerivedHint[form.status]})
|
))}
|
||||||
</small>
|
</select>
|
||||||
</span>
|
</label>
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<label className="field">
|
|
||||||
<span>{t.fields.status}</span>
|
|
||||||
<select value={form.status} onChange={(e) => set('status', e.target.value as GerbilStatus)}>
|
|
||||||
{SELECTABLE_STATUSES.map((s) => (
|
|
||||||
<option key={s} value={s}>
|
|
||||||
{statusLabel(s)}
|
|
||||||
</option>
|
|
||||||
))}
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<label className="field">
|
<label className="field">
|
||||||
<span>{t.fields.dateOfBirth}</span>
|
<span>{t.fields.dateOfBirth}</span>
|
||||||
@@ -320,14 +307,7 @@ export default function GerbilFormPage() {
|
|||||||
<span className="farbschlag-value">
|
<span className="farbschlag-value">
|
||||||
<select
|
<select
|
||||||
value={form.colorVarietyId}
|
value={form.colorVarietyId}
|
||||||
onChange={(e) => {
|
onChange={(e) => set('colorVarietyId', e.target.value)}
|
||||||
const newId = e.target.value
|
|
||||||
set('colorVarietyId', newId)
|
|
||||||
if (newId) {
|
|
||||||
const variety = (colorVarieties.data ?? []).find((cv) => cv.id === newId)
|
|
||||||
if (variety?.canonicalGenotype) set('genotype', variety.canonicalGenotype)
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<option value="">{t.form.none}</option>
|
<option value="">{t.form.none}</option>
|
||||||
{(colorVarieties.data ?? []).map((cv) => (
|
{(colorVarieties.data ?? []).map((cv) => (
|
||||||
@@ -407,23 +387,7 @@ export default function GerbilFormPage() {
|
|||||||
className="input"
|
className="input"
|
||||||
value={form.genotype}
|
value={form.genotype}
|
||||||
placeholder="Aa CC Dd EE GG Pp Spsp rere"
|
placeholder="Aa CC Dd EE GG Pp Spsp rere"
|
||||||
onChange={(e) => {
|
onChange={(e) => set('genotype', e.target.value)}
|
||||||
const val = e.target.value
|
|
||||||
set('genotype', val)
|
|
||||||
if (val.trim() !== '' && isGenotypeValid(val)) {
|
|
||||||
try {
|
|
||||||
const name = genotypeToFarbschlag(fromDisplayString(val))
|
|
||||||
if (name === UNKNOWN_FARBSCHLAG) {
|
|
||||||
set('colorVarietyId', '')
|
|
||||||
} else {
|
|
||||||
const match = (colorVarieties.data ?? []).find((cv) => cv.name === name)
|
|
||||||
set('colorVarietyId', match?.id ?? '')
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
// invalid while typing — leave colorVarietyId unchanged
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
aria-invalid={Boolean(errors.genotype)}
|
aria-invalid={Boolean(errors.genotype)}
|
||||||
/>
|
/>
|
||||||
<small className={errors.genotype ? 'error-text' : 'muted'}>
|
<small className={errors.genotype ? 'error-text' : 'muted'}>
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ const SORT_ORDER_BY: Record<SortKey, string> = {
|
|||||||
export default function GerbilsPage() {
|
export default function GerbilsPage() {
|
||||||
const t = de.pages.gerbils
|
const t = de.pages.gerbils
|
||||||
const [search, setSearch] = useState('')
|
const [search, setSearch] = useState('')
|
||||||
const [status, setStatus] = useState<GerbilStatus | ''>('Breeding')
|
const [status, setStatus] = useState<GerbilStatus | ''>('Active')
|
||||||
const [gender, setGender] = useState<Gender | ''>('')
|
const [gender, setGender] = useState<Gender | ''>('')
|
||||||
const [colorVarietyId, setColorVarietyId] = useState('')
|
const [colorVarietyId, setColorVarietyId] = useState('')
|
||||||
const [originBreeder, setOriginBreeder] = useState('')
|
const [originBreeder, setOriginBreeder] = useState('')
|
||||||
@@ -64,7 +64,7 @@ export default function GerbilsPage() {
|
|||||||
|
|
||||||
const resetFilters = () => {
|
const resetFilters = () => {
|
||||||
setSearch('')
|
setSearch('')
|
||||||
setStatus('Breeding')
|
setStatus('Active')
|
||||||
setGender('')
|
setGender('')
|
||||||
setColorVarietyId('')
|
setColorVarietyId('')
|
||||||
setOriginBreeder('')
|
setOriginBreeder('')
|
||||||
@@ -85,7 +85,7 @@ export default function GerbilsPage() {
|
|||||||
|
|
||||||
// UX-MOBILE-1: count non-default filter values for the badge.
|
// UX-MOBILE-1: count non-default filter values for the badge.
|
||||||
const activeFilterCount =
|
const activeFilterCount =
|
||||||
(status !== 'Breeding' ? 1 : 0) +
|
(status !== 'Active' ? 1 : 0) +
|
||||||
(gender !== '' ? 1 : 0) +
|
(gender !== '' ? 1 : 0) +
|
||||||
(colorVarietyId !== '' ? 1 : 0) +
|
(colorVarietyId !== '' ? 1 : 0) +
|
||||||
(originBreeder !== '' ? 1 : 0) +
|
(originBreeder !== '' ? 1 : 0) +
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import { Link, useNavigate, useParams } from 'react-router-dom'
|
|||||||
import Tree from 'react-d3-tree'
|
import Tree from 'react-d3-tree'
|
||||||
import type { CustomNodeElementProps, Point, RawNodeDatum } from 'react-d3-tree'
|
import type { CustomNodeElementProps, Point, RawNodeDatum } from 'react-d3-tree'
|
||||||
import { de } from '../strings/de'
|
import { de } from '../strings/de'
|
||||||
import { API_BASE_URL, ApiError } from '../api/client'
|
import { ApiError } from '../api/client'
|
||||||
import { listLitters } from '../api/litters'
|
import { listLitters } from '../api/litters'
|
||||||
import { listColorVarieties } from '../api/lookups'
|
import { listColorVarieties } from '../api/lookups'
|
||||||
import { getInbreedingCoefficient } from '../api/pedigree'
|
import { getInbreedingCoefficient } from '../api/pedigree'
|
||||||
@@ -381,13 +381,6 @@ function PedigreeCard({
|
|||||||
const g = node.gerbil
|
const g = node.gerbil
|
||||||
const chip = farbschlag ? chipColorFor(farbschlag) : null
|
const chip = farbschlag ? chipColorFor(farbschlag) : null
|
||||||
const dob = g.dateOfBirth ? formatDate(g.dateOfBirth) : null
|
const dob = g.dateOfBirth ? formatDate(g.dateOfBirth) : null
|
||||||
const [failedUrl, setFailedUrl] = useState<string | null>(null)
|
|
||||||
const rawUrl = g.profilePhotoUrl
|
|
||||||
? /^(https?:|data:|\/\/)/.test(g.profilePhotoUrl)
|
|
||||||
? g.profilePhotoUrl
|
|
||||||
: `${API_BASE_URL}${g.profilePhotoUrl}`
|
|
||||||
: null
|
|
||||||
const photoUrl = rawUrl !== failedUrl ? rawUrl : null
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={isRoot ? 'pedigree-card pedigree-card--root' : 'pedigree-card'}
|
className={isRoot ? 'pedigree-card pedigree-card--root' : 'pedigree-card'}
|
||||||
@@ -395,17 +388,9 @@ function PedigreeCard({
|
|||||||
role={isRoot ? undefined : 'button'}
|
role={isRoot ? undefined : 'button'}
|
||||||
title={isRoot ? undefined : t.tapHint}
|
title={isRoot ? undefined : t.tapHint}
|
||||||
>
|
>
|
||||||
<div className="pedigree-card__photo" aria-hidden={!photoUrl || undefined}>
|
{/* Foto-Platzhalter — echte Fotos kommen mit FEAT-6. */}
|
||||||
{photoUrl ? (
|
<div className="pedigree-card__photo" aria-hidden="true">
|
||||||
<img
|
<GerbilIcon size="1.6rem" />
|
||||||
src={photoUrl}
|
|
||||||
alt={g.name || ''}
|
|
||||||
className="pedigree-card__avatar"
|
|
||||||
onError={() => setFailedUrl(rawUrl)}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<GerbilIcon size="1.6rem" aria-hidden="true" />
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
<div className="pedigree-card__body">
|
<div className="pedigree-card__body">
|
||||||
<div className="pedigree-card__name">
|
<div className="pedigree-card__name">
|
||||||
|
|||||||
@@ -1,62 +1,14 @@
|
|||||||
import { useCallback, useMemo, useState } from 'react'
|
import { 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 { API_BASE_URL } from '../api/client'
|
|
||||||
import { condition } from '../api/gridify'
|
import { condition } from '../api/gridify'
|
||||||
import { type Gerbil } from '../api/types'
|
|
||||||
import { useApi } from '../hooks/useApi'
|
import { useApi } from '../hooks/useApi'
|
||||||
import { formatDate, genderLabel } from '../format/labels'
|
import { formatDate } from '../format/labels'
|
||||||
import { isValidGenotype } from '../format/genotypeText'
|
import { isValidGenotype } from '../format/genotypeText'
|
||||||
import { breed, fromDisplayString, genotypeToFarbschlag, UNKNOWN_FARBSCHLAG, type BreedingResult } from '../genetics'
|
import { breed, fromDisplayString, type BreedingResult } from '../genetics'
|
||||||
import BreedingResultView from '../components/BreedingResultView'
|
import BreedingResultView from '../components/BreedingResultView'
|
||||||
import GerbilIcon from '../components/GerbilIcon'
|
|
||||||
import './wuerfe.css'
|
|
||||||
|
|
||||||
type JuvenileFields = (typeof de.pages.litters.detail.juvenileFields)
|
|
||||||
|
|
||||||
function JuvenileCard({ g, farbe, receiver, tJf }: {
|
|
||||||
g: Gerbil
|
|
||||||
farbe: string | null
|
|
||||||
receiver: string | null
|
|
||||||
tJf: JuvenileFields
|
|
||||||
}) {
|
|
||||||
const [failedUrl, setFailedUrl] = useState<string | null>(null)
|
|
||||||
const rawUrl = g.profilePhotoUrl
|
|
||||||
? /^(https?:|data:|\/\/)/.test(g.profilePhotoUrl)
|
|
||||||
? g.profilePhotoUrl
|
|
||||||
: `${API_BASE_URL}${g.profilePhotoUrl}`
|
|
||||||
: null
|
|
||||||
const photoUrl = rawUrl !== failedUrl ? rawUrl : null
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Link to={`/rennmaeuse/${g.id}`} className="gerbil-card gerbil-card--with-photo">
|
|
||||||
<div className="juvenile-photo">
|
|
||||||
{photoUrl ? (
|
|
||||||
<img
|
|
||||||
src={photoUrl}
|
|
||||||
alt={g.name || ''}
|
|
||||||
className="juvenile-photo__avatar"
|
|
||||||
onError={() => setFailedUrl(rawUrl)}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<GerbilIcon size="1.4rem" aria-hidden="true" />
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
<div className="juvenile-body">
|
|
||||||
<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>}
|
|
||||||
</div>
|
|
||||||
</Link>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function WurfDetailPage() {
|
export default function WurfDetailPage() {
|
||||||
const t = de.pages.litters
|
const t = de.pages.litters
|
||||||
@@ -91,38 +43,6 @@ 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 (
|
||||||
@@ -172,12 +92,6 @@ export default function WurfDetailPage() {
|
|||||||
{l.totalBorn != null ? ` / ${l.totalBorn}` : ''}
|
{l.totalBorn != null ? ` / ${l.totalBorn}` : ''}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
{l.deathsWithin8Weeks != null && (
|
|
||||||
<div className="def-row">
|
|
||||||
<dt>{t.fields.deathsWithin8Weeks}</dt>
|
|
||||||
<dd>{l.deathsWithin8Weeks}</dd>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<div className="def-row">
|
<div className="def-row">
|
||||||
<dt>{t.fields.expectedGoHomeDate}</dt>
|
<dt>{t.fields.expectedGoHomeDate}</dt>
|
||||||
<dd>{formatDate(l.expectedGoHomeDate)}</dd>
|
<dd>{formatDate(l.expectedGoHomeDate)}</dd>
|
||||||
@@ -203,16 +117,14 @@ 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) => (
|
||||||
const farbe = farbschlagOf(g)
|
<li key={g.id}>
|
||||||
const receiver = g.receiverContactId ? contactNameById.get(g.receiverContactId) ?? null : null
|
<Link to={`/rennmaeuse/${g.id}`} className="gerbil-card">
|
||||||
const tJf = t.detail.juvenileFields
|
<span className="gerbil-card__name">{g.name}</span>
|
||||||
return (
|
<span className="gerbil-card__meta">{de.pages.gerbils.genderLabels[g.gender]}</span>
|
||||||
<li key={g.id}>
|
</Link>
|
||||||
<JuvenileCard g={g} farbe={farbe} receiver={receiver} tJf={tJf} />
|
</li>
|
||||||
</li>
|
))}
|
||||||
)
|
|
||||||
})}
|
|
||||||
</ul>
|
</ul>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ interface FormState {
|
|||||||
motherId: string
|
motherId: string
|
||||||
motherName: string
|
motherName: string
|
||||||
totalBorn: string
|
totalBorn: string
|
||||||
deathsWithin8Weeks: string
|
|
||||||
expectedGoHomeDate: string
|
expectedGoHomeDate: string
|
||||||
notes: string
|
notes: string
|
||||||
}
|
}
|
||||||
@@ -29,7 +28,6 @@ const EMPTY: FormState = {
|
|||||||
motherId: '',
|
motherId: '',
|
||||||
motherName: '',
|
motherName: '',
|
||||||
totalBorn: '',
|
totalBorn: '',
|
||||||
deathsWithin8Weeks: '',
|
|
||||||
expectedGoHomeDate: '',
|
expectedGoHomeDate: '',
|
||||||
notes: '',
|
notes: '',
|
||||||
}
|
}
|
||||||
@@ -77,7 +75,6 @@ export default function WurfFormPage() {
|
|||||||
motherId: l.motherId ?? '',
|
motherId: l.motherId ?? '',
|
||||||
motherName: l.motherId ? (nameById.get(l.motherId) || de.pages.gerbils.nameless) : '',
|
motherName: l.motherId ? (nameById.get(l.motherId) || de.pages.gerbils.nameless) : '',
|
||||||
totalBorn: l.totalBorn != null ? String(l.totalBorn) : '',
|
totalBorn: l.totalBorn != null ? String(l.totalBorn) : '',
|
||||||
deathsWithin8Weeks: l.deathsWithin8Weeks != null ? String(l.deathsWithin8Weeks) : '',
|
|
||||||
expectedGoHomeDate: l.expectedGoHomeDate ?? '',
|
expectedGoHomeDate: l.expectedGoHomeDate ?? '',
|
||||||
notes: l.notes ?? '',
|
notes: l.notes ?? '',
|
||||||
})
|
})
|
||||||
@@ -112,14 +109,12 @@ export default function WurfFormPage() {
|
|||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
if (!validate()) return
|
if (!validate()) return
|
||||||
const totalBornNum = form.totalBorn.trim() === '' ? null : Number(form.totalBorn)
|
const totalBornNum = form.totalBorn.trim() === '' ? null : Number(form.totalBorn)
|
||||||
const deathsNum = form.deathsWithin8Weeks.trim() === '' ? null : Number(form.deathsWithin8Weeks)
|
|
||||||
const body: CreateLitter = {
|
const body: CreateLitter = {
|
||||||
name: form.name.trim(),
|
name: form.name.trim(),
|
||||||
date: form.date,
|
date: form.date,
|
||||||
fatherId: nn(form.fatherId),
|
fatherId: nn(form.fatherId),
|
||||||
motherId: nn(form.motherId),
|
motherId: nn(form.motherId),
|
||||||
totalBorn: totalBornNum != null && Number.isFinite(totalBornNum) ? totalBornNum : null,
|
totalBorn: totalBornNum != null && Number.isFinite(totalBornNum) ? totalBornNum : null,
|
||||||
deathsWithin8Weeks: deathsNum != null && Number.isFinite(deathsNum) ? deathsNum : null,
|
|
||||||
expectedGoHomeDate: nn(form.expectedGoHomeDate),
|
expectedGoHomeDate: nn(form.expectedGoHomeDate),
|
||||||
notes: nn(form.notes),
|
notes: nn(form.notes),
|
||||||
}
|
}
|
||||||
@@ -220,26 +215,6 @@ export default function WurfFormPage() {
|
|||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label className="field">
|
|
||||||
<span>{t.fields.deathsWithin8Weeks}</span>
|
|
||||||
<input
|
|
||||||
type="number"
|
|
||||||
min="0"
|
|
||||||
className="input"
|
|
||||||
value={form.deathsWithin8Weeks}
|
|
||||||
onChange={(e) => set('deathsWithin8Weeks', e.target.value)}
|
|
||||||
/>
|
|
||||||
{(() => {
|
|
||||||
const d = Number(form.deathsWithin8Weeks)
|
|
||||||
const tb = Number(form.totalBorn)
|
|
||||||
return form.deathsWithin8Weeks.trim() !== '' &&
|
|
||||||
form.totalBorn.trim() !== '' &&
|
|
||||||
d > tb ? (
|
|
||||||
<small className="error-text">{t.validation.deathsExceedTotalBorn}</small>
|
|
||||||
) : null
|
|
||||||
})()}
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<label className="field">
|
<label className="field">
|
||||||
<span>{t.fields.expectedGoHomeDate}</span>
|
<span>{t.fields.expectedGoHomeDate}</span>
|
||||||
<input
|
<input
|
||||||
|
|||||||
@@ -236,7 +236,6 @@
|
|||||||
width: 42px;
|
width: 42px;
|
||||||
height: 42px;
|
height: 42px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
overflow: hidden;
|
|
||||||
background: var(--color-accent-soft);
|
background: var(--color-accent-soft);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -244,13 +243,6 @@
|
|||||||
font-size: 1.4rem;
|
font-size: 1.4rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pedigree-card__avatar {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
object-fit: cover;
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pedigree-card__body {
|
.pedigree-card__body {
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
/* JUVENILE-AVATARS: photo avatar to the left of each juvenile card. */
|
|
||||||
.gerbil-card--with-photo {
|
|
||||||
display: flex;
|
|
||||||
align-items: flex-start;
|
|
||||||
gap: 0.75rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.juvenile-body {
|
|
||||||
min-width: 0;
|
|
||||||
flex: 1;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 0.2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.juvenile-photo {
|
|
||||||
flex: none;
|
|
||||||
width: 36px;
|
|
||||||
height: 36px;
|
|
||||||
border-radius: 50%;
|
|
||||||
overflow: hidden;
|
|
||||||
background: var(--color-accent-soft);
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
align-self: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.juvenile-photo__avatar {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
object-fit: cover;
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
@@ -22,7 +22,7 @@ function makeGerbil(id: string, name: string, litterId: string | null = null): G
|
|||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
gender: 'unknown',
|
gender: 'unknown',
|
||||||
status: 'Breeding',
|
status: 'Active',
|
||||||
dateOfBirth: null,
|
dateOfBirth: null,
|
||||||
dateOfDeath: null,
|
dateOfDeath: null,
|
||||||
causeOfDeath: null,
|
causeOfDeath: null,
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ function makeGerbil(over: Partial<Gerbil> & { id: string }): Gerbil {
|
|||||||
return {
|
return {
|
||||||
name: over.id,
|
name: over.id,
|
||||||
gender: 'unknown',
|
gender: 'unknown',
|
||||||
status: 'Breeding' as GerbilStatus,
|
status: 'Active' as GerbilStatus,
|
||||||
dateOfBirth: null,
|
dateOfBirth: null,
|
||||||
dateOfDeath: null,
|
dateOfDeath: null,
|
||||||
causeOfDeath: null,
|
causeOfDeath: null,
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ export function farbschlagDistribution(
|
|||||||
): NameCount[] {
|
): NameCount[] {
|
||||||
const byName = new Map<string | null, number>()
|
const byName = new Map<string | null, number>()
|
||||||
for (const g of gerbils) {
|
for (const g of gerbils) {
|
||||||
if (g.status !== 'Breeding' && g.status !== 'Pet') continue
|
if (g.status !== 'Active') continue
|
||||||
const name = resolveName(g)
|
const name = resolveName(g)
|
||||||
byName.set(name, (byName.get(name) ?? 0) + 1)
|
byName.set(name, (byName.get(name) ?? 0) + 1)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,11 +124,6 @@ export const de = {
|
|||||||
isDeafUnknown: 'Unbekannt',
|
isDeafUnknown: 'Unbekannt',
|
||||||
isDeafYes: 'Ja',
|
isDeafYes: 'Ja',
|
||||||
isDeafNo: 'Nein',
|
isDeafNo: 'Nein',
|
||||||
// STATUS-MODEL: Hinweis für abgeleitete Statuswerte
|
|
||||||
statusDerivedHint: {
|
|
||||||
Deceased: 'Wird automatisch gesetzt wenn Todesdatum erfasst.',
|
|
||||||
GivenAway: 'Wird automatisch gesetzt nach Abgabe.',
|
|
||||||
},
|
|
||||||
save: 'Speichern',
|
save: 'Speichern',
|
||||||
cancel: 'Abbrechen',
|
cancel: 'Abbrechen',
|
||||||
saving: 'Speichern …',
|
saving: 'Speichern …',
|
||||||
@@ -146,10 +141,8 @@ export const de = {
|
|||||||
male: 'Männlich',
|
male: 'Männlich',
|
||||||
female: 'Weiblich',
|
female: 'Weiblich',
|
||||||
},
|
},
|
||||||
// STATUS-MODEL: Breeding/Pet ersetzen Active; Deceased+GivenAway = abgeleitet (Backend)
|
|
||||||
statusLabels: {
|
statusLabels: {
|
||||||
Breeding: 'Zucht',
|
Active: 'Aktiv',
|
||||||
Pet: 'Liebhaber',
|
|
||||||
Deceased: 'Verstorben',
|
Deceased: 'Verstorben',
|
||||||
GivenAway: 'Abgegeben',
|
GivenAway: 'Abgegeben',
|
||||||
ForSale: 'Zur Abgabe',
|
ForSale: 'Zur Abgabe',
|
||||||
@@ -179,7 +172,6 @@ export const de = {
|
|||||||
father: 'Vater',
|
father: 'Vater',
|
||||||
mother: 'Mutter',
|
mother: 'Mutter',
|
||||||
totalBorn: 'Wurfstärke',
|
totalBorn: 'Wurfstärke',
|
||||||
deathsWithin8Weeks: 'In den ersten 8 Wochen verstorben',
|
|
||||||
expectedGoHomeDate: 'Voraussichtliches Abgabedatum',
|
expectedGoHomeDate: 'Voraussichtliches Abgabedatum',
|
||||||
notes: 'Notizen',
|
notes: 'Notizen',
|
||||||
},
|
},
|
||||||
@@ -197,14 +189,6 @@ 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: {
|
||||||
@@ -220,7 +204,6 @@ export const de = {
|
|||||||
nameRequired: 'Bitte eine Bezeichnung eingeben.',
|
nameRequired: 'Bitte eine Bezeichnung eingeben.',
|
||||||
dateRequired: 'Bitte ein Wurfdatum angeben.',
|
dateRequired: 'Bitte ein Wurfdatum angeben.',
|
||||||
invalidParentGender: 'Der Vater muss männlich und die Mutter weiblich sein.',
|
invalidParentGender: 'Der Vater muss männlich und die Mutter weiblich sein.',
|
||||||
deathsExceedTotalBorn: 'Die Anzahl der Frühverluste darf die Wurfstärke nicht überschreiten.',
|
|
||||||
},
|
},
|
||||||
// Zuchtpaar-Übersicht
|
// Zuchtpaar-Übersicht
|
||||||
pairs: {
|
pairs: {
|
||||||
|
|||||||
@@ -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": "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)",
|
"decision": "birth 2013 + 4 years = death year 2017, no exact date → year-only convention (01.01.2017). Previous entry (17.04.2016) was wrong.",
|
||||||
"dateOfDeath": "17.04.2016",
|
"dateOfDeath": "01.01.2017",
|
||||||
"source": "Julian 2026-06-07 — HUMANQUESTION D6"
|
"source": "Julian 2026-06-07 — HUMANQUESTION D7 (final Skarlett resolution)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Kazu von den Kleinen Chaoten",
|
"name": "Kazu von den Kleinen Chaoten",
|
||||||
@@ -166,10 +166,10 @@
|
|||||||
{
|
{
|
||||||
"name": "Max von Privat",
|
"name": "Max von Privat",
|
||||||
"dob": "01.02.2013",
|
"dob": "01.02.2013",
|
||||||
"decision": "Genotyp von der Züchterin; Todesjahr 2014 (Jahr-only — Konvention mit Julian zu klären, deathYear NICHT als dateOfDeath gesetzt)",
|
"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",
|
"genotype": "aa c[chm]c[chm] D- EE GG PP spsp",
|
||||||
"_deathYear_pending": 2014,
|
"dateOfDeath": "01.01.2014",
|
||||||
"source": "Julian/Züchterin 2026-06-07 — HUMANQUESTION D7 (Jahr-only-Tod offen)"
|
"source": "Julian/Züchterin 2026-06-07 — HUMANQUESTION D7 (resolved)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Isa of Golden Lights",
|
"name": "Isa of Golden Lights",
|
||||||
@@ -198,6 +198,21 @@
|
|||||||
"decision": "Sterbedatum von der Züchterin; bestätigt = 'von PZ Karl' (nicht 'Sunny Sky of Fiomi')",
|
"decision": "Sterbedatum von der Züchterin; bestätigt = 'von PZ Karl' (nicht 'Sunny Sky of Fiomi')",
|
||||||
"dateOfDeath": "30.04.2018",
|
"dateOfDeath": "30.04.2018",
|
||||||
"source": "Julian/Züchterin 2026-06-07 — HUMANQUESTION D7 (Nachtrag)"
|
"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