Skip to content

Commit

Permalink
Prevent printing deleted items
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwaldron committed Dec 20, 2024
1 parent 73ca550 commit 52e2172
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/IaipDataService/SourceTests/IaipSourceTestService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ public class IaipSourceTestService(
public async Task<BaseSourceTestReport?> 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
{
Expand Down
3 changes: 2 additions & 1 deletion src/WebApp/Pages/Print/Acc/Index.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public async Task<ActionResult> 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();

Expand Down
3 changes: 2 additions & 1 deletion src/WebApp/Pages/Print/Fce/Index.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public async Task<ActionResult> 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();

Expand Down
3 changes: 1 addition & 2 deletions src/WebApp/Pages/Print/SourceTest/Index.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ public async Task<ActionResult> 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();
Expand Down

0 comments on commit 52e2172

Please sign in to comment.