create report workdata sometimes uninitialized

This commit is contained in:
Frede Hundewadt 2023-01-19 12:44:16 +01:00
parent cc00d397a9
commit ea5c6d4c8c
2 changed files with 14 additions and 7 deletions

View file

@ -68,6 +68,7 @@ public partial class AdvisorReportCreatePage : IDisposable
ProfileService.OnChange += ProfileServiceOnOnChange;
Prefs = await ProfileService.GetPreferences();
Logger.LogDebug("{}", JsonSerializer.Serialize(Prefs));
WorkDate = Prefs.WorkDate;
if (string.IsNullOrWhiteSpace(WorkDate))
{
@ -75,7 +76,11 @@ public partial class AdvisorReportCreatePage : IDisposable
WorkDate = $"{_workDate:yyyy-MM-dd}";
await ProfileService.SetWorkDate(_workDate);
}
else
{
_workDate = DateTime.Parse(WorkDate);
}
if(await AdvisorReportRepo.ReportExist(WorkDate))
Navigator.NavigateTo($"/advisor/reports/view/{_workDate:yyyy-MM-dd}");
@ -89,9 +94,9 @@ public partial class AdvisorReportCreatePage : IDisposable
Report.Figures.KmEvening = 0;
Report.Figures.Distance = 0;
Report.Figures.DistancePrivateMonth = 0;
Logger.LogDebug("OnInitializedAsync => GetKeyFigures");
await GetKeyFigures();
Logger.LogDebug("OnInitializedAsync => GetKeyFigures <= {}", JsonSerializer.Serialize(Report));
}
private void ProfileServiceOnOnChange(UserPref userPref)
@ -243,8 +248,10 @@ public partial class AdvisorReportCreatePage : IDisposable
// pop confirmation
// create a prompt for popup confirmation
var warning = Report.Figures.KmEvening - Report.Figures.KmMorning > 1000 ?
$"KM tal '{Report.Figures.KmEvening - Report.Figures.KmMorning}'. Er du sikker på at det er rigtigt?<br/></br>" : "";
Prompt = $"{warning}Gem rapport for {_workDate.ToLongDateString()}?";
$"KM tal '{Report.Figures.KmEvening - Report.Figures.KmMorning}'. Er du sikker på at det er rigtigt?<br/>" : "";
Prompt = $"{warning}<br/>Gem rapport for {_workDate.ToLongDateString()}?";
ConfirmReportModal.Show();
}

View file

@ -1,13 +1,13 @@
{
"appInfo": {
"name": "Wonky Online",
"version": "0.102.5",
"version": "0.102.7",
"rc": true,
"sandBox": false,
"image": "grumpy-coder.png"
},
"apiConfig": {
"baseUrl": "https://zeta.innotec.dk",
"baseUrl": "https://edu.innotec.dk",
"catalog": "api/v2/catalog/country",
"crmCustomers": "api/v2/crm/companies",
"crmInventoryExt": "history/inventory",