This commit is contained in:
Frede Hundewadt 2022-06-20 19:07:43 +02:00
parent 4e9c811868
commit 42cf1110e9
3 changed files with 7 additions and 4 deletions

View file

@ -27,7 +27,9 @@ public static class Utils
public static string GetVisitState(string dtNextVisit) public static string GetVisitState(string dtNextVisit)
{ {
if (dtNextVisit is "0001-01-01" or "1970-01-01" or "1970-00-00") if (dtNextVisit is "0001-01-01" or "1970-01-01")
return "the-draw";
if (!DateTime.TryParse(dtNextVisit, out _))
return "the-draw"; return "the-draw";
var dtNow = DateTime.Now; var dtNow = DateTime.Now;
@ -35,6 +37,6 @@ public static class Utils
if (dtNow > dtNext) if (dtNow > dtNext)
return "the-ugly"; return "the-ugly";
return (dtNow > dtNext.AddDays(-14)) ? "the-bad" : "the-good"; return dtNow > dtNext.AddDays(-14) ? "the-bad" : "the-good";
} }
} }

View file

@ -83,6 +83,8 @@ public partial class CompanyView : IDisposable
if (!_company.ValidDateSpan()) if (!_company.ValidDateSpan())
_nextVisit = _lastVisit.AddDays(_company.Interval * 7); _nextVisit = _lastVisit.AddDays(_company.Interval * 7);
_visitState = Utils.GetVisitState($"{_nextVisit:yyyy-MM-dd}");
if(_company.HasFolded == 1) if(_company.HasFolded == 1)
{ {
_hasFolded = true; _hasFolded = true;
@ -95,7 +97,6 @@ public partial class CompanyView : IDisposable
_company.ValidVat = VatUtils.ValidateFormat(_company.CountryCode, _company.VatNumber) ? 1 : 0; _company.ValidVat = VatUtils.ValidateFormat(_company.CountryCode, _company.VatNumber) ? 1 : 0;
_validVat = _company.ValidVat == 1; _validVat = _company.ValidVat == 1;
_vatState = _company.ValidVat == 1 ? "the-good" : "the-draw"; _vatState = _company.ValidVat == 1 ? "the-good" : "the-draw";
_visitState = Utils.GetVisitState($"{_nextVisit:yyyy-HH-mm}");
} }
_editContext = new EditContext(_company); _editContext = new EditContext(_company);
_editContext.OnFieldChanged += HandleFieldChanged; _editContext.OnFieldChanged += HandleFieldChanged;

View file

@ -18,7 +18,7 @@
}, },
"appInfo": { "appInfo": {
"name": "Wonky Client", "name": "Wonky Client",
"version": "0.8.14", "version": "0.8.15",
"isBeta": true, "isBeta": true,
"image": "grumpy-coder.png" "image": "grumpy-coder.png"
}, },