Skip to content

Commit

Permalink
Available pledge funds section. Also has a correction to the Accepted…
Browse files Browse the repository at this point in the history
…PledgeApplications field.
  • Loading branch information
Sajid Habib committed Apr 28, 2022
1 parent 1d9b9be commit aacd2a0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public async Task FinancialBreakdownReturnsAViewModel()

var viewModel = view?.Model as OrchestratorResponse<FinancialBreakdownViewModel>;
Assert.IsNotNull(viewModel);
Assert.AreEqual(2000, viewModel.Data.AcceptedPledgeApplications);
Assert.AreEqual(4000, viewModel.Data.AcceptedPledgeApplications);
}

[Test]
Expand Down Expand Up @@ -106,6 +106,15 @@ public async Task FinancialBreakdownPageShowsCorrectTotalPledgedAndTransferConne
Assert.AreEqual(totalPledgedAndTransferConnections, viewModel.Data.TotalPledgedAndTransferConnections);
}

[Test]
public async Task FinancialBreakdownPageShowsCorrectAvailablePledgedFunds()
{
var viewModel = await GetViewModel();

var availablePledgedFunds = viewModel.Data.AmountPledged - (viewModel.Data.ApprovedPledgeApplications + viewModel.Data.AcceptedPledgeApplications);
Assert.AreEqual(availablePledgedFunds, viewModel.Data.AvailablePledgedFunds);
}

private async Task<OrchestratorResponse<FinancialBreakdownViewModel>> GetViewModel()
{
var result = await _controller.FinancialBreakdown(HashedAccountId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public async Task<OrchestratorResponse<FinancialBreakdownViewModel>> GetFinancia
{
TransferConnections = financialBreakdownTask.Result.TransferConnections,
HashedAccountID = hashedAccountId,
AcceptedPledgeApplications = financialBreakdownTask.Result.AcceptedPledgeApplications,
AcceptedPledgeApplications = financialBreakdownTask.Result.AcceptedPledgeApplications + financialBreakdownTask.Result.PledgeOriginatedCommitments,
ApprovedPledgeApplications = financialBreakdownTask.Result.ApprovedPledgeApplications,
Commitments = financialBreakdownTask.Result.Commitments,
PledgeOriginatedCommitments = financialBreakdownTask.Result.PledgeOriginatedCommitments,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ public class FinancialBreakdownViewModel
public decimal EstimatedRemainingAllowance { get { return TotalAvailableTransferAllowance - TotalEstimatedSpend; } }
public decimal TotalPledgedAndTransferConnections { get { return AmountPledged + TransferConnections; } }
public decimal TotalAvailablePledgedFunds { get { return TotalAvailableTransferAllowance - TotalPledgedAndTransferConnections; } }
public decimal AvailablePledgedFunds { get { return AmountPledged - (ApprovedPledgeApplications + AcceptedPledgeApplications); } }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,39 +102,37 @@
<hr />

<h2 class="heading-medium">
Available pledge funds for financial year 2021/22
Available pledge funds for financial year @Model.Data.FinancialYearString
</h2>
<div class="grid-row">
<div class="column-one-half">
<table>
<tr>
<th scope="row">You have pledged</th>
<td class="numeric">£20</td>
<td class="numeric">@Model.Data.AmountPledged.ToString("C0", culture)</td>
</tr>
<tr>
<th scope="row">Approved applications: live</th>
<td class="numeric">£20</td>
<th scope="row">Approved applications: accepted by applicant</th>
<td class="numeric">@Model.Data.AcceptedPledgeApplications.ToString("C0", culture)</td>
</tr>
<tr>
<th scope="row">Approved applications: not yet live</th>
<td class="numeric">£20</td>
<th scope="row">Approved applications: awaiting acceptance by applicant</th>
<td class="numeric">@Model.Data.ApprovedPledgeApplications.ToString("C0", culture)</td>
</tr>

</table>
<p>
Of your <strong>£20 estimated remaining allowance</strong>, this is allocated to your available pledge funds.
</p>
<details>
<summary><span class="summary">How are my available pledge funds calculated?</span></summary>
<div class="panel panel-border-narrow">
<p>Content</p>
<p>Your available pledge funds is calculated by subtracting your <strong>approved applications (accepted by applicant and awaiting acceptance by applicant)</strong> from the amount <strong>you have pledged</strong>.</p>
</div>
</details>
</div>
<div class="column-one-half">
<div class="finance-data">
<dl>
<dt>Available pledge funds for 2021/22</dt>
<dd>£200,000</dd>
<dt>Available pledge funds for @Model.Data.FinancialYearString</dt>
<dd>@Model.Data.AvailablePledgedFunds.ToString("C0", culture)</dd>
</dl>
</div>
</div>
Expand Down

0 comments on commit aacd2a0

Please sign in to comment.