Conversation
| const NO = "Y7EAGQA1bfv"; | ||
| const PARTIAL = "Xgr3PJxcWfJ"; | ||
| const YES = "I93t0K7b1oN"; | ||
| const DEFAULT = "Xr12mI7VPn3"; |
There was a problem hiding this comment.
[note] Usually, we try not to hardcode IDs (and get entities by code/name on the config repo). Here it's a very custom app so I guess no need to change it.
| categoryOptionCombo: string; | ||
| attributeOptionCombo: string; | ||
| value?: boolean; | ||
| }[] = []; |
There was a problem hiding this comment.
Two identical types, we can create a type alias.
| count: item.count, | ||
| }) | ||
| ); | ||
| if (items === undefined) { |
There was a problem hiding this comment.
[minor] TS says items cannot be undefined. It's that so?
| rows.forEach(datavalue => { | ||
| if (option === "yes") { | ||
| if (datavalue.no === "1") { | ||
| this.prepareDataValue(datavalue, NO, "false"); |
There was a problem hiding this comment.
[functional programming] avoid forEach/push/calling methods that update variables somewhere -> map, compact, methods that return values.
| try { | ||
| if (this.dataValues.length > 0) { | ||
| const responsePush = await this.api | ||
| .post<any>("/dataValueSets?importStrategy=CREATE&async=false", {}, { dataValues: this.dataValues }) |
There was a problem hiding this comment.
We have the typed endpoint this.api.dataValues.postSet.
| value: string; | ||
| yes:boolean, | ||
| no:boolean, | ||
| partial:boolean, |
| @@ -0,0 +1,20 @@ | |||
| import { Id, NamedRef, Named } from "../common/entities/Base"; | |||
|
|
|||
| export interface DataValue { | |||
There was a problem hiding this comment.
Where is this used? we have some custom DataValue for the yesNoPartial
| @@ -0,0 +1,41 @@ | |||
| import { Id } from "../../common/entities/Base"; | |||
|
|
|||
| export interface DataValueItem { | |||
There was a problem hiding this comment.
[very minor] This Item sufix is a bit redundant.
| import { Id } from "../../common/entities/Base"; | ||
|
|
||
| export interface NHWAYesNoPartialDataValuesRepository { | ||
| get(options: NHWAYesNoPartialDataValuesRepositoryGetOptions): Promise<PaginatedObjects<DataValueItem>>; |
There was a problem hiding this comment.
[note] On Clean arch, typically we have an entity+repo that work together. Here we have NHWAYesNoPartialDataValues/DataValueItem, which is a bit confusing.
|
|
||
| export interface NHWAYesNoPartialDataValuesRepository { | ||
| get(options: NHWAYesNoPartialDataValuesRepositoryGetOptions): Promise<PaginatedObjects<DataValueItem>>; | ||
| push(dataValues: DataValueItemIdentifier[], option: string): Promise<boolean>; |
There was a problem hiding this comment.
push in the meaning of post?
📌 References
https://app.clickup.com/t/345tyu4
📝 Implementation
got all the rows from a sqlquery with more than 1 response grouped by yes/no/partial categoryoptioncombos.
you can select a group of rows and override the stored value using the dot action menu.
I have tried to change the way to delete the values using deleted:true but doesn't work, maybe the endpoint is different than the endpoint that i use.
Sqlview is in:
https://extranet.who.int/dhis2-dev/api/29/sqlViews/bsywqunulSd
report installed in dev and prod, example:
https://extranet.who.int/dhis2/dhis-web-reports/index.html#/standard-report/view/hSkPEosiPJN
🎨 Screenshots
🔥 Notes to the tester