AreaCom: Make YearFrom nullable
All checks were successful
Test / Run tests (push) Successful in 1m48s
All checks were successful
Test / Run tests (push) Successful in 1m48s
This commit is contained in:
@ -206,7 +206,7 @@
|
|||||||
<td class="text">@areaCom.GstNr.Replace(",", ", ").Replace("-", "–")</td>
|
<td class="text">@areaCom.GstNr.Replace(",", ", ").Replace("-", "–")</td>
|
||||||
<td class="number">@($"{areaCom.Area:N0}")</td>
|
<td class="number">@($"{areaCom.Area:N0}")</td>
|
||||||
<td class="center">@areaCom.WineCult?.Name</td>
|
<td class="center">@areaCom.WineCult?.Name</td>
|
||||||
<td class="center">@(areaCom.YearTo == null ? $"ab {areaCom.YearFrom}" : $"{areaCom.YearFrom}–{areaCom.YearTo}")</td>
|
<td class="center">@(areaCom.YearTo == null ? (areaCom.YearFrom == null ? "unbefristet" : $"ab {areaCom.YearFrom}") : (areaCom.YearFrom == null ? $"bis {areaCom.YearTo}" : $"{areaCom.YearFrom}–{areaCom.YearTo}"))</td>
|
||||||
</tr>
|
</tr>
|
||||||
lastContract = contractType.AreaComType.DisplayName;
|
lastContract = contractType.AreaComType.DisplayName;
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ namespace Elwig.Helpers {
|
|||||||
public static class AppDbUpdater {
|
public static class AppDbUpdater {
|
||||||
|
|
||||||
// Don't forget to update value in Tests/fetch-resources.bat!
|
// Don't forget to update value in Tests/fetch-resources.bat!
|
||||||
public static readonly int RequiredSchemaVersion = 29;
|
public static readonly int RequiredSchemaVersion = 30;
|
||||||
|
|
||||||
private static int VersionOffset = 0;
|
private static int VersionOffset = 0;
|
||||||
|
|
||||||
|
@ -565,7 +565,7 @@ namespace Elwig.Helpers.Export {
|
|||||||
KgNr = kgnr,
|
KgNr = kgnr,
|
||||||
GstNr = json["gstnr"]?.AsValue().GetValue<string>() ?? "-",
|
GstNr = json["gstnr"]?.AsValue().GetValue<string>() ?? "-",
|
||||||
RdNr = rd?.RdNr,
|
RdNr = rd?.RdNr,
|
||||||
YearFrom = json["year_from"]!.AsValue().GetValue<int>(),
|
YearFrom = json["year_from"]?.AsValue().GetValue<int>(),
|
||||||
YearTo = json["year_to"]?.AsValue().GetValue<int>(),
|
YearTo = json["year_to"]?.AsValue().GetValue<int>(),
|
||||||
Comment = json["comment"]?.AsValue().GetValue<string>(),
|
Comment = json["comment"]?.AsValue().GetValue<string>(),
|
||||||
}, newRd ? rd : null);
|
}, newRd ? rd : null);
|
||||||
|
@ -560,7 +560,7 @@ namespace Elwig.Helpers {
|
|||||||
|
|
||||||
public static Expression<Func<AreaCom, bool>> ActiveAreaCommitments() => ActiveAreaCommitments(CurrentYear);
|
public static Expression<Func<AreaCom, bool>> ActiveAreaCommitments() => ActiveAreaCommitments(CurrentYear);
|
||||||
public static Expression<Func<AreaCom, bool>> ActiveAreaCommitments(int year) =>
|
public static Expression<Func<AreaCom, bool>> ActiveAreaCommitments(int year) =>
|
||||||
c => (c.YearFrom <= year) && (c.YearTo == null || c.YearTo >= year);
|
c => (c.YearFrom == null || c.YearFrom <= year) && (c.YearTo == null || c.YearTo >= year);
|
||||||
|
|
||||||
public static IQueryable<AreaCom> ActiveAreaCommitments(IQueryable<AreaCom> query) => ActiveAreaCommitments(query, CurrentYear);
|
public static IQueryable<AreaCom> ActiveAreaCommitments(IQueryable<AreaCom> query) => ActiveAreaCommitments(query, CurrentYear);
|
||||||
public static IQueryable<AreaCom> ActiveAreaCommitments(IQueryable<AreaCom> query, int year) =>
|
public static IQueryable<AreaCom> ActiveAreaCommitments(IQueryable<AreaCom> query, int year) =>
|
||||||
|
@ -32,7 +32,7 @@ namespace Elwig.Models.Entities {
|
|||||||
public int? RdNr { get; set; }
|
public int? RdNr { get; set; }
|
||||||
|
|
||||||
[Column("year_from")]
|
[Column("year_from")]
|
||||||
public int YearFrom { get; set; }
|
public int? YearFrom { get; set; }
|
||||||
|
|
||||||
[Column("year_to")]
|
[Column("year_to")]
|
||||||
public int? YearTo { get; set; }
|
public int? YearTo { get; set; }
|
||||||
|
18
Elwig/Resources/Sql/29-30.sql
Normal file
18
Elwig/Resources/Sql/29-30.sql
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
-- schema version 29 to 30
|
||||||
|
|
||||||
|
PRAGMA writable_schema = ON;
|
||||||
|
|
||||||
|
DROP VIEW v_bki_member;
|
||||||
|
CREATE VIEW v_bki_member AS
|
||||||
|
SELECT s.year, m.mgnr, m.lfbis_nr, m.name,
|
||||||
|
(COALESCE(m.prefix || ' ', '') || m.given_name || COALESCE(' ' || m.middle_names, '') || COALESCE(' ' || m.suffix, '')) AS other_names,
|
||||||
|
a.name AS billing_name, COALESCE(a.address, m.address) AS address,
|
||||||
|
COALESCE(a.country, m.country) AS country, COALESCE(a.postal_dest, m.postal_dest) AS postal_dest,
|
||||||
|
SUM(COALESCE(IIF((c.year_from IS NULL OR c.year_from <= s.year) AND (c.year_to IS NULL OR c.year_to >= s.year), c.area, NULL), 0)) AS area
|
||||||
|
FROM season s, member m
|
||||||
|
LEFT JOIN member_billing_address a ON a.mgnr = m.mgnr
|
||||||
|
LEFT JOIN area_commitment c ON c.mgnr = m.mgnr
|
||||||
|
GROUP BY s.year, m.mgnr;
|
||||||
|
|
||||||
|
PRAGMA schema_version = 2901;
|
||||||
|
PRAGMA writable_schema = OFF;
|
@ -106,7 +106,7 @@ namespace Elwig.Services {
|
|||||||
var a = new AreaCom {
|
var a = new AreaCom {
|
||||||
FbNr = oldFbNr ?? newFbNr,
|
FbNr = oldFbNr ?? newFbNr,
|
||||||
MgNr = (int)vm.MgNr!,
|
MgNr = (int)vm.MgNr!,
|
||||||
YearFrom = (int)vm.YearFrom!,
|
YearFrom = vm.YearFrom,
|
||||||
YearTo = vm.YearTo,
|
YearTo = vm.YearTo,
|
||||||
VtrgId = vm.AreaComType!.VtrgId,
|
VtrgId = vm.AreaComType!.VtrgId,
|
||||||
CultId = vm.WineCult?.CultId,
|
CultId = vm.WineCult?.CultId,
|
||||||
|
@ -1 +1 @@
|
|||||||
curl --fail -s -L "https://elwig.at/files/create.sql?v=29" -u "elwig:ganzGeheim123!" -o "Resources\Sql\Create.sql"
|
curl --fail -s -L "https://elwig.at/files/create.sql?v=30" -u "elwig:ganzGeheim123!" -o "Resources\Sql\Create.sql"
|
||||||
|
Reference in New Issue
Block a user