-
Notifications
You must be signed in to change notification settings - Fork 6
4591 - Original Data Point Comments Separation - Activity logs #5218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 10 commits
7718e4b
5a8e42a
19d4c83
dde2112
f56e84e
0b1f7f5
6d02419
5d9c485
41b241e
cc35ff9
c80186c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import { Objects } from 'utils/objects' | ||
|
|
||
| import { CountryIso } from 'meta/area' | ||
| import { ODPNationalClass, OriginalDataPoint, OriginalDataPointComments } from 'meta/assessment/originalDataPoint' | ||
| import { | ||
| OriginalDataPointCommentKey, | ||
| OriginalDataPointValues, | ||
| } from 'meta/assessment/originalDataPoint/originalDataPoint' | ||
| import { TableNames } from 'meta/assessment/table' | ||
|
|
||
| import { ODPCommentColumns } from 'server/repository/assessmentCycle/originalDataPoint/commentColumns' | ||
|
|
||
| type ODPCommentColName<K extends OriginalDataPointCommentKey = OriginalDataPointCommentKey> = `comments_${Lowercase<K>}` | ||
|
|
||
| export type OriginalDataPointDB = { | ||
| [K in ODPCommentColName]: string | ||
| } & { | ||
| country_iso: CountryIso | ||
| data_source_additional_comments: string | null | ||
| data_source_methods: string | null | ||
| data_source_references: string | null | ||
| id_legacy: number | null | ||
| id: number | ||
| national_classes: Array<ODPNationalClass> | ||
| values: OriginalDataPointValues | ||
| year: number | ||
| } | ||
|
|
||
| const commentColumnExtent = ODPCommentColumns[TableNames.extentOfForest] as ODPCommentColName<TableNames.extentOfForest> | ||
| const commentColumnForestCharacteristics = ODPCommentColumns[ | ||
| TableNames.forestCharacteristics | ||
| ] as ODPCommentColName<TableNames.forestCharacteristics> | ||
|
|
||
| export const OriginalDataPointAdapter = (row: OriginalDataPointDB): OriginalDataPoint => { | ||
| if (Objects.isNil(row)) return null | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When can this be bull ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It can be null when a query returns no rows, so some tests fail without this check
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strange . Which query ? Do we use oneRoNone or map ?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's check this in the next pr @yaguzmang we merge this now . It was too big this pr to handle it properly |
||
|
|
||
| const { | ||
| [commentColumnExtent]: commentsExtentOfForest, | ||
| [commentColumnForestCharacteristics]: commentsForestCharacteristics, | ||
| ...rest | ||
| } = row | ||
|
|
||
| const comments: OriginalDataPointComments = { | ||
| [TableNames.extentOfForest]: commentsExtentOfForest, | ||
| [TableNames.forestCharacteristics]: commentsForestCharacteristics, | ||
| } | ||
|
|
||
| return { | ||
| ...(Objects.camelize(rest) as OriginalDataPoint), | ||
| comments, | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import { OriginalDataPointCommentKey } from 'meta/assessment/originalDataPoint' | ||
| import { TableNames } from 'meta/assessment/table' | ||
|
|
||
| export const ODPCommentColumns: Record<OriginalDataPointCommentKey, string> = { | ||
| [TableNames.extentOfForest]: `comments_${TableNames.extentOfForest.toLocaleLowerCase()}`, | ||
| [TableNames.forestCharacteristics]: `comments_${TableNames.forestCharacteristics.toLocaleLowerCase()}`, | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.