Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/enumerations/StateDataStateEnum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ export enum StateDataStateEnum {
VALIDATED = "VALIDATED",
TOEXTRACT = "TO-EXTRACT",
EXTRACTED = "EXTRACTED",
COMPLETED = "COMPLETED",
LOCKED = "LOCKED",
}
2 changes: 1 addition & 1 deletion src/pages/end-survey/EndSurvey.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const EndSurveyPage = () => {
setValue(idSurvey, FieldNameEnum.ISENVOYED, true);
const dataWithIsClosed = setValue(idSurvey, FieldNameEnum.ISCLOSED, true);
const stateData: StateData = {
state: StateDataStateEnum.COMPLETED,
state: StateDataStateEnum.VALIDATED,
date: Date.now(),
currentPage: getCurrentPage(callbackHolder.getData(), context.source),
};
Expand Down
5 changes: 2 additions & 3 deletions src/service/navigation-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
} from "./survey-service";
import { getLastPageStep } from "./stepper.service";
import { surveyReadOnly } from "./survey-activity-service";
import { isSurveyClosed, isSurveyCompleted, isSurveyValidated } from "./survey-state-service";
import { isSurveyClosed, isSurveyValidated } from "./survey-state-service";
import { mergeObjects } from "../utils/utils";

let _context: OrchestratorContext;
Expand Down Expand Up @@ -493,8 +493,7 @@ const navToActivityOrPlannerOrSummary = (
) => {
const surveyIsClosed = isSurveyClosed(idSurvey);
const surveyIsValidated = isSurveyValidated(idSurvey);
const surveyIsCompleted = isSurveyCompleted(idSurvey);
if (surveyIsClosed || surveyIsValidated || surveyIsCompleted) {
if (surveyIsClosed || surveyIsValidated) {
const surveyIsEnvoyed = getValue(idSurvey, FieldNameEnum.ISENVOYED);
if (surveyIsEnvoyed || surveyIsValidated) {
navigate(
Expand Down
4 changes: 1 addition & 3 deletions src/service/survey-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ import {
initStateData,
isDemoMode,
isSurveyClosed,
isSurveyCompleted,
isSurveyExtracted,
isSurveyLocked,
isSurveyStarted,
Expand Down Expand Up @@ -1560,12 +1559,11 @@ const getStatsHousehold = (surveys: UserSurveys[]): StatsHousehold => {
const isExtracted = isSurveyExtracted(idSurvey);
const isClosed = isSurveyClosed(idSurvey);
const isStarted = isSurveyStarted(idSurvey);
const isCompleted = isSurveyCompleted(idSurvey);
numHouseholds++;

if (isValidated || isExtracted) {
numHouseholdsValidated++;
} else if (isClosed || isCompleted) {
} else if (isClosed) {
numHouseholdsClosed++;
} else if (isStarted) {
numHouseholdsInProgress++;
Expand Down
8 changes: 1 addition & 7 deletions src/service/survey-state-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,10 @@ const isSurveyStarted = (idSurvey: string) => {
return survey.COLLECTED != null && survey.COLLECTED.SURVEYDATE?.COLLECTED != null;
};

const isSurveyCompleted = (idSurvey: string) => {
const stateData = getLocalSurveyStateData(getData(idSurvey));
return stateData.state == StateDataStateEnum.COMPLETED;
};

const isSurveyExtracted = (idSurvey: string) => {
const stateData = getLocalSurveyStateData(getData(idSurvey));
return stateData.state == StateDataStateEnum.EXTRACTED;
}
};

const isSurveyClosed = (idSurvey: string) => {
const isClosed = getValue(idSurvey, FieldNameEnum.ISCLOSED) as boolean;
Expand Down Expand Up @@ -184,7 +179,6 @@ export {
isSurveyExtracted,
isSurveyClosed,
isSurveyStarted,
isSurveyCompleted,
getStatutSurvey,
getLocalSurveyStateData,
lockAllSurveys,
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1202,10 +1202,10 @@
dependencies:
antlr4 "4.8.0"

"@inseefrlab/lunatic-edt@^0.15.2":
version "0.15.2"
resolved "https://registry.yarnpkg.com/@inseefrlab/lunatic-edt/-/lunatic-edt-0.15.2.tgz#57d277a290b0582c0fb3a167f8b2fae8063ccf92"
integrity sha512-oug/+RMwH+9rK63nA8HPdTon8L7euWkpTc0JVJVi3tZlMvIIMRPLjboHtRCUt8XnFJ2KrtWLrc5hCtVAEqd+kQ==
"@inseefrlab/lunatic-edt@^0.15.3":
version "0.15.3"
resolved "https://registry.yarnpkg.com/@inseefrlab/lunatic-edt/-/lunatic-edt-0.15.3.tgz#950f8c7b0c113cfa9ca1bfaf481341f6359614f5"
integrity sha512-6VOi+LHhhgl4QEaCIE1x/s00xqxeM47TmLapPo+QRSqR5/UToiBJWOl6uOA0iT+J3qYJE5+G2pEoAfAaT9+2EQ==
dependencies:
"@date-io/dayjs" "^2.16.0"
"@emotion/react" "^11.10.4"
Expand Down