Skip to content

Commit

Permalink
Fix MCQ option 0 not showing hints (#329)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
remo5000 authored Aug 24, 2018
1 parent 38c7e61 commit 8b8d9ef
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "cadet-frontend",
"version": "1.0.4",
"version": "1.0.5",
"scripts-info": {
"format": "Format source code",
"start": "Start the Webpack development server",
Expand Down
6 changes: 3 additions & 3 deletions src/components/workspace/MCQChooser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class MCQChooser extends React.PureComponent<IMCQChooserProps, State> {
mcqOption: i
})
}
const shouldDisplayMessage = this.props.mcq.solution && this.props.mcq.choices[i].hint
const shouldDisplayMessage = this.props.mcq.solution !== null && this.props.mcq.choices[i].hint
if (shouldDisplayMessage) {
const hintElement = <Markdown content={this.props.mcq.choices[i].hint!} />
if (i === this.props.mcq.solution) {
Expand All @@ -86,8 +86,8 @@ class MCQChooser extends React.PureComponent<IMCQChooserProps, State> {
solution: number | null
): Intent => {
const active = currentOption === chosenOption
const correctOptionSelected = active && solution && currentOption === solution
if (!solution) {
const correctOptionSelected = active && solution !== null && currentOption === solution
if (solution === null) {
return Intent.NONE
} else if (active && correctOptionSelected) {
return Intent.SUCCESS
Expand Down
2 changes: 1 addition & 1 deletion src/mocks/assessmentAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ What's your favourite dinner food?
id: 2,
library: mockCurveLibrary,
type: 'mcq',
solution: 2
solution: 0
},
{
answer: 3,
Expand Down

0 comments on commit 8b8d9ef

Please sign in to comment.