Skip to content

Commit 8b8d9ef

Browse files
authored
Fix MCQ option 0 not showing hints (#329)
* Fix MCQ option 0 not displaying intent and hints Truthy check, 0 is false. T-T * Format file * Keep one mock data as option 0 * Bump version
1 parent 38c7e61 commit 8b8d9ef

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "cadet-frontend",
4-
"version": "1.0.4",
4+
"version": "1.0.5",
55
"scripts-info": {
66
"format": "Format source code",
77
"start": "Start the Webpack development server",

src/components/workspace/MCQChooser.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class MCQChooser extends React.PureComponent<IMCQChooserProps, State> {
6060
mcqOption: i
6161
})
6262
}
63-
const shouldDisplayMessage = this.props.mcq.solution && this.props.mcq.choices[i].hint
63+
const shouldDisplayMessage = this.props.mcq.solution !== null && this.props.mcq.choices[i].hint
6464
if (shouldDisplayMessage) {
6565
const hintElement = <Markdown content={this.props.mcq.choices[i].hint!} />
6666
if (i === this.props.mcq.solution) {
@@ -86,8 +86,8 @@ class MCQChooser extends React.PureComponent<IMCQChooserProps, State> {
8686
solution: number | null
8787
): Intent => {
8888
const active = currentOption === chosenOption
89-
const correctOptionSelected = active && solution && currentOption === solution
90-
if (!solution) {
89+
const correctOptionSelected = active && solution !== null && currentOption === solution
90+
if (solution === null) {
9191
return Intent.NONE
9292
} else if (active && correctOptionSelected) {
9393
return Intent.SUCCESS

src/mocks/assessmentAPI.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ What's your favourite dinner food?
213213
id: 2,
214214
library: mockCurveLibrary,
215215
type: 'mcq',
216-
solution: 2
216+
solution: 0
217217
},
218218
{
219219
answer: 3,

0 commit comments

Comments
 (0)