[#14] Windows: Add DeliveryAncmtWindow
All checks were successful
Test / Run tests (push) Successful in 2m5s
All checks were successful
Test / Run tests (push) Successful in 2m5s
This commit is contained in:
@ -3,6 +3,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
|
||||
namespace Elwig.Models.Entities {
|
||||
[Table("delivery_schedule"), PrimaryKey("Year", "DsNr")]
|
||||
@ -30,6 +31,10 @@ namespace Elwig.Models.Entities {
|
||||
|
||||
[Column("max_weight")]
|
||||
public int? MaxWeight { get; set; }
|
||||
[NotMapped]
|
||||
public int AnnouncedWeight => Announcements.Sum(a => a.Weight);
|
||||
[NotMapped]
|
||||
public double? Percent => (double)AnnouncedWeight / MaxWeight * 100;
|
||||
|
||||
[Column("ancmt_from")]
|
||||
public long? AncmtFromUnix { get; set; }
|
||||
@ -56,6 +61,9 @@ namespace Elwig.Models.Entities {
|
||||
[InverseProperty(nameof(DeliveryScheduleWineVar.Schedule))]
|
||||
public virtual ICollection<DeliveryScheduleWineVar> Varieties { get; private set; } = null!;
|
||||
|
||||
[InverseProperty(nameof(DeliveryAncmt.Schedule))]
|
||||
public virtual ICollection<DeliveryAncmt> Announcements { get; private set; } = null!;
|
||||
|
||||
public int SearchScore(IEnumerable<string> keywords) {
|
||||
return Utils.GetSearchScore([Description], keywords);
|
||||
}
|
||||
|
Reference in New Issue
Block a user