Skip to content

Feature/yesnopartial report - #24

Open
idelcano wants to merge 16 commits into
developmentfrom
feature/yesnopartial_report
Open

idelcano wants to merge 16 commits into
developmentfrom
feature/yesnopartial_report

Conversation

@idelcano

Copy link
Copy Markdown
Contributor

📌 References

📝 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

@idelcano
idelcano requested a review from tokland August 23, 2022 15:41

@tokland tokland left a comment

Copy link
Copy Markdown
Contributor

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";

@tokland tokland Oct 24, 2022

Copy link
Copy Markdown
Contributor

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;
}[] = [];

Copy link
Copy Markdown
Contributor

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) {

Copy link
Copy Markdown
Contributor

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");

@tokland tokland Oct 24, 2022

Copy link
Copy Markdown
Contributor

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 })

Copy link
Copy Markdown
Contributor

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,

Copy link
Copy Markdown
Contributor

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 {

Copy link
Copy Markdown
Contributor

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 {

Copy link
Copy Markdown
Contributor

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>>;

@tokland tokland Oct 24, 2022

Copy link
Copy Markdown
Contributor

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>;

Copy link
Copy Markdown
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants