Fixed test data so that jessie actually gets mother and father ids correctly, and fixed search so that it resets visibility every time

This commit is contained in:
2026-01-07 21:59:53 -06:00
parent ab1d286f8c
commit c32026bfc8
2 changed files with 17 additions and 15 deletions

View File

@@ -39,7 +39,18 @@ public partial class HomePage : Page
private void SearchClicked(object? sender, RoutedEventArgs e) private void SearchClicked(object? sender, RoutedEventArgs e)
{ {
if (string.IsNullOrEmpty(SearchBox.Text)) ResetCritterStackVisibility();
if (string.IsNullOrEmpty(SearchBox.Text)) return;
foreach (var child in CritterStack.Children)
{
if (child is not ProfileButton profileButton) continue;
if (profileButton.Critter is null) continue;
if (!profileButton.Critter.Name.Contains(SearchBox.Text, StringComparison.CurrentCultureIgnoreCase)) profileButton.IsVisible = false;
}
}
private void ResetCritterStackVisibility()
{ {
foreach (var child in CritterStack.Children) foreach (var child in CritterStack.Children)
{ {
@@ -48,16 +59,6 @@ public partial class HomePage : Page
profileButton.IsVisible = true; profileButton.IsVisible = true;
} }
} }
return;
}
foreach (var child in CritterStack.Children)
{
if (child is not ProfileButton profileButton) continue;
if (profileButton.Critter is null) continue;
if (!profileButton.Critter.Name.Contains(SearchBox.Text, StringComparison.CurrentCultureIgnoreCase)) profileButton.IsVisible = false;
}
} }
private void CreateHeaderButtons() private void CreateHeaderButtons()

View File

@@ -48,8 +48,8 @@ public partial class TestPage : Page
}; };
await DatabaseService.AddCritter(polities); await DatabaseService.AddCritter(polities);
var torielId = DatabaseService.GetCritter("Toriel").Id; var torielId = (await DatabaseService.GetCritter("Toriel")).Id;
var poliId = DatabaseService.GetCritter("Polities").Id; var poliId = (await DatabaseService.GetCritter("Polities")).Id;
var jessie = new Critter var jessie = new Critter
{ {
@@ -57,7 +57,8 @@ public partial class TestPage : Page
DateOfBirth = new DateTime(2025, 04, 05), DateOfBirth = new DateTime(2025, 04, 05),
Gender = Gender.Male, Gender = Gender.Male,
Notes = "Polities' first son. Named after Jessie from The Last Of Us.", Notes = "Polities' first son. Named after Jessie from The Last Of Us.",
MotherId = torielId,
FatherId = poliId,
}; };
await DatabaseService.AddCritter(jessie); await DatabaseService.AddCritter(jessie);