Skip to content

Commit

Permalink
Merge pull request #273 from EyeSeeTea/development
Browse files Browse the repository at this point in the history
Release 1.6.6
  • Loading branch information
ifoche authored Jun 27, 2024
2 parents 4e6a6c6 + 03d6474 commit 029e20d
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 25 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "glass",
"description": "DHIS2 Glass App",
"version": "1.6.5",
"version": "1.6.6",
"license": "GPL-3.0",
"author": "EyeSeeTea team",
"homepage": ".",
Expand Down
27 changes: 15 additions & 12 deletions src/domain/usecases/data-entry/amr/ImportRISFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,19 @@ export class ImportRISFile {
.uniqBy("error")
.value();

const allBlockingErrors = [
...blockingCategoryOptionConsistencyErrors,
...pathogenAntibioticErrors,
...specimenPathogenErrors,
...astResultsErrors,
...batchIdErrors,
...yearErrors,
...countryErrors,
...duplicateRowErrors,
];
const allBlockingErrors =
action === "DELETE" //If delete, ignore consistency checks
? []
: [
...blockingCategoryOptionConsistencyErrors,
...pathogenAntibioticErrors,
...specimenPathogenErrors,
...astResultsErrors,
...batchIdErrors,
...yearErrors,
...countryErrors,
...duplicateRowErrors,
];

if (allBlockingErrors.length > 0) {
const errorImportSummary: ImportSummary = {
Expand Down Expand Up @@ -177,7 +180,7 @@ export class ImportRISFile {
rulesInstructions
);

const importSummary = mapDataValuesToImportSummary(saveSummary);
const importSummary = mapDataValuesToImportSummary(saveSummary, action);

const summaryWithConsistencyBlokingErrors = includeBlockingErrors(
importSummary,
Expand All @@ -192,7 +195,7 @@ export class ImportRISFile {
}
//If dry-run, do not run validations
else {
const importSummary = mapDataValuesToImportSummary(saveSummary);
const importSummary = mapDataValuesToImportSummary(saveSummary, action);

const summaryWithConsistencyBlokingErrors = includeBlockingErrors(importSummary, [
...allBlockingErrors,
Expand Down
26 changes: 17 additions & 9 deletions src/domain/usecases/data-entry/amr/ImportSampleFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,23 @@ export class ImportSampleFile {
.map(rulesInstructions => {
const dhis2ValidationErrors = checkDhis2Validations(validations, rulesInstructions);

const importSummary = mapDataValuesToImportSummary(saveSummary);

const summaryWithConsistencyBlokingErrors = includeBlockingErrors(importSummary, [
...batchIdErrors,
...yearErrors,
...countryErrors,
...dhis2ValidationErrors,
...duplicateRowErrors,
]);
const importSummary = mapDataValuesToImportSummary(saveSummary, action);

const allBlockingErrors =
action === "DELETE" //If delete, ignore consistency checks
? []
: [
...batchIdErrors,
...yearErrors,
...countryErrors,
...dhis2ValidationErrors,
...duplicateRowErrors,
];

const summaryWithConsistencyBlokingErrors = includeBlockingErrors(
importSummary,
allBlockingErrors
);

return summaryWithConsistencyBlokingErrors;
});
Expand Down
9 changes: 6 additions & 3 deletions src/domain/usecases/data-entry/utils/mapDhis2Summary.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import i18n from "@eyeseetea/d2-ui-components/locales";
import { DataValuesSaveSummary } from "../../../entities/data-entry/DataValuesSaveSummary";
import { DataValuesSaveSummary, ImportStrategy } from "../../../entities/data-entry/DataValuesSaveSummary";
import { ImportSummary } from "../../../entities/data-entry/ImportSummary";

export function mapDataValuesToImportSummary(dhis2Summary: DataValuesSaveSummary): ImportSummary {
export function mapDataValuesToImportSummary(
dhis2Summary: DataValuesSaveSummary,
action: ImportStrategy
): ImportSummary {
const nonBlockingErrors =
dhis2Summary.status === "WARNING"
? dhis2Summary.conflicts?.map(status => {
Expand All @@ -24,7 +27,7 @@ export function mapDataValuesToImportSummary(dhis2Summary: DataValuesSaveSummary
: [];

const ignoredErrors =
dhis2Summary.importCount.ignored > 0
action !== "DELETE" && dhis2Summary.importCount.ignored > 0 //If delete, ignore import ignored errors.
? dhis2Summary.conflicts && dhis2Summary.conflicts.length > 0
? dhis2Summary.conflicts?.map(status => {
return {
Expand Down

0 comments on commit 029e20d

Please sign in to comment.