From 788ae6ad32e367aeaf3cba9aef64d8600cc37b98 Mon Sep 17 00:00:00 2001 From: Sebastian Hedtrich Date: Sun, 23 Aug 2026 21:51:26 +0200 Subject: [PATCH] Wetterdienst: Hover Bugfix --- .../SchoolDayWeatherSummaryTests.cs | 14 ++++++++++++++ .../ViewModels/Planning/TimetableViewModel.cs | 10 +++++++++- .../Views/Planning/TimetableView.axaml | 18 +++++++++++++----- TODO.md | 3 +++ 4 files changed, 39 insertions(+), 6 deletions(-) diff --git a/LehrerApp.Desktop.Tests/SchoolDayWeatherSummaryTests.cs b/LehrerApp.Desktop.Tests/SchoolDayWeatherSummaryTests.cs index b86ed96..8146cfc 100644 --- a/LehrerApp.Desktop.Tests/SchoolDayWeatherSummaryTests.cs +++ b/LehrerApp.Desktop.Tests/SchoolDayWeatherSummaryTests.cs @@ -107,6 +107,20 @@ public sealed class SchoolDayWeatherSummaryTests Assert.False(SchoolDayWeatherSummary.WarningTouchesDate(warning, Day.AddDays(3))); } + [Fact] + public void WeekCellItem_WetterOderWarnung_AktiviertGemeinsameHoverFlaeche() + { + var cell = WeekCellItem.WeekdayHeader(DayOfWeek.Monday, Day, false); + Assert.False(cell.HasWeatherInformation); + + cell.SetWeather(SchoolDayWeatherSummary.From(Snapshot(Hour(10)), Day), []); + Assert.True(cell.HasWeatherInformation); + + cell.SetWeather(null, [new WeatherWarning { Headline = "Amtliche Warnung" }]); + Assert.True(cell.HasWeatherInformation); + Assert.Contains("Amtliche Warnung", cell.WeatherTooltip); + } + private static WeatherSnapshot Snapshot(params WeatherForecastHour[] hours) => new() { RetrievedAt = DateTime.UtcNow, diff --git a/LehrerApp.Desktop/ViewModels/Planning/TimetableViewModel.cs b/LehrerApp.Desktop/ViewModels/Planning/TimetableViewModel.cs index 67f6822..fb49be4 100644 --- a/LehrerApp.Desktop/ViewModels/Planning/TimetableViewModel.cs +++ b/LehrerApp.Desktop/ViewModels/Planning/TimetableViewModel.cs @@ -783,8 +783,16 @@ public partial class WeekCellItem : ObservableObject [ObservableProperty] private string _weatherTooltip = ""; [ObservableProperty] private bool _hasWeatherWarning; public bool HasWeather => WeatherSymbol.Length > 0; + public bool HasWeatherInformation => HasWeather || HasWeatherWarning; - partial void OnWeatherSymbolChanged(string value) => OnPropertyChanged(nameof(HasWeather)); + partial void OnWeatherSymbolChanged(string value) + { + OnPropertyChanged(nameof(HasWeather)); + OnPropertyChanged(nameof(HasWeatherInformation)); + } + + partial void OnHasWeatherWarningChanged(bool value) => + OnPropertyChanged(nameof(HasWeatherInformation)); public void SetWeather(SchoolDayWeatherSummary? summary, IReadOnlyList warnings) { diff --git a/LehrerApp.Desktop/Views/Planning/TimetableView.axaml b/LehrerApp.Desktop/Views/Planning/TimetableView.axaml index 4f33eb8..898e443 100644 --- a/LehrerApp.Desktop/Views/Planning/TimetableView.axaml +++ b/LehrerApp.Desktop/Views/Planning/TimetableView.axaml @@ -195,11 +195,19 @@ HorizontalAlignment="Center" VerticalAlignment="Center" Margin="4"> - - + + + + + + +