DeliveryAncmtAdminWindow: Increase performace by aggregating AnnouncedWeight
All checks were successful
Test / Run tests (push) Successful in 2m23s

This commit is contained in:
2025-10-07 20:41:15 +02:00
parent a0d4f19f30
commit 7edd888aa2
2 changed files with 10 additions and 3 deletions

View File

@@ -42,7 +42,9 @@ namespace Elwig.Models.Entities {
[Column("max_weight")]
public int? MaxWeight { get; set; }
[NotMapped]
public int AnnouncedWeight => Announcements.Sum(a => a.Weight);
public int AnnouncedWeight => AnnouncedWeightOverride ?? Announcements.Sum(a => a.Weight);
[NotMapped]
public int? AnnouncedWeightOverride { get; set; }
[NotMapped]
public double? Percent => (double)AnnouncedWeight / MaxWeight * 100;