diff --git a/Sloth.Web/Controllers/HomeController.cs b/Sloth.Web/Controllers/HomeController.cs index 94d8c782..6793dc77 100644 --- a/Sloth.Web/Controllers/HomeController.cs +++ b/Sloth.Web/Controllers/HomeController.cs @@ -54,6 +54,17 @@ public async Task Index() }) .ToDictionaryAsync(t => t.Slug, t => t.Count); + var pendingApprovalTransactionCounts = await DbContext.Transactions + .Where(t => teamSlugs.Contains(t.Source.Team.Slug) + && t.Status == TransactionStatuses.PendingApproval) + .GroupBy(t => t.Source.Team.Slug) + .Select(t => new + { + Slug = t.Key, + Count = t.Count(), + }) + .ToDictionaryAsync(t => t.Slug, t => t.Count); + var stuckTransactionCounts = await DbContext.Transactions .Where(t => teamSlugs.Contains(t.Source.Team.Slug) && ((t.Status == TransactionStatuses.Processing && t.LastModified < stuckCutoff) @@ -75,6 +86,7 @@ public async Task Index() Slug = t.Slug, SourceNames = t.Sources?.OrderBy(s => s.Name).Select(s => s.Name).ToList() ?? new List(), FailedTransactionCount = failedTransactionCounts.TryGetValue(t.Slug, out var failedCount) ? failedCount : 0, + PendingApprovalTransactionCount = pendingApprovalTransactionCounts.TryGetValue(t.Slug, out var pendingApprovalCount) ? pendingApprovalCount : 0, StuckTransactionCount = stuckTransactionCounts.TryGetValue(t.Slug, out var stuckCount) ? stuckCount : 0, }) .ToList(), diff --git a/Sloth.Web/Models/HomeViewModels/HomeIndexViewModel.cs b/Sloth.Web/Models/HomeViewModels/HomeIndexViewModel.cs index e6cfdf24..8e19c57f 100644 --- a/Sloth.Web/Models/HomeViewModels/HomeIndexViewModel.cs +++ b/Sloth.Web/Models/HomeViewModels/HomeIndexViewModel.cs @@ -17,6 +17,8 @@ public class HomeTeamSummaryViewModel public int FailedTransactionCount { get; set; } + public int PendingApprovalTransactionCount { get; set; } + public int StuckTransactionCount { get; set; } } } diff --git a/Sloth.Web/Views/Home/Index.cshtml b/Sloth.Web/Views/Home/Index.cshtml index 1189c77c..97ab5a08 100644 --- a/Sloth.Web/Views/Home/Index.cshtml +++ b/Sloth.Web/Views/Home/Index.cshtml @@ -20,7 +20,8 @@ Name Slug Sources - Rejected Transactions + Pending Approval + Rejected Transactions Stuck Transactions @@ -34,7 +35,8 @@ @team.Slug @(team.SourceNames.Any() ? string.Join(", ", team.SourceNames) : "None") - @team.FailedTransactionCount + @team.PendingApprovalTransactionCount + @team.FailedTransactionCount @team.StuckTransactionCount } diff --git a/Sloth.Web/Views/Home/TeamIndex.cshtml b/Sloth.Web/Views/Home/TeamIndex.cshtml index 08bc90cc..1de92dd5 100644 --- a/Sloth.Web/Views/Home/TeamIndex.cshtml +++ b/Sloth.Web/Views/Home/TeamIndex.cshtml @@ -10,18 +10,13 @@ .Sum(x => x.Amount); } -
+
- -

SLOTH

-
    -
  • Secure Scrubber
  • -
  • Ledger Loader
  • -
  • Online
  • -
  • Transaction
  • -
  • Hub
  • -
+
+

S.L.O.T.H.

+

Secure Ledger Online Transaction Hub

+