diff --git a/src/IaipDataService/SourceTests/IaipSourceTestService.cs b/src/IaipDataService/SourceTests/IaipSourceTestService.cs index e775377c..7a809b9f 100644 --- a/src/IaipDataService/SourceTests/IaipSourceTestService.cs +++ b/src/IaipDataService/SourceTests/IaipSourceTestService.cs @@ -19,9 +19,8 @@ public class IaipSourceTestService( public async Task FindAsync(int referenceNumber) { var getDocumentTypeTask = GetDocumentTypeAsync(referenceNumber); - var getSourceTestExistsTask = SourceTestExistsAsync(referenceNumber); - if (!await getSourceTestExistsTask) return null; + if (!await SourceTestExistsAsync(referenceNumber)) return null; return await getDocumentTypeTask switch { diff --git a/src/WebApp/Pages/Print/Acc/Index.cshtml.cs b/src/WebApp/Pages/Print/Acc/Index.cshtml.cs index 46d2ed0f..29044e11 100644 --- a/src/WebApp/Pages/Print/Acc/Index.cshtml.cs +++ b/src/WebApp/Pages/Print/Acc/Index.cshtml.cs @@ -17,7 +17,8 @@ public async Task OnGetAsync( [FromRoute] int id) { Report = await workEntryService.FindAsync(id) as AccViewDto; - if (Report == null) return NotFound(); + if (Report == null || Report.IsDeleted) return NotFound(); + Facility = await facilityService.FindFacilityDetailsAsync((FacilityId?)Report!.FacilityId); if (Facility == null) return NotFound(); diff --git a/src/WebApp/Pages/Print/Fce/Index.cshtml.cs b/src/WebApp/Pages/Print/Fce/Index.cshtml.cs index 50efb90d..7059af67 100644 --- a/src/WebApp/Pages/Print/Fce/Index.cshtml.cs +++ b/src/WebApp/Pages/Print/Fce/Index.cshtml.cs @@ -19,7 +19,8 @@ public async Task OnGetAsync( CancellationToken token = default) { Report = await fceService.FindAsync(id, token); - if (Report == null) return NotFound(); + if (Report == null || Report.IsDeleted) return NotFound(); + Facility = await facilityService.FindFacilityDetailsAsync((FacilityId?)Report!.FacilityId); if (Facility == null) return NotFound(); diff --git a/src/WebApp/Pages/Print/SourceTest/Index.cshtml.cs b/src/WebApp/Pages/Print/SourceTest/Index.cshtml.cs index 6c644294..95099922 100644 --- a/src/WebApp/Pages/Print/SourceTest/Index.cshtml.cs +++ b/src/WebApp/Pages/Print/SourceTest/Index.cshtml.cs @@ -26,8 +26,7 @@ public async Task OnGetAsync( if (!activeUser) return Challenge(); } - var sourceTestTask = sourceTestService.FindAsync(referenceNumber); - Report = await sourceTestTask; + Report = await sourceTestService.FindAsync(referenceNumber); if (Report?.Facility == null) return NotFound(); Report = includeConfidentialInfo ? Report : Report.RedactedStackTestReport();