Skip to content
Snippets Groups Projects
Commit da5326f2 authored by Thomas Roos's avatar Thomas Roos
Browse files

Allow negative scores on problem

parent a84ae9e5
No related branches found
No related tags found
No related merge requests found
......@@ -54,7 +54,7 @@ class EditPanel extends React.Component {
})
}
changeScore = (event) => {
const patt = new RegExp(/^([1-9]\d*|0)?$/);
const patt = new RegExp(/^(-|(-?[1-9]\d*)|0)?$/);
if (patt.test(event.target.value)) {
this.setState({
......@@ -137,7 +137,8 @@ class EditPanel extends React.Component {
<div className="panel-block">
<BackButton onClick={this.props.toggleEdit} />
<SaveButton onClick={this.saveFeedback} disabled={!this.state.name} exists={this.props.feedback} />
<SaveButton onClick={this.saveFeedback} exists={this.props.feedback}
disabled={ !this.state.name || (this.state.score && isNaN(parseInt(this.state.score))) } />
</div>
</nav>
)
......
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