Display invalid activity in csv import (#2460)
* Display invalid activity in csv import * Update changelog
This commit is contained in:
parent
6a19eab425
commit
ac0ad48a65
@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
- Improved the error message in the activities import for `csv` files
|
||||||
- Allowed to edit today’s historical market data in the asset profile details dialog of the admin control panel
|
- Allowed to edit today’s historical market data in the asset profile details dialog of the admin control panel
|
||||||
|
|
||||||
## 2.13.0 - 2023-10-20
|
## 2.13.0 - 2023-10-20
|
||||||
|
@ -267,6 +267,8 @@ export class ImportActivitiesDialog implements OnDestroy {
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
} else if (file.name.endsWith('.csv')) {
|
} else if (file.name.endsWith('.csv')) {
|
||||||
|
const content = fileContent.split('\n').slice(1);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const data = await this.importActivitiesService.importCsv({
|
const data = await this.importActivitiesService.importCsv({
|
||||||
fileContent,
|
fileContent,
|
||||||
@ -277,7 +279,7 @@ export class ImportActivitiesDialog implements OnDestroy {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
this.handleImportError({
|
this.handleImportError({
|
||||||
activities: error?.activities ?? [],
|
activities: error?.activities ?? content,
|
||||||
error: {
|
error: {
|
||||||
error: { message: error?.error?.message ?? [error?.message] }
|
error: { message: error?.error?.message ?? [error?.message] }
|
||||||
}
|
}
|
||||||
|
5
test/import/invalid-multi-line.csv
Normal file
5
test/import/invalid-multi-line.csv
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
Date,Code,Currency,Price,Quantity,Action,Fee,Note
|
||||||
|
16-09-2021,MSFT,USD,298.580,5,buy,19.00,My first order 🤓
|
||||||
|
17/11/2021,MSFT,USD,0.62,5,dividend,0.00
|
||||||
|
01.01.2022,Penthouse Apartment,USD,500000.0,1,<invalid>,0.00
|
||||||
|
20500606,MSFT,USD,0.00,0,buy,0.00
|
|
Loading…
x
Reference in New Issue
Block a user