-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feature/yesnopartial report #24
base: development
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[code-only review]
[merge with base branch required]
const NO = "Y7EAGQA1bfv"; | ||
const PARTIAL = "Xgr3PJxcWfJ"; | ||
const YES = "I93t0K7b1oN"; | ||
const DEFAULT = "Xr12mI7VPn3"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two identical types, we can create a type alias.
count: item.count, | ||
}) | ||
); | ||
if (items === undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have the typed endpoint this.api.dataValues.postSet
.
value: string; | ||
yes:boolean, | ||
no:boolean, | ||
partial:boolean, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not prettified
@@ -0,0 +1,20 @@ | |||
import { Id, NamedRef, Named } from "../common/entities/Base"; | |||
|
|||
export interface DataValue { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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