Skip to content
Snippets Groups Projects
Commit 65813440 authored by jtimotei's avatar jtimotei
Browse files

Added some comments and solved a small issue

parent 72975664
No related branches found
No related tags found
1 merge request!14Add boxes frontend
Pipeline #17734 passed
import React from 'react'
/**
* PanelMCQ is a component that allows the user to generate mcq options
*/
class PanelMCQ extends React.Component {
constructor (props) {
super(props)
......@@ -12,6 +15,8 @@ class PanelMCQ extends React.Component {
labelTypes: ['None', 'True/False', 'A, B, C ...', '1, 2, 3 ...']
}
}
// this function is called when the input is changed for the number of possible answers
onChangeNPA (e) {
let value = parseInt(e.target.value)
if (!isNaN(value)) {
......@@ -24,6 +29,7 @@ class PanelMCQ extends React.Component {
}
}
// this function is called when the input is changed for the desired label type
onChangeLabelType (e) {
let value = parseInt(e.target.value)
if (!isNaN(value)) {
......@@ -38,6 +44,11 @@ class PanelMCQ extends React.Component {
}
}
/**
* This function generates an array with the labels for each option
* @param nrLabels the number of options that need to be generated
* @returns {any[]|string[]|number[]}
*/
generateLabels (nrLabels) {
let type = this.state.chosenLabelType
......@@ -53,6 +64,10 @@ class PanelMCQ extends React.Component {
}
}
/**
* This function renders the panel with the inputs for generating multiple choice options
* @returns the react component containing the mcq panel
*/
render () {
return (
<nav className='panel'>
......
......@@ -342,7 +342,7 @@ class ExamEditor extends React.Component {
)]
// depending on the rendering option, render the mc_options separately or in a single widget
if (widget.problem.mc_options.length > 0) {
if (widget.problem.mc_options.length > 0 && !this.props.finalized) {
elementList.push(this.renderMCWidget(widget))
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment