Skip to content
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

Feat/sprint17 #43

Merged
merged 71 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
4b9d96f
fix(surveysoverview): fix list households first access
lailabjil Jan 11, 2024
bfa33cb
fix(data): fix firstname of demo and reviewer
lailabjil Jan 11, 2024
83480a4
fix(data): fix type data
lailabjil Jan 15, 2024
6523e28
fix(meanoftransport): fix wording
lailabjil Jan 15, 2024
5f575fb
fix(auth): fix auth state
lailabjil Jan 15, 2024
7e11198
feat(score): add variables quality score
lailabjil Jan 15, 2024
5ecf66d
fix(version): update version
lailabjil Jan 15, 2024
c1ff5b2
fix(auth): fix state of auth
lailabjil Jan 15, 2024
fcd40b2
fix(score): fix calcul score + variable set
lailabjil Jan 15, 2024
8cf785b
feat(version): update version
lailabjil Jan 15, 2024
9099ae2
fix(qualityscore): fix build
lailabjil Jan 16, 2024
b7c6c89
fix(auth): fix sso call
lailabjil Jan 19, 2024
8bc5834
feat(lint): fix format
lailabjil Jan 23, 2024
51e1042
fix(data): fix data weeklyplanner
lailabjil Jan 23, 2024
d030c78
fix(version): version
lailabjil Jan 23, 2024
ec96285
fix(335): fix image edge ios
lailabjil Jan 23, 2024
78b3b0d
fix(337): fix wording android edge
lailabjil Jan 23, 2024
bb0c2b5
fix(filtres): fix reference vage for subCampaignId
lailabjil Jan 23, 2024
7f6dfa9
fix(version): update version
lailabjil Jan 23, 2024
585640f
Merge branch 'main' into feat/sprint17_client
lailabjil Jan 23, 2024
a7374f8
feat(lint): fix yarn lock
lailabjil Jan 23, 2024
017a96f
feat(duration): add labels of picker
lailabjil Jan 29, 2024
fc4b9d1
fix(responsive): fix logout
lailabjil Jan 29, 2024
4ce6bae
fix(responsive): fix activityorrouteplanner
lailabjil Jan 30, 2024
161ae97
fix(score): fix quality score
lailabjil Jan 30, 2024
1810ea6
fix(responsive): fix page help duration
lailabjil Jan 30, 2024
b6500f2
fix(weeklyplanner): fix clore
lailabjil Jan 30, 2024
825f628
fix(campaign): change subcampaignId for campaingId
lailabjil Jan 30, 2024
dd23275
fix(responsive): fix weeklyplanner
lailabjil Jan 30, 2024
b1f6bef
fix(doc): change images to local
lailabjil Jan 30, 2024
9234f71
Merge branch 'feat/sprint17' into feat/sprint17_client
lailabjil Jan 30, 2024
feb4ab4
fix(score): fix quality score
lailabjil Jan 30, 2024
55d3409
fix(version): update version
lailabjil Jan 30, 2024
fbac014
fix(auth): fix sso - test new usermanager
lailabjil Jan 30, 2024
db887f8
fix(PR): fix yarn
lailabjil Jan 30, 2024
c528192
fix(score): fix score
lailabjil Jan 30, 2024
d6d6031
fix(sso): test sso
lailabjil Jan 30, 2024
7538843
fix(sso): clean code
lailabjil Jan 30, 2024
d0a4f1e
fix(version): update version
lailabjil Jan 30, 2024
d0889a7
fix(sso): clean code
lailabjil Jan 30, 2024
4e5c4c9
fix(version): fix orch
lailabjil Jan 30, 2024
abd7004
fix(score): remove score when not is cloture
lailabjil Jan 30, 2024
8f94354
fix(demo): fix nom
lailabjil Jan 30, 2024
ec1cea3
fix(yarn): fix yarn lock
lailabjil Jan 30, 2024
7082eff
fix(pipeline): fix yarn
lailabjil Jan 30, 2024
504db66
fix(build): fix lint
lailabjil Jan 30, 2024
4adc2fe
fix(data): fix data when change nom
lailabjil Jan 31, 2024
50aa23b
fix(doc): fix lifecycle image
lailabjil Jan 31, 2024
91ee8bc
fix(version): update verison
lailabjil Jan 31, 2024
4afc07f
fix(auth): fix remove prop reviewer
lailabjil Feb 1, 2024
b25d2e0
fix(merge): fix merge
lailabjil Feb 1, 2024
21b2e0e
fix(version): update version
lailabjil Feb 6, 2024
cc524c7
fix(weeklyplanner): fix data of weeklyplanner
lailabjil Feb 6, 2024
dc1d748
fix(wording): fix label felicitation
lailabjil Feb 6, 2024
f264865
fix(qualityScore): show qualityscore alltime
lailabjil Feb 6, 2024
233fafc
fix(data): fix data weekly planner
lailabjil Feb 6, 2024
6d68236
fix(lint): remove unused code
lailabjil Feb 6, 2024
c0c2020
fix(sso): fix redirect reviewer home when connect with sso
lailabjil Feb 6, 2024
6f47fa1
Merge branch 'feat/sprint17_local' into feat/sprint17
lailabjil Feb 6, 2024
7ec4ba2
fix(responsive): fix android
lailabjil Feb 6, 2024
a26f8c9
fix(data): update data
lailabjil Feb 6, 2024
83ef3e2
fix(refresh): fix refresh data
lailabjil Feb 6, 2024
69dbdbb
fix(responsive): fix responsive android
lailabjil Feb 6, 2024
976fcae
fix(orchestrator): fix orchetrator worktime
lailabjil Feb 6, 2024
bd03ba9
fix(data): fix orchestrator
lailabjil Feb 6, 2024
f39ff42
fix(data): fix semanier
lailabjil Feb 7, 2024
8209510
fix(version): update version
lailabjil Feb 7, 2024
8c769b2
fix(data): fix data mode collected
lailabjil Feb 7, 2024
23a9f98
fix(eslint): remove unused code
lailabjil Feb 7, 2024
c4884c2
fix(PR): fix yarn lock
lailabjil Feb 7, 2024
dd3f80d
fix(eslint): remove unused code
lailabjil Feb 7, 2024
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 .env.development
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
REACT_APP_STROMAE_BACK_OFFICE_API_BASE_URL=https://stromae-edt-kc.demo.insee.io/
REACT_APP_EDT_ORGANISATION_API_BASE_URL=https://edt-api-kc.demo.insee.io/
REACT_APP_KEYCLOAK_AUTHORITY=https://auth.demo.insee.io/auth/realms/questionnaires-edt/
REACT_APP_KEYCLOAK_AUTHORITY_REVIEWER=https://auth.insee.io/auth/realms/questionnaires-particuliers/?kc_idp_hint=insee-ssp
REACT_APP_KEYCLOAK_CLIENT_ID=client-edt
REACT_APP_KEYCLOAK_REDIRECT_URI=http://localhost:3000/
REACT_APP_HOUSE_REFERENCE_REGULAR_EXPRESSION=.\$
Expand Down
1 change: 0 additions & 1 deletion .env.production
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
REACT_APP_STROMAE_BACK_OFFICE_API_BASE_URL=https://stromae-edt-kc.demo.insee.io/
REACT_APP_EDT_ORGANISATION_API_BASE_URL=https://edt-api-kc.demo.insee.io/
REACT_APP_KEYCLOAK_AUTHORITY=https://auth.demo.insee.io/auth/realms/questionnaires-edt/
REACT_APP_KEYCLOAK_AUTHORITY_REVIEWER=https://auth.insee.io/auth/realms/questionnaires-particuliers/?kc_idp_hint=insee-ssp
REACT_APP_KEYCLOAK_CLIENT_ID=client-edt
REACT_APP_KEYCLOAK_REDIRECT_URI=https://insee-recette-edt.k8s.keyconsulting.fr/
REACT_APP_HOUSE_REFERENCE_REGULAR_EXPRESSION=.\$
Expand Down
1 change: 0 additions & 1 deletion .env.staging
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
REACT_APP_STROMAE_BACK_OFFICE_API_BASE_URL=https://stromae-edt-kc.demo.insee.io/
REACT_APP_EDT_ORGANISATION_API_BASE_URL=https://edt-api-kc.demo.insee.io/
REACT_APP_KEYCLOAK_AUTHORITY=https://auth.demo.insee.io/auth/realms/questionnaires-edt/
REACT_APP_KEYCLOAK_AUTHORITY_REVIEWER=https://auth.insee.io/auth/realms/questionnaires-particuliers/?kc_idp_hint=insee-ssp
REACT_APP_KEYCLOAK_CLIENT_ID=client-edt
REACT_APP_KEYCLOAK_REDIRECT_URI=https://insee-edt.k8s.keyconsulting.fr/
REACT_APP_HOUSE_REFERENCE_REGULAR_EXPRESSION=.\$
Expand Down
18 changes: 8 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,11 +340,11 @@ Those states have been defined to ease the visibility of the ongoing current sur

## Lifecycle state

![](https://imgur.com/Y3bjnVs.png)
![](./src/documentation/images/lifecycle_state.png)

### Project structure

![](https://i.imgur.com/Jt1FrnR.png)
![](./src/documentation/images/projet_structure.png)

`src` : Contains all the source code of the application. It also has the 2 surveys sources required by Lunatic and used by EDT.

Expand Down Expand Up @@ -392,7 +392,7 @@ SSO is available using INSEE LDAP only with users with reviewer role. The review

#### Architecture schema

![](https://i.imgur.com/Q3sKoCe.png)
![](./src/documentation/images/schema_architecture.png)

#### API Edt-pilotage

Expand Down Expand Up @@ -976,7 +976,7 @@ The `.env.production` file is used when the builded app is hosted.
REACT_APP_STROMAE_BACK_OFFICE_API_BASE_URL=https://stromae-edt-kc.demo.insee.io/
REACT_APP_EDT_ORGANISATION_API_BASE_URL=https://edt-api-kc.demo.insee.io/
REACT_APP_KEYCLOAK_AUTHORITY=https://auth.demo.insee.io/auth/realms/questionnaires-edt/
REACT_APP_KEYCLOAK_AUTHORITY_REVIEWER=https://auth.insee.io/auth/realms/questionnaires-particuliers/?kc_idp_hint=insee-ssp
REACT_APP_KEYCLOAK_AUTHORITY_REVIEWER=https://auth.insee.io/auth/realms/questionnaires-particuliers/
REACT_APP_KEYCLOAK_CLIENT_ID=client-edt
REACT_APP_KEYCLOAK_REDIRECT_URI=https://insee-recette-edt.k8s.keyconsulting.fr/
REACT_APP_HOUSE_REFERENCE_REGULAR_EXPRESSION=.\$
Expand Down Expand Up @@ -1019,7 +1019,7 @@ Even if you create a path, it never passes through this component, so we cannot

The callbackHolder function recovers the data and the errors which give us lunatic.

![](https://imgur.com/SNpbvje.png)
![](./src/documentation/images/orchestrator_code.png)

The getData() function provided by lunatic, instead of returning it within callbackHolder, we proceed to process the data recovered by lunatic, to be able to transform that data, along with that of the database and obtain our data model filled with the COLLECTED and EDITED.

Expand All @@ -1038,9 +1038,7 @@ For each existing property :
- **value of COLLECTED:** data of lunatic *(callbackholder.getData()[prop].COLLECTED)*;



![](https://imgur.com/JCtEcUC.png)

![](./src/documentation/images/orchestrator_code_interviewer.png)

If the user is a reviewer, the data is treated as follows:

Expand Down Expand Up @@ -1076,11 +1074,11 @@ value of lunatic for value[iteration], other -> value of bdd (EDITED)
- **value of EDITED:** data of bbdd *(data[prop].EDITED)*;
- **value of COLLECTED:** data of bbdd *(data[prop].COLLECTED)*;

![](https://imgur.com/PNZL2hu.png)
![](./src/documentation/images/orchestrator_code_reviewer.png)

Here a diagram of the flow of orchestrator data

![Orchestrator data flow](https://imgur.com/yYYqvSJ.png)
![Orchestrator data flow](./src/documentation/images/orchestrator_flow.png)


## Maintenance and evolution
Expand Down
2 changes: 1 addition & 1 deletion e2e/mocks/activitySurveySource.json
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@
"name": "OTHERPRIVATE"
},
"id": "5",
"label": "\"Autre moyen privé (monorue,kk trottinette ou skate, bateau, électrique ou non...)\""
"label": "\"Autre moyen privé (monoroue, trottinette ou skate, bateau, électrique ou non...)\""
},
{
"response": {
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "edt",
"version": "3.10.3",
"dateVersion": "09/01/2024",
"version": "3.10.18",
"dateVersion": "07/02/2024",
"licence": "MIT",
"dependencies": {
"@emotion/react": "^11.10.4",
"@emotion/styled": "^11.10.4",
"@inseefr/lunatic": "2.0.7-v2",
"@inseefrlab/lunatic-edt": "^0.11.7",
"@inseefrlab/lunatic-edt": "^0.12.0",
"@mui/material": "^5.10.7",
"@mui/styles": "^5.12.0",
"@react-pdf/font": "2.2.0",
Expand Down Expand Up @@ -62,6 +62,7 @@
"@typescript-eslint/eslint-plugin": "^5.38.0",
"@typescript-eslint/parser": "^5.38.0",
"concurrently": "^7.4.0",
"dayjs": "^1.11.5",
"eslint": "^7.11.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-storybook": "^0.6.4",
Expand All @@ -75,8 +76,7 @@
"prettier": "^2.7.1",
"react-app-rewired": "^2.2.1",
"tsc-watch": "^5.0.3",
"typescript": "^4.8.3",
"dayjs": "^1.11.5"
"typescript": "^4.8.3"
},
"scripts": {
"start": "react-scripts start",
Expand Down
99 changes: 47 additions & 52 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useTranslation } from "react-i18next";
import { EdtRoutes } from "routes/EdtRoutes";
import { getDatas, initializeDatas, initializeListSurveys } from "service/survey-service";
import { getUserRights, setAuth, setUser, setUserToken } from "service/user-service";

import { getCookie } from "utils/utils";
const App = () => {
const { t } = useTranslation();
const [initialized, setInitialized] = useState(false);
Expand All @@ -30,53 +30,46 @@ const App = () => {
};

useEffect(() => {
if (
window.location.search &&
getCookie("KC_RESTART") == null &&
localStorage.getItem("setauth") == null
) {
localStorage.setItem("setauth", "yes");
window.location.search = "";
}

if (auth?.userData?.access_token && getDatas().size === 0 && error === undefined) {
setUserToken(auth.userData?.access_token);
setUser(auth.userData);
}

setAuth(auth);
//keeps user token up to date after session renewal
auth.userManager?.events.addUserLoaded(() => {
auth.userManager.getUser().then(user => {
setUserToken(user?.access_token || "");
setAuth(auth);
//keeps user token up to date after session renewal
auth.userManager.events.addUserLoaded(() => {
auth.userManager.getUser().then(user => {
setUserToken(user?.access_token || "");
});
});
});

auth.userManager?.events.addSilentRenewError(() => {
if (navigator.onLine) {
auth.userManager
.signoutRedirect({
id_token_hint: getTokenHint(),
})
.then(() => auth.userManager.clearStaleState())
.then(() => auth.userManager.signoutRedirectCallback())
.then(() => {
sessionStorage.clear();
localStorage.clear();
})
.then(() => auth.userManager.clearStaleState())
.then(() => window.location.replace(process.env.REACT_APP_PUBLIC_URL || ""))
.catch(err => {
setErrorType(err);
});
}
});

auth.userManager?.settings.userStore.getAllKeys().then(keys => {
auth.userManager.settings.stateStore.getAllKeys().then(keysState => {
if (
window.location.search.includes("state") &&
auth.userData == null &&
keys.length == 0 &&
keysState.length == 0
) {
window.location.search = "";
auth.userManager.events.addSilentRenewError(() => {
if (navigator.onLine) {
auth.userManager
.signoutRedirect({
id_token_hint: getTokenHint(),
})
.then(() => auth.userManager.clearStaleState())
.then(() => auth.userManager.signoutRedirectCallback())
.then(() => {
sessionStorage.clear();
localStorage.clear();
})
.then(() => auth.userManager.clearStaleState())
.then(() => window.location.replace(process.env.REACT_APP_PUBLIC_URL || ""))
.catch(err => {
setErrorType(err);
});
}
});
});

if (auth.userData) {
initializeDatas(setError).then(() => {
setInitialized(true);
});
Expand All @@ -89,18 +82,20 @@ const App = () => {
}
}, [auth]);

const renderErrorOrLoadingPage = () => {
return !error ? (
<LoadingFull
message={t("page.home.loading.message")}
thanking={t("page.home.loading.thanking")}
/>
) : (
<ErrorPage errorCode={error} atInit={true} />
);
};

return <>{initialized && !error ? <EdtRoutes /> : renderErrorOrLoadingPage()}</>;
return (
<>
{initialized && !error ? (
<EdtRoutes />
) : !error ? (
<LoadingFull
message={t("page.home.loading.message")}
thanking={t("page.home.loading.thanking")}
/>
) : (
<ErrorPage errorCode={error} atInit={true} />
)}
</>
);
};

export default App;
26 changes: 25 additions & 1 deletion src/activity-survey.json
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,30 @@
"name": "ISLOCKED",
"componentRef": ""
},
{
"variableType": "COLLECTED",
"values": {
"COLLECTED": null,
"EDITED": null,
"INPUTED": null,
"FORCED": null,
"PREVIOUS": null
},
"name": "QUALITY_SCORE",
"componentRef": ""
},
{
"variableType": "COLLECTED",
"values": {
"COLLECTED": null,
"EDITED": null,
"INPUTED": null,
"FORCED": null,
"PREVIOUS": null
},
"name": "QUALITY_SCORE_SUBSTRACT_POINTS",
"componentRef": ""
},
{
"variableType": "CALCULATED",
"expression": "true",
Expand Down Expand Up @@ -907,7 +931,7 @@
"name": "OTHERPRIVATE"
},
"id": "5",
"label": "\"Autre moyen privé (monorue,kk trottinette ou skate, bateau, électrique ou non...)\""
"label": "\"Autre moyen privé (monoroue, trottinette ou skate, bateau, électrique ou non...)\""
},
{
"response": {
Expand Down
48 changes: 27 additions & 21 deletions src/assets/illustration/install/ios/edge2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 15 additions & 17 deletions src/components/commons/SurveyPage/SurveyPageStep/SurveyPageStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ const SurveyPageStep = (props: SurveyPageStepProps) => {
const navigate = useNavigate();

useEffect(() => {
setEnviro(context, navigate, callbackHolder);
if (context.surveyRootPage == EdtRoutesNameEnum.WORK_TIME) {
setEnviro(context, navigate);
} else {
setEnviro(context, navigate, callbackHolder);
}
});

const { classes, cx } = useStyles({
Expand Down Expand Up @@ -131,19 +135,17 @@ const SurveyPageStep = (props: SurveyPageStepProps) => {
modifiable: modifiable,
};

const nextRouteNav = useCallback(() => {
if (validateButton) {
return validateButton;
} else {
nextRoute
? saveAndNavFullPath(idSurvey, nextRoute)
: saveAndNextStep(idSurvey, context.source, context.surveyRootPage, currentPage);
}
}, []);

const surveyPageNotStepProps = {
idSurvey: idSurvey,
validate: nextRouteNav,
validate:
validateButton ??
useCallback(
() =>
nextRoute
? saveAndNavFullPath(idSurvey, nextRoute)
: saveAndNextStep(idSurvey, context.source, context.surveyRootPage, currentPage),
[],
),
srcIcon: errorIcon,
altIcon: errorAltIcon ? t(errorAltIcon) : undefined,
onNavigateBack: useCallback(() => saveAndNav(idSurvey), []),
Expand Down Expand Up @@ -203,10 +205,6 @@ const SurveyPageStep = (props: SurveyPageStepProps) => {
);
};

const stylePageMobileTabletWhenIOS = (isOpen: boolean) => {
return isOpen ? "80vh" : "87vh";
};

const useStyles = makeStylesEdt<{
isMobile: boolean;
isIOS: boolean;
Expand All @@ -223,7 +221,7 @@ const useStyles = makeStylesEdt<{
},
pageMobileTablet: {
height: "100%",
maxHeight: isIOS ? stylePageMobileTabletWhenIOS(isOpen) : "94vh",
maxHeight: isIOS ? (isOpen ? "80vh" : "87vh") : "94vh",
},
}));

Expand Down
4 changes: 3 additions & 1 deletion src/components/edt/DayCard/DayCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const DayCard = (props: DayCardProps) => {
const progressActivity = getScore(idSurvey, t);
const modeReviewer = getIsModeReviewer();
const { activitiesRoutesOrGaps, overlaps } = getActivitiesOrRoutes(t, idSurvey);
const qualityScore = getQualityScore(activitiesRoutesOrGaps, overlaps, t);
const qualityScore = getQualityScore(idSurvey, activitiesRoutesOrGaps, overlaps, t).group;
const stateSurvey = getStatutSurvey(idSurvey);
const isItMobile = isMobile();

Expand Down Expand Up @@ -229,6 +229,8 @@ const useStyles = makeStylesEdt({ "name": { DayCard } })(theme => ({
display: "flex",
flexDirection: "column",
alignItems: "center",
textAlign: "center",
minWidth: "67px",
},
qualityScoreText: {
color: theme.palette.secondary.main,
Expand Down
Loading
Loading