-
Notifications
You must be signed in to change notification settings - Fork 150
Ranking widget #817
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
base: dev
Are you sure you want to change the base?
Ranking widget #817
Conversation
A preview of 5cb988d is uploaded and can be seen here: ✨ https://revisit.dev/study/PR817 ✨ Changes may take a few minutes to propagate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small fixes and some docs required
Also, please add a link to the response type from the typeDocReadme.md
src/parser/types.ts
Outdated
```js | ||
{ | ||
"id": "ranking-sublist", | ||
"type": "ranking-sublist", | ||
"prompt": "Rank the following options", | ||
"location": "belowStimulus", | ||
"options": ["Option 1", "Option 2", "Option 3"] | ||
"numItems": 2 | ||
} | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add some more docs, an example of each type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added docs and examples
if ((matrixAnswers && matrixResponse.length > 0) || (rankingAnswers && rankingResponse.length > 0)) { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const updatedValues: Record<string, any> = { ...answerValidator.values }; | ||
// Adjust object to have new matrix response values | ||
matrixResponse.forEach((r) => { | ||
const { id } = r; | ||
updatedValues[id] = { | ||
...answerValidator.getInputProps(id).value, | ||
...matrixAnswers[id], | ||
}; | ||
}); | ||
|
||
rankingResponse.forEach((r) => { | ||
const { id } = r; | ||
updatedValues[id] = { | ||
...answerValidator.getInputProps(id).value, | ||
...rankingAnswers[id], | ||
}; | ||
}); | ||
|
||
// update answerValidator | ||
answerValidator.setValues(updatedValues); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need 2 ifs? 1 if is okay? no if?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed if statement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate some of this into demo-survey
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicated to demo-survey
Does this PR close any open issues?
Closes #690
Give a longer description of what this PR addresses and why it's needed
Provide pictures/videos of the behavior before and after these changes (optional)
Sub-list ranking mode
ranking-sublist.mov
Categorical binning mode
categorical.mov
Pairwise comparison mode
ranking-pairwise.mov
Are there any additional TODOs before this PR is ready to go?
TODOs:
Reference
https://ui.mantine.dev/category/dnd/
https://dev.to/kelseyroche/a-beginners-guide-to-drag-and-drop-with-dnd-kit-in-react-5hfe