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

View file

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