Allow viewing evolution chart for individual or multiple sources across categories
Adds multi-source selection to the evolution chart source filter. Users can now tap multiple sources to compare their evolution side by side, regardless of which category they belong to. Fixes #24 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -86,6 +86,7 @@ class ChartsViewModel: ObservableObject {
|
||||
@Published var selectedChartType: ChartType = .evolution
|
||||
@Published var selectedCategory: Category?
|
||||
@Published var selectedSource: InvestmentSource?
|
||||
@Published var selectedSourceIds: Set<UUID> = []
|
||||
@Published var selectedTimeRange: TimeRange = .year
|
||||
@Published var selectedAccount: Account?
|
||||
@Published var showAllAccounts = true
|
||||
@@ -290,7 +291,12 @@ class ChartsViewModel: ObservableObject {
|
||||
}
|
||||
|
||||
let sources: [InvestmentSource]
|
||||
if let selectedSource {
|
||||
if !selectedSourceIds.isEmpty {
|
||||
sources = sourceRepository.sources.filter { source in
|
||||
guard let id = source.id else { return false }
|
||||
return selectedSourceIds.contains(id) && shouldIncludeSource(source)
|
||||
}
|
||||
} else if let selectedSource {
|
||||
sources = sourceRepository.sources.filter { $0.id == selectedSource.id && shouldIncludeSource($0) }
|
||||
} else if let category = category {
|
||||
sources = sourceRepository.fetchSources(for: category).filter { shouldIncludeSource($0) }
|
||||
|
||||
Reference in New Issue
Block a user