Browse Source
Seperate raw type parsing from parseType and into helper. Fixes issue with duplicate default type warnings. #2288
pull/4056/head
Brandon Wortman
9 months ago
No known key found for this signature in database
GPG Key ID: C63DB7DA05AEC086
1 changed files with
17 additions and
8 deletions
-
apps/client/src/app/services/import-activities.service.ts
|
|
@ -261,7 +261,7 @@ export class ImportActivitiesService { |
|
|
|
} |
|
|
|
|
|
|
|
// If no data source specified, check the type
|
|
|
|
const type = this.parseType({ index: 0, item }); |
|
|
|
const type = this.getRawType({ item }); |
|
|
|
if (type === 'ITEM' || type === 'LIABILITY') { |
|
|
|
return DataSource.MANUAL; |
|
|
|
} |
|
|
@ -355,13 +355,7 @@ export class ImportActivitiesService { |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
private parseType({ |
|
|
|
index, |
|
|
|
item |
|
|
|
}: { |
|
|
|
index: number; |
|
|
|
item: any; |
|
|
|
}): ActivityType { |
|
|
|
private getRawType({ item }: { item: any }): ActivityType { |
|
|
|
item = this.lowercaseKeys(item); |
|
|
|
|
|
|
|
for (const key of ImportActivitiesService.TYPE_KEYS) { |
|
|
@ -386,6 +380,21 @@ export class ImportActivitiesService { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return undefined; |
|
|
|
} |
|
|
|
|
|
|
|
private parseType({ |
|
|
|
index, |
|
|
|
item |
|
|
|
}: { |
|
|
|
index: number; |
|
|
|
item: any; |
|
|
|
}): ActivityType { |
|
|
|
item = this.lowercaseKeys(item); |
|
|
|
const type = this.getRawType({ item }); |
|
|
|
if (type) { |
|
|
|
return type; |
|
|
|
} |
|
|
|
|
|
|
|
this.warnings.push( |
|
|
|
`activities.${index}.type is missing, defaulting to BUY` |
|
|
|