Bugfix/fix issue with overridden names in activities table (#3200)

* Fix issue with overridden names

* Update changelog
pull/3202/head
Thomas Kaul 10 months ago committed by GitHub
parent 98de2355c4
commit 88a9b518f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- Fixed the chart tooltip of the benchmark comparator - Fixed the chart tooltip of the benchmark comparator
- Fixed an issue with names in the activities table on the portfolio activities page while using symbol profile overrides
## 2.67.0 - 2024-03-26 ## 2.67.0 - 2024-03-26

@ -117,7 +117,7 @@ export class ImportService {
feeInBaseCurrency: 0, feeInBaseCurrency: 0,
id: assetProfile.id, id: assetProfile.id,
isDraft: false, isDraft: false,
SymbolProfile: <SymbolProfile>(<unknown>assetProfile), SymbolProfile: assetProfile,
symbolProfileId: assetProfile.id, symbolProfileId: assetProfile.id,
type: 'DIVIDEND', type: 'DIVIDEND',
unitPrice: marketPrice, unitPrice: marketPrice,
@ -521,22 +521,14 @@ export class ImportService {
currency, currency,
dataSource, dataSource,
symbol, symbol,
assetClass: null, activitiesCount: undefined,
assetSubClass: null, assetClass: undefined,
comment: null, assetSubClass: undefined,
countries: null, countries: undefined,
createdAt: undefined, createdAt: undefined,
figi: null,
figiComposite: null,
figiShareClass: null,
id: undefined, id: undefined,
isin: null, sectors: undefined,
name: null, updatedAt: undefined
scraperConfiguration: null,
sectors: null,
symbolMapping: null,
updatedAt: undefined,
url: null
} }
}; };
} }

@ -1,13 +1,19 @@
import { OrderWithAccount } from '@ghostfolio/common/types'; import { EnhancedSymbolProfile } from '@ghostfolio/common/interfaces';
import { AccountWithPlatform } from '@ghostfolio/common/types';
import { Order, Tag } from '@prisma/client';
export interface Activities { export interface Activities {
activities: Activity[]; activities: Activity[];
count: number; count: number;
} }
export interface Activity extends OrderWithAccount { export interface Activity extends Order {
Account?: AccountWithPlatform;
error?: ActivityError; error?: ActivityError;
feeInBaseCurrency: number; feeInBaseCurrency: number;
SymbolProfile?: EnhancedSymbolProfile;
tags?: Tag[];
updateAccountBalance?: boolean; updateAccountBalance?: boolean;
value: number; value: number;
valueInBaseCurrency: number; valueInBaseCurrency: number;

@ -23,7 +23,7 @@ import {
} from '@prisma/client'; } from '@prisma/client';
import { Big } from 'big.js'; import { Big } from 'big.js';
import { endOfToday, isAfter } from 'date-fns'; import { endOfToday, isAfter } from 'date-fns';
import { groupBy } from 'lodash'; import { groupBy, uniqBy } from 'lodash';
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';
import { Activities } from './interfaces/activities.interface'; import { Activities } from './interfaces/activities.interface';
@ -320,7 +320,32 @@ export class OrderService {
this.prismaService.order.count({ where }) this.prismaService.order.count({ where })
]); ]);
const uniqueAssets = uniqBy(
orders.map(({ SymbolProfile }) => {
return {
dataSource: SymbolProfile.dataSource,
symbol: SymbolProfile.symbol
};
}),
({ dataSource, symbol }) => {
return getAssetProfileIdentifier({
dataSource,
symbol
});
}
);
const assetProfiles =
await this.symbolProfileService.getSymbolProfiles(uniqueAssets);
const activities = orders.map((order) => { const activities = orders.map((order) => {
const assetProfile = assetProfiles.find(({ dataSource, symbol }) => {
return (
dataSource === order.SymbolProfile.dataSource &&
symbol === order.SymbolProfile.symbol
);
});
const value = new Big(order.quantity).mul(order.unitPrice).toNumber(); const value = new Big(order.quantity).mul(order.unitPrice).toNumber();
return { return {
@ -332,6 +357,7 @@ export class OrderService {
order.SymbolProfile.currency, order.SymbolProfile.currency,
userCurrency userCurrency
), ),
SymbolProfile: assetProfile,
// TODO: Use exchange rate of date // TODO: Use exchange rate of date
valueInBaseCurrency: this.exchangeRateDataService.toCurrency( valueInBaseCurrency: this.exchangeRateDataService.toCurrency(
value, value,

@ -1,9 +1,9 @@
import { Activity } from '@ghostfolio/api/app/order/interfaces/activities.interface';
import { import {
DataProviderInfo, DataProviderInfo,
EnhancedSymbolProfile, EnhancedSymbolProfile,
HistoricalDataItem HistoricalDataItem
} from '@ghostfolio/common/interfaces'; } from '@ghostfolio/common/interfaces';
import { OrderWithAccount } from '@ghostfolio/common/types';
import { Account, Tag } from '@prisma/client'; import { Account, Tag } from '@prisma/client';
@ -27,7 +27,7 @@ export interface PortfolioPositionDetail {
netPerformancePercent: number; netPerformancePercent: number;
netPerformancePercentWithCurrencyEffect: number; netPerformancePercentWithCurrencyEffect: number;
netPerformanceWithCurrencyEffect: number; netPerformanceWithCurrencyEffect: number;
orders: OrderWithAccount[]; orders: Activity[];
quantity: number; quantity: number;
SymbolProfile: EnhancedSymbolProfile; SymbolProfile: EnhancedSymbolProfile;
tags: Tag[]; tags: Tag[];

@ -50,7 +50,6 @@ import type {
AccountWithValue, AccountWithValue,
DateRange, DateRange,
GroupBy, GroupBy,
OrderWithAccount,
RequestWithUser, RequestWithUser,
UserWithSettings UserWithSettings
} from '@ghostfolio/common/types'; } from '@ghostfolio/common/types';
@ -1592,7 +1591,7 @@ export class PortfolioService {
activities, activities,
userCurrency userCurrency
}: { }: {
activities: OrderWithAccount[]; activities: Activity[];
userCurrency: string; userCurrency: string;
}) { }) {
return getSum( return getSum(
@ -1940,7 +1939,7 @@ export class PortfolioService {
activityType, activityType,
userCurrency userCurrency
}: { }: {
activities: OrderWithAccount[]; activities: Activity[];
activityType: ActivityType; activityType: ActivityType;
userCurrency: string; userCurrency: string;
}) { }) {

@ -1,3 +1,4 @@
import { Activity } from '@ghostfolio/api/app/order/interfaces/activities.interface';
import { DataService } from '@ghostfolio/client/services/data.service'; import { DataService } from '@ghostfolio/client/services/data.service';
import { UserService } from '@ghostfolio/client/services/user/user.service'; import { UserService } from '@ghostfolio/client/services/user/user.service';
import { downloadAsFile } from '@ghostfolio/common/helper'; import { downloadAsFile } from '@ghostfolio/common/helper';
@ -41,7 +42,7 @@ export class AccountDetailDialog implements OnDestroy, OnInit {
public activities: OrderWithAccount[]; public activities: OrderWithAccount[];
public balance: number; public balance: number;
public currency: string; public currency: string;
public dataSource: MatTableDataSource<OrderWithAccount>; public dataSource: MatTableDataSource<Activity>;
public equity: number; public equity: number;
public hasPermissionToDeleteAccountBalance: boolean; public hasPermissionToDeleteAccountBalance: boolean;
public historicalDataItems: HistoricalDataItem[]; public historicalDataItems: HistoricalDataItem[];

@ -1,3 +1,4 @@
import { Activity } from '@ghostfolio/api/app/order/interfaces/activities.interface';
import { DataService } from '@ghostfolio/client/services/data.service'; import { DataService } from '@ghostfolio/client/services/data.service';
import { UserService } from '@ghostfolio/client/services/user/user.service'; import { UserService } from '@ghostfolio/client/services/user/user.service';
import { DATE_FORMAT, downloadAsFile } from '@ghostfolio/common/helper'; import { DATE_FORMAT, downloadAsFile } from '@ghostfolio/common/helper';
@ -7,7 +8,6 @@ import {
LineChartItem, LineChartItem,
User User
} from '@ghostfolio/common/interfaces'; } from '@ghostfolio/common/interfaces';
import { OrderWithAccount } from '@ghostfolio/common/types';
import { translate } from '@ghostfolio/ui/i18n'; import { translate } from '@ghostfolio/ui/i18n';
import { import {
@ -37,7 +37,7 @@ import { PositionDetailDialogParams } from './interfaces/interfaces';
}) })
export class PositionDetailDialog implements OnDestroy, OnInit { export class PositionDetailDialog implements OnDestroy, OnInit {
public accounts: Account[]; public accounts: Account[];
public activities: OrderWithAccount[]; public activities: Activity[];
public assetClass: string; public assetClass: string;
public assetSubClass: string; public assetSubClass: string;
public averagePrice: number; public averagePrice: number;
@ -46,7 +46,7 @@ export class PositionDetailDialog implements OnDestroy, OnInit {
[code: string]: { name: string; value: number }; [code: string]: { name: string; value: number };
}; };
public dataProviderInfo: DataProviderInfo; public dataProviderInfo: DataProviderInfo;
public dataSource: MatTableDataSource<OrderWithAccount>; public dataSource: MatTableDataSource<Activity>;
public dividendInBaseCurrency: number; public dividendInBaseCurrency: number;
public feeInBaseCurrency: number; public feeInBaseCurrency: number;
public firstBuyDate: string; public firstBuyDate: string;

@ -8,16 +8,19 @@ export interface EnhancedSymbolProfile {
activitiesCount: number; activitiesCount: number;
assetClass: AssetClass; assetClass: AssetClass;
assetSubClass: AssetSubClass; assetSubClass: AssetSubClass;
comment: string | null; comment?: string;
countries: Country[]; countries: Country[];
createdAt: Date; createdAt: Date;
currency: string | null; currency?: string;
dataSource: DataSource; dataSource: DataSource;
dateOfFirstActivity?: Date; dateOfFirstActivity?: Date;
id: string; id: string;
isin: string | null; figi?: string;
name: string | null; figiComposite?: string;
scraperConfiguration?: ScraperConfiguration | null; figiShareClass?: string;
isin?: string;
name?: string;
scraperConfiguration?: ScraperConfiguration;
sectors: Sector[]; sectors: Sector[];
symbol: string; symbol: string;
symbolMapping?: { [key: string]: string }; symbolMapping?: { [key: string]: string };

Loading…
Cancel
Save