-
-
Notifications
You must be signed in to change notification settings - Fork 17
Populate tickers before calculation, with a holding breakdown and calculation status panel #263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alexpung
wants to merge
5
commits into
master
Choose a base branch
from
claude/eri-corporate-actions-prepopulate-cj58pn
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9dd236b
Add collapsible holding breakdown to ERI and corporate action forms
claude ebfa140
Base entry form quantities on units held rather than the Section 104 …
claude 1353edb
Revert "Base entry form quantities on units held rather than the Sect…
claude c599d5a
Document and pin the reg. 94(3A) basis for the ERI period end holding
claude a50f92d
Populate tickers before calculation and replace the gates with a stat…
claude File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
BlazorApp-Investment Tax Calculator/Components/CalculationStatusPanel.razor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| @using InvestmentTaxCalculator.Services | ||
|
|
||
| @implements IDisposable | ||
| @inject TaxCalculationService _taxCalculationService | ||
| @inject FileImportStateService _fileImportState | ||
|
|
||
| @* Replaces the "run a calculation first" warnings that used to gate these pages. Tickers are selectable straight | ||
| after import; only the quantities need a calculation, and this says so and offers the one button that fixes it. *@ | ||
| <div class="card bg-dark border-secondary mb-4"> | ||
| <div class="card-body d-flex flex-wrap align-items-center justify-content-between gap-3"> | ||
| <div> | ||
| <div class="fw-bold @StatusCssClass">@StatusText</div> | ||
| <div class="form-text mb-0"> | ||
| A calculation applies every corporate action and matching rule, which is what fixes the holdings | ||
| shown on this page. Run it again after adding or editing entries. | ||
| </div> | ||
| </div> | ||
| <RadzenButton Click="@RunCalculation" | ||
| ButtonStyle="ButtonStyle.Primary" | ||
| Disabled="@(_taxCalculationService.IsCalculating || _fileImportState.IsProcessing)" | ||
| Text="@ButtonText" /> | ||
| </div> | ||
| </div> | ||
|
|
||
| @code { | ||
| /// <summary>Raised after a calculation started from this panel completes, so the page can refresh its data.</summary> | ||
| [Parameter] public EventCallback OnCalculated { get; set; } | ||
|
|
||
| private string ButtonText => _taxCalculationService.IsCalculating | ||
| ? "Calculating..." | ||
| : _taxCalculationService.HasCalculated ? "Update calculation" : "Run calculation"; | ||
|
|
||
| private string StatusText | ||
| { | ||
| get | ||
| { | ||
| if (_taxCalculationService.IsCalculating) return "Calculating..."; | ||
| if (_fileImportState.IsProcessing) return "Importing files..."; | ||
| if (!_taxCalculationService.HasCalculated) return "Quantities are pending until a calculation has been run."; | ||
| if (_taxCalculationService.IsResultStale) return "Data has changed since the last calculation, so the quantities shown are out of date."; | ||
| return "Quantities are up to date with the last calculation."; | ||
| } | ||
| } | ||
|
|
||
| private string StatusCssClass => | ||
| !_taxCalculationService.HasCalculated || _taxCalculationService.IsResultStale ? "text-warning" : "text-success"; | ||
|
|
||
| protected override void OnInitialized() | ||
| { | ||
| _taxCalculationService.OnStateChanged += HandleStateChanged; | ||
| _fileImportState.OnChange += HandleStateChanged; | ||
| } | ||
|
|
||
| private async Task RunCalculation() | ||
| { | ||
| await _taxCalculationService.CalculateAsync(); | ||
| await OnCalculated.InvokeAsync(); | ||
| } | ||
|
|
||
| private void HandleStateChanged() => _ = InvokeAsync(StateHasChanged); | ||
|
|
||
| public void Dispose() | ||
| { | ||
| _taxCalculationService.OnStateChanged -= HandleStateChanged; | ||
| _fileImportState.OnChange -= HandleStateChanged; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Refresh
Quantityafter calculation completion.Before calculation, this lookup returns
nulland stores zero. After calculation completes, no code reruns this lookup for an already selected ticker. The form can then display zero and reject a valid ERI entry until the user selects the ticker again.Recalculate
QuantitywhenTaxCalculationService.HasCalculatedchanges, or invoke a refresh method from the calculation-complete callback.🤖 Prompt for AI Agents