Skip to content

Commit

Permalink
Dev fix date range (#686)
Browse files Browse the repository at this point in the history
* fix : date minimum and maximum were never validated
* use Name from questionnaireList (recently added in pogues-back-office)
* version: update version to 1.5.3
  • Loading branch information
BulotF authored Jun 22, 2023
1 parent 7a968d5 commit f4cf8c6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pogues",
"version": "1.5.2",
"version": "1.5.3",
"description": "Outil de conception et de test de questionnaires.",
"repository": {
"type": "git",
Expand Down
19 changes: 7 additions & 12 deletions src/layout/questionnaire-list/components/questionnaire-list.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Dropdown from 'widgets/dropdown';
import Loader from 'layout/loader';
import Dictionary from 'utils/dictionary/dictionary';
import { formatDate, getState } from 'utils/component/component-utils';
import { getStampsList, getQuestionnaire } from 'utils/remote-api';
import { getStampsList } from 'utils/remote-api';
import { getWeight } from 'utils/component/generic-input-utils';
import { COMPONENT_TYPE, TCM } from 'constants/pogues-constants';

Expand Down Expand Up @@ -59,25 +59,20 @@ const QuestionnaireList = props => {
[handleCloseNewQuestionnaire, mergeQuestionnaires, token],
);

// function addQuestionnaireRef (checkedQuestionnaire) {
const addQuestionnaireRef = async checkedQuestionnaire => {
function addQuestionnaireRef(checkedQuestionnaire) {
const weight = selectedComponentId
? getWeight(componentsStore, selectedComponentId)
: Object.values(componentsStore).filter(
component =>
(component.type === SEQUENCE && component.id !== 'idendquest') ||
component.type === EXTERNAL_ELEMENT,
).length;
const externalQuestionnaire = await getQuestionnaire(
checkedQuestionnaire,
token,
);
/* const externalQuestionnaire = questionnaires.find(
const externalQuestionnaire = questionnaires.find(
q => q.id === checkedQuestionnaire,
); */
);
const componentState = {
id: checkedQuestionnaire,
name: externalQuestionnaire.name || externalQuestionnaire.Name,
name: externalQuestionnaire.name,
parent: activeQuestionnaire.id,
weight: weight,
children: [],
Expand All @@ -87,7 +82,7 @@ const QuestionnaireList = props => {
flowcontrol: [],
redirections: {},
dynamiqueSpecified: '',
label: externalQuestionnaire.label || externalQuestionnaire.Label[0],
label: externalQuestionnaire.label,
type: EXTERNAL_ELEMENT,
};
createComponent(
Expand All @@ -101,7 +96,7 @@ const QuestionnaireList = props => {
.then(orderComponents)
.then(handleNewChildQuestionnaireRef(checkedQuestionnaire))
.then(handleCloseNewQuestionnaire);
};
}

const handleAction = (id, label) => {
if (isComposition) return addQuestionnaireRef(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function ResponseFormatDatatypeDate({
component={Input}
label={Dictionary.minimum}
validate={date({
format: formatInit,
format: formatInit.toLowerCase(),
message: Dictionary.formatDate ? Dictionary.formatDate : '',
allowBlank: true,
})}
Expand All @@ -71,7 +71,7 @@ function ResponseFormatDatatypeDate({
component={Input}
label={Dictionary.maximum}
validate={date({
format: formatInit,
format: formatInit.toLowerCase(),
message: Dictionary.formatDate ? Dictionary.formatDate : '',
allowBlank: true,
})}
Expand Down

0 comments on commit f4cf8c6

Please sign in to comment.