Skip to content

Commit

Permalink
Add resubmit (debug mode) button to reference solution.
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Krulis committed Jan 10, 2018
1 parent 135c5f1 commit 8bf3bda
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/pages/ReferenceSolution/ReferenceSolution.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class ReferenceSolution extends Component {
params: { exerciseId, referenceSolutionId },
refreshSolutionEvaluations,
evaluateReferenceSolution,
evaluateReferenceSolutionInDebugMode,
intl: { formatMessage },
links: { EXERCISES_URI, EXERCISE_URI_FACTORY }
} = this.props;
Expand Down Expand Up @@ -166,6 +167,22 @@ class ReferenceSolution extends Component {
defaultMessage="Resubmit"
/>
</Button>}
{permissionHints &&
permissionHints.evaluate !== false &&
<Button
bsStyle="danger"
className="btn-flat"
onClick={() =>
evaluateReferenceSolutionInDebugMode().then(
refreshSolutionEvaluations
)}
>
<SendIcon />{' '}
<FormattedMessage
id="app.referenceSolutionDetail.resubmitDebug"
defaultMessage="Resubmit in Debug Mode"
/>
</Button>}
</p>
</Col>
</Row>
Expand Down Expand Up @@ -202,6 +219,7 @@ ReferenceSolution.propTypes = {
loadAsync: PropTypes.func.isRequired,
refreshSolutionEvaluations: PropTypes.func.isRequired,
evaluateReferenceSolution: PropTypes.func.isRequired,
evaluateReferenceSolutionInDebugMode: PropTypes.func.isRequired,
referenceSolutions: ImmutablePropTypes.map,
intl: intlShape.isRequired,
links: PropTypes.object.isRequired
Expand All @@ -219,7 +237,9 @@ export default withLinks(
dispatch(fetchReferenceSolutions(params.exerciseId));
},
evaluateReferenceSolution: () =>
dispatch(evaluateReferenceSolution(params.referenceSolutionId))
dispatch(evaluateReferenceSolution(params.referenceSolutionId)),
evaluateReferenceSolutionInDebugMode: () =>
dispatch(evaluateReferenceSolution(params.referenceSolutionId, true))
})
)(ReferenceSolution)
)
Expand Down

0 comments on commit 8bf3bda

Please sign in to comment.