Skip to content

Commit

Permalink
fix: removed ISVALIDATED unused variable & isClosed check
Browse files Browse the repository at this point in the history
  • Loading branch information
MailineN committed Aug 20, 2024
1 parent ce09e08 commit 09585dc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 38 deletions.
7 changes: 0 additions & 7 deletions src/assets/surveyData/dataEmptyActivity.json
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,5 @@
"INPUTED": null,
"PREVIOUS": null,
"COLLECTED": null
},
"ISVALIDATED": {
"EDITED": null,
"FORCED": null,
"INPUTED": null,
"PREVIOUS": null,
"COLLECTED": null
}
}
12 changes: 0 additions & 12 deletions src/assets/surveyData/edtActivitySurvey.json
Original file line number Diff line number Diff line change
Expand Up @@ -485,18 +485,6 @@
"componentRef": "activityselecter_mainactivity",
"variableType": "COLLECTED"
},
{
"name": "ISVALIDATED",
"values": {
"EDITED": null,
"FORCED": null,
"INPUTED": null,
"PREVIOUS": null,
"COLLECTED": null
},
"componentRef": "",
"variableType": "COLLECTED"
},
{
"name": "ISLOCKED",
"values": {
Expand Down
29 changes: 10 additions & 19 deletions src/service/survey-state-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,11 @@ const isDemoMode = () => {
return getFlatLocalStorageValue(LocalStorageVariableEnum.IS_DEMO_MODE) === "true";
};

const isSurveyLocked = (idSurvey: string) => {
const isLocked = getValue(idSurvey, FieldNameEnum.ISLOCKED) as boolean;
return (isLocked != null && isLocked) || existVariableEdited(idSurvey);
};

// const surveyValidated = (idSurvey: string) => {
// const isValidated = getValue(idSurvey, FieldNameEnum.ISVALIDATED) as boolean;
// return isValidated != null && isValidated;
// };

// const surveyClosed = (idSurvey: string) => {
// const isClosed = getValue(idSurvey, FieldNameEnum.ISCLOSED) as boolean;
// return isClosed != null && isClosed;
// };

const isSurveyValidated = (idSurvey: string) => {
const stateData = getSurveyStateData(getData(idSurvey));
return stateData.state == StateDataStateEnum.VALIDATED;
};

const isSurveyClosed = (idSurvey: string) => {
const stateData = getSurveyStateData(getData(idSurvey));
return stateData.state == StateDataStateEnum.COMPLETED;
};
const isSurveyStarted = (idSurvey: string) => {
const stateData = getSurveyStateData(getData(idSurvey));
return stateData.state == StateDataStateEnum.INIT;
Expand All @@ -60,6 +41,16 @@ const isSurveyCompleted = (idSurvey: string) => {
return stateData.state == StateDataStateEnum.COMPLETED;
};

const isSurveyClosed = (idSurvey: string) => {
const isClosed = getValue(idSurvey, FieldNameEnum.ISCLOSED) as boolean;
return isClosed != null && isClosed;
};

const isSurveyLocked = (idSurvey: string) => {
const isLocked = getValue(idSurvey, FieldNameEnum.ISLOCKED) as boolean;
return (isLocked != null && isLocked) || existVariableEdited(idSurvey);
};

const getStatutSurvey = (idSurvey: string) => {
const isLocked = getValue(idSurvey, FieldNameEnum.ISLOCKED) as boolean;
const isValidated = isSurveyValidated(idSurvey);
Expand Down

0 comments on commit 09585dc

Please sign in to comment.