diff --git a/Sloth.Web/Controllers/ReportsController.cs b/Sloth.Web/Controllers/ReportsController.cs index af8030e9..b1399752 100644 --- a/Sloth.Web/Controllers/ReportsController.cs +++ b/Sloth.Web/Controllers/ReportsController.cs @@ -101,25 +101,35 @@ public async Task DownloadableTransactions(TransactionsFilterMode } [Authorize(Roles = Roles.SystemAdmin)] - public async Task FailedTransactionsAllTeams() + public async Task FailedTransactionsAllTeams(bool pendingOlderThanADay = false) { // get transactions that are rejected or have been processing for longer than 5 days - var transactions = await DbContext.Transactions - .Where(t => t.Status == TransactionStatuses.Rejected - || (t.Status == TransactionStatuses.Processing && t.LastModified < DateTime.UtcNow.Date.AddDays(-5))) + var query = DbContext.Transactions .Include(t => t.Transfers) .Include(a => a.JournalRequest) .Include(t => t.Source) .ThenInclude(s => s.Team) - .AsNoTracking() - .ToListAsync(); + .AsNoTracking(); + + if (pendingOlderThanADay) + { + query = query.Where(t => t.Status == TransactionStatuses.Processing && t.LastModified < DateTime.UtcNow.Date.AddDays(-1)); + } + else + { + query = query.Where(t => t.Status == TransactionStatuses.Rejected + || (t.Status == TransactionStatuses.Processing && t.LastModified < DateTime.UtcNow.Date.AddDays(-5))); + } + + var transactions = await query.ToListAsync(); var model = new TransactionsReportViewModel { TransactionsTable = new TransactionsTableViewModel { Transactions = transactions, - } + }, + Information = pendingOlderThanADay ? "Only transactions that have been processing for more than a day!!!" : null, }; return View("FailedTransactions", model); diff --git a/Sloth.Web/Models/ReportViewModels/TransactionsReportViewModel.cs b/Sloth.Web/Models/ReportViewModels/TransactionsReportViewModel.cs index 26bb8518..3d47500b 100644 --- a/Sloth.Web/Models/ReportViewModels/TransactionsReportViewModel.cs +++ b/Sloth.Web/Models/ReportViewModels/TransactionsReportViewModel.cs @@ -6,5 +6,7 @@ namespace Sloth.Web.Models.ReportViewModels public class TransactionsReportViewModel { public TransactionsTableViewModel TransactionsTable { get; set; } + + public string? Information { get; set; } } } diff --git a/Sloth.Web/Views/Reports/FailedTransactions.cshtml b/Sloth.Web/Views/Reports/FailedTransactions.cshtml index 14b6ac70..07dca7ba 100644 --- a/Sloth.Web/Views/Reports/FailedTransactions.cshtml +++ b/Sloth.Web/Views/Reports/FailedTransactions.cshtml @@ -19,6 +19,12 @@

@ViewBag.Title

+ @if (Model.Information != null) + { + + }

Transactions


diff --git a/Sloth.Web/Views/Reports/Index.cshtml b/Sloth.Web/Views/Reports/Index.cshtml index 0badf5f6..3f7cab2c 100644 --- a/Sloth.Web/Views/Reports/Index.cshtml +++ b/Sloth.Web/Views/Reports/Index.cshtml @@ -65,6 +65,18 @@
+ }