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: allow arbitrary response for suggester #900

Open
wants to merge 5 commits into
base: next
Choose a base branch
from

Conversation

QRuhier
Copy link
Contributor

@QRuhier QRuhier commented Jan 10, 2025

For suggester question only outside table, add the possibility of chosing to allow an arbritrary response.

It is quite close to clarification question for code lists, but instead of adding a list ClarificationQuestion in the question, we create a single object ArbitraryResponse.

  • on a suggester question, the user only has to chose if he wants to allow arbitrary response
  • when generating collected variables (in collected variables panel), it also generates an arbitrary variable (the user can then update its name/label) => by default, the name of the variable is ${questionName}_ARBITRARY, and its label is ${questionName}_ARBITRARY label

@QRuhier QRuhier changed the title feat: allow arbitrary for suggester feat: allow arbitrary response for suggester Jan 10, 2025
@QRuhier QRuhier force-pushed the feat/allow-arbitrary-for-suggester branch from 39e02a5 to 8aaf8b8 Compare January 10, 2025 16:22
@QRuhier QRuhier force-pushed the feat/allow-arbitrary-for-suggester branch from 8aaf8b8 to 9966148 Compare January 24, 2025 16:29
@QRuhier QRuhier marked this pull request as ready for review January 28, 2025 13:42
@QRuhier
Copy link
Contributor Author

QRuhier commented Jan 28, 2025

⚠️ do not merge until Eno dev is done

/*
* Get the list of arbitrary variables.
* An arbitrary variable is the "ArbitraryResponse" object of a question,
* adding "arbitraryOfVariable" which is the corresponding Response variable.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arbitraryOfVariable sounds weird and unclear.

We could replace it by arbitraryResponseVariableId?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that was tricky to name it.
arbitraryResponseVariableId is maybe better, but it's also confusing as we can think it is the id of the arbitrary response variable, not the "main" response variable" :-D

@@ -629,6 +689,36 @@ function getClarificationResponseTableQuestion(
};
}

function getArbitraryResponse(collectedVariablesStore, collectedVariables) {
const collectedvariablequestion = [];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

camelCase

Should be plural since it's a list.

@@ -889,6 +889,10 @@ const dictionary: Dictionary = {
fr: 'Retrouver dans le questionnaire',
en: 'Retrieve in the questionnaire',
},
allowArbitraryResponse: {
fr: 'Autoriser une réponse libre',
en: 'Allow arbitrary response',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

en: 'Allow an arbitrary response',

@@ -10,12 +10,14 @@ import {
const { RADIO } = DATATYPE_VIS_HINT;

export const defaultState = {
allowArbitrary: false,
Copy link
Contributor

@chloe-renaud chloe-renaud Jan 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be clearer as allowArbitraryResponse.
It could be an arbitrary label or something.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea.
And even in the model we could rename it

@QRuhier QRuhier requested a review from chloe-renaud January 29, 2025 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants