Browse Source

Bugfix/fix case-insensitive sorting in accounts table (#6178)

* Fix case-insensitive sorting by account name

* Update changelog
main
Thomas Kaul 2 days ago
committed by GitHub
parent
commit
d58e5f73e9
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 11
      libs/common/src/lib/helper.ts
  3. 6
      libs/ui/src/lib/accounts-table/accounts-table.component.ts

1
CHANGELOG.md

@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- Fixed the filtering by asset class in the endpoint `GET api/v1/portfolio/holdings` - Fixed the filtering by asset class in the endpoint `GET api/v1/portfolio/holdings`
- Fixed the case-insensitive sorting in the accounts table component
## 2.228.0 - 2026-01-03 ## 2.228.0 - 2026-01-03

11
libs/common/src/lib/helper.ts

@ -12,6 +12,7 @@ import {
subDays subDays
} from 'date-fns'; } from 'date-fns';
import { ca, de, es, fr, it, nl, pl, pt, tr, uk, zhCN } from 'date-fns/locale'; import { ca, de, es, fr, it, nl, pl, pt, tr, uk, zhCN } from 'date-fns/locale';
import { get, isNil, isString } from 'lodash';
import { import {
DEFAULT_CURRENCY, DEFAULT_CURRENCY,
@ -242,6 +243,16 @@ export function getLocale() {
return navigator.language ?? locale; return navigator.language ?? locale;
} }
export function getLowercase(object: object, path: string) {
const value = get(object, path);
if (isNil(value)) {
return '';
}
return isString(value) ? value.toLocaleLowerCase() : value;
}
export function getNumberFormatDecimal(aLocale?: string) { export function getNumberFormatDecimal(aLocale?: string) {
const formatObject = new Intl.NumberFormat(aLocale).formatToParts(9999.99); const formatObject = new Intl.NumberFormat(aLocale).formatToParts(9999.99);

6
libs/ui/src/lib/accounts-table/accounts-table.component.ts

@ -1,5 +1,5 @@
import { ConfirmationDialogType } from '@ghostfolio/common/enums'; import { ConfirmationDialogType } from '@ghostfolio/common/enums';
import { getLocale } from '@ghostfolio/common/helper'; import { getLocale, getLowercase } from '@ghostfolio/common/helper';
import { GfEntityLogoComponent } from '@ghostfolio/ui/entity-logo'; import { GfEntityLogoComponent } from '@ghostfolio/ui/entity-logo';
import { NotificationService } from '@ghostfolio/ui/notifications'; import { NotificationService } from '@ghostfolio/ui/notifications';
import { GfValueComponent } from '@ghostfolio/ui/value'; import { GfValueComponent } from '@ghostfolio/ui/value';
@ -32,7 +32,6 @@ import {
trashOutline, trashOutline,
walletOutline walletOutline
} from 'ionicons/icons'; } from 'ionicons/icons';
import { get } from 'lodash';
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader'; import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
import { Subject, Subscription } from 'rxjs'; import { Subject, Subscription } from 'rxjs';
@ -133,8 +132,9 @@ export class GfAccountsTableComponent implements OnChanges, OnDestroy {
this.isLoading = true; this.isLoading = true;
this.dataSource = new MatTableDataSource(this.accounts); this.dataSource = new MatTableDataSource(this.accounts);
this.dataSource.sortingDataAccessor = getLowercase;
this.dataSource.sort = this.sort; this.dataSource.sort = this.sort;
this.dataSource.sortingDataAccessor = get;
if (this.accounts) { if (this.accounts) {
this.isLoading = false; this.isLoading = false;

Loading…
Cancel
Save