Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Show decimal `transactionCount` and singular for 1 transaction (#327)

Ivo Valchev01feead0175c
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b8dfcd8a70..e466f511c3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+### Unreleased
+
+### Fixed
+
+- Fixed the value formatting for integers (transactions count)
+
## 1.44.0 - 30.08.2021
### Changed
diff --git a/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.html b/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.html
index 870ec1fbef..26e6aa43e7 100644
--- a/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.html
+++ b/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.html
@@ -102,9 +102,10 @@
</div>
<div class="col-6 mb-3">
<gf-value
- label="Transactions"
size="medium"
- [isCurrency]="true"
+ [isCurrency]="false"
+ [isInteger]="true"
+ [label]="transactionCount === 1 ? 'Transaction' : 'Transactions'"
[locale]="data.locale"
[value]="transactionCount"
></gf-value>
diff --git a/apps/client/src/app/components/value/value.component.ts b/apps/client/src/app/components/value/value.component.ts
index b4b619c5d1..1452bef592 100644
--- a/apps/client/src/app/components/value/value.component.ts
+++ b/apps/client/src/app/components/value/value.component.ts
@@ -19,6 +19,7 @@ export class ValueComponent implements OnChanges, OnInit {
@Input() colorizeSign: boolean;
@Input() currency: string;
@Input() isCurrency: boolean;
+ @Input() isInteger: boolean;
@Input() isPercent: boolean;
@Input() label: string;
@Input() locale: string;
@@ -84,6 +85,13 @@ export class ValueComponent implements OnChanges, OnInit {
minimumFractionDigits: 2
});
} catch {}
+ } else if (this.isInteger) {
+ try {
+ this.formattedValue = this.value?.toLocaleString(this.locale, {
+ maximumFractionDigits: 0,
+ minimumFractionDigits: 0
+ });
+ } catch {}
}
} else {
try {