Top 3 ui#1124
Open
VibeNL wants to merge 7 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for the Top Movers page in the global filter UX and improves its data loading by replacing N per-symbol price-history queries with a single bulk query. Also aligns its filter-change detection with the snapshot/IsEqual pattern used by Accounts/Transactions/HoldingDetail.
Changes:
- Switch
TopMoversfilter-change detection toFilterState.IsEqualagainst a snapshot copy, removing the bespokeHasFilterStateChanged(). - Add
/top-moversto date and account filter visibility inMainLayout. - Add new
GetHoldingPriceHistoryBulkAsynctoIHoldingsDataService/HoldingsDataServiceand consume it fromTopMovers.PrepareRisersAndLosers.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| PortfolioViewer/PortfolioViewer.WASM/Pages/TopMovers.razor.cs | Adopt IsEqual filter comparison and use bulk price-history fetch. |
| PortfolioViewer/PortfolioViewer.WASM/Layout/MainLayout.razor.cs | Show date/account filters on the Top Movers route. |
| PortfolioViewer/PortfolioViewer.WASM.Data/Services/IHoldingsDataService.cs | Declare bulk price-history API. |
| PortfolioViewer/PortfolioViewer.WASM.Data/Services/HoldingsDataService.cs | Implement bulk price-history query and per-symbol grouping. |
Comment on lines
+94
to
+113
| foreach (var holding in rawSnapShots) | ||
| { | ||
| if (holding.Symbol == null) continue; | ||
|
|
||
| var byDate = holding.Snapshots | ||
| .GroupBy(s => s.Date) | ||
| .Select(g => | ||
| { | ||
| var totalQuantity = g.Sum(x => x.Quantity); | ||
| return new HoldingPriceHistoryPoint | ||
| { | ||
| Date = g.Key, | ||
| Price = g.Min(x => x.CurrentUnitPrice), | ||
| AveragePrice = totalQuantity == 0 ? 0 : g.Sum(y => y.AverageCostPrice * y.Quantity) / totalQuantity, | ||
| }; | ||
| }) | ||
| .ToList(); | ||
|
|
||
| result[holding.Symbol] = byDate; | ||
| } |
Comment on lines
+80
to
+84
| Symbol = x.SymbolProfiles | ||
| .Where(sp => symbolList.Contains(sp.Symbol)) | ||
| .OrderBy(sp => Datasource.GetPriority(sp.DataSource)) | ||
| .Select(sp => sp.Symbol) | ||
| .FirstOrDefault(), |
|
Development container publishedInstall with: |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.


No description provided.