Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/ReCodEx/web-app into exer…
Browse files Browse the repository at this point in the history
…cise-rights-tuning
  • Loading branch information
Martin Krulis committed Oct 27, 2017
2 parents 2b20eb3 + 27f99e0 commit 1cebb07
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 115 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ const AssignmentDetails = ({
isAfterSecondDeadline,
isBonus,
runtimeEnvironments,
canSubmit
canSubmit,
pointsPercentualThreshold
}) =>
<Box
title={
Expand Down Expand Up @@ -154,6 +155,20 @@ const AssignmentDetails = ({
<SuccessIcon />
</td>
</tr>}
<tr>
<td className="text-center">
<Icon name="percent" />
</td>
<td>
<FormattedMessage
id="app.assignment.pointsPercentualThreshold"
defaultMessage="Points percentual threshold:"
/>
</td>
<td>
{pointsPercentualThreshold * 100} %
</td>
</tr>
<tr>
<td className="text-center">
<Icon name="code" />
Expand Down Expand Up @@ -188,7 +203,8 @@ AssignmentDetails.propTypes = {
isAfterSecondDeadline: PropTypes.bool.isRequired,
isBonus: PropTypes.bool,
runtimeEnvironments: PropTypes.array,
canSubmit: ImmutablePropTypes.map
canSubmit: ImmutablePropTypes.map,
pointsPercentualThreshold: PropTypes.number
};

export default AssignmentDetails;
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Table } from 'react-bootstrap';
import Box from '../../widgets/Box';
import { MaybeSucceededIcon } from '../../icons';

const EvaluationDetail = ({ evaluation, note = '' }) => (
const EvaluationDetail = ({ evaluation, isCorrect }) =>
<Box
title={
<FormattedMessage
Expand Down Expand Up @@ -40,18 +40,6 @@ const EvaluationDetail = ({ evaluation, note = '' }) => (
</td>
</tr>

<tr>
<th>
<FormattedMessage
id="app.evaluationDetail.isValid"
defaultMessage="Evaluation is valid:"
/>
</th>
<td className="text-center">
<MaybeSucceededIcon success={evaluation.isValid} />
</td>
</tr>

<tr>
<th>
<FormattedMessage
Expand All @@ -74,8 +62,8 @@ const EvaluationDetail = ({ evaluation, note = '' }) => (
<td
className={classnames({
'text-center': true,
'text-danger': !evaluation.isCorrect,
'text-success': evaluation.isCorrect
'text-danger': !isCorrect,
'text-success': isCorrect
})}
>
<b>
Expand All @@ -85,12 +73,11 @@ const EvaluationDetail = ({ evaluation, note = '' }) => (
</tr>
</tbody>
</Table>
</Box>
);
</Box>;

EvaluationDetail.propTypes = {
evaluation: PropTypes.object.isRequired,
note: PropTypes.string
isCorrect: PropTypes.bool.isRequired
};

export default EvaluationDetail;
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const EvaluationTable = ({
referenceSolutionId,
exerciseId,
links: { REFERENCE_SOLUTION_EVALUATION_URI_FACTORY }
}) => (
}) =>
<Table>
<thead>
<tr>
Expand Down Expand Up @@ -46,7 +46,7 @@ const EvaluationTable = ({
}
return b.evaluation.evaluatedAt - a.evaluation.evaluatedAt;
})
.map(e => (
.map(e =>
<tr key={e.id}>
<td>
<AssignmentStatusIcon
Expand All @@ -55,35 +55,32 @@ const EvaluationTable = ({
accepted={false}
/>
</td>
{e.evaluation && (
{e.evaluation &&
<td>
<FormattedDate value={e.evaluation.evaluatedAt * 1000} />
&nbsp;
<FormattedTime value={e.evaluation.evaluatedAt * 1000} />
</td>
)}
{e.evaluation && (
</td>}
{e.evaluation &&
<td
className={classnames({
'text-danger': !e.evaluation.isCorrect,
'text-success': e.evaluation.isCorrect
'text-danger': !e.isCorrect,
'text-success': e.isCorrect
})}
>
<b>
<FormattedNumber style="percent" value={e.evaluation.score} />
</b>
</td>
)}
{!e.evaluation && (
</td>}
{!e.evaluation &&
<td colSpan="2">
<i>
<FormattedMessage
id="app.evaluationTable.notAvailable"
defaultMessage="Evaluation not available"
/>
</i>
</td>
)}
</td>}
<td className="text-right">
<Link
to={REFERENCE_SOLUTION_EVALUATION_URI_FACTORY(
Expand All @@ -100,21 +97,19 @@ const EvaluationTable = ({
</Link>
</td>
</tr>
))}
)}

{evaluations.length === 0 && (
{evaluations.length === 0 &&
<tr>
<td className="text-center" colSpan={3}>
<FormattedMessage
id="app.evaluationTable.empty"
defaultMessage="There are no evaluations in this list."
/>
</td>
</tr>
)}
</tr>}
</tbody>
</Table>
);
</Table>;

EvaluationTable.propTypes = {
evaluations: PropTypes.array.isRequired,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ReferenceSolutionEvaluationDetail extends Component {
exerciseId={exerciseId}
/>
<Row>
{referenceSolution.solution.files.map(file => (
{referenceSolution.solution.files.map(file =>
<Col lg={6} md={12} key={file.id}>
<a
href="#"
Expand All @@ -45,19 +45,21 @@ class ReferenceSolutionEvaluationDetail extends Component {
<SourceCodeInfoBox {...file} />
</a>
</Col>
))}
)}
</Row>
{solutionEvaluation.evaluation && (
{solutionEvaluation.evaluation &&
<CompilationLogs
initiationOutputs={
solutionEvaluation.evaluation.initiationOutputs
}
/>
)}
/>}
</Col>
{solutionEvaluation.evaluation && (
{solutionEvaluation.evaluation &&
<Col lg={6} sm={12}>
<EvaluationDetail evaluation={solutionEvaluation.evaluation} />
<EvaluationDetail
evaluation={solutionEvaluation.evaluation}
isCorrect={solutionEvaluation.isCorrect}
/>

<TestResults
evaluation={solutionEvaluation.evaluation}
Expand All @@ -71,8 +73,7 @@ class ReferenceSolutionEvaluationDetail extends Component {
</a>
</Col>
</Row>
</Col>
)}
</Col>}
</Row>

<SourceCodeViewerContainer
Expand Down
80 changes: 29 additions & 51 deletions src/components/Submissions/EvaluationDetail/EvaluationDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import BonusPoints from '../../Assignments/SubmissionsTable/BonusPoints';
const EvaluationDetail = ({
assignment: { firstDeadline, allowSecondDeadline, secondDeadline },
evaluation,
note = '',
isCorrect,
submittedAt,
maxPoints
}) => (
}) =>
<Box
title={
<FormattedMessage
Expand Down Expand Up @@ -56,40 +56,25 @@ const EvaluationDetail = ({
/>
</th>
<td className="text-center">
{submittedAt < firstDeadline ? (
<Icon name="check" className="text-success" />
) : (
<Icon name="times" className="text-danger" />
)}
{submittedAt < firstDeadline
? <Icon name="check" className="text-success" />
: <Icon name="times" className="text-danger" />}
</td>
</tr>

{submittedAt >= firstDeadline &&
allowSecondDeadline === true && (
<tr>
<th>
<FormattedMessage
id="app.evaluationDetail.beforeSecondDeadline"
defaultMessage="Was submitted before the second deadline:"
/>
</th>
<td className="text-center">
<MaybeSucceededIcon success={submittedAt < secondDeadline} />
</td>
</tr>
)}

<tr>
<th>
<FormattedMessage
id="app.evaluationDetail.isValid"
defaultMessage="Evaluation is valid:"
/>
</th>
<td className="text-center">
<MaybeSucceededIcon success={evaluation.isValid} />
</td>
</tr>
allowSecondDeadline === true &&
<tr>
<th>
<FormattedMessage
id="app.evaluationDetail.beforeSecondDeadline"
defaultMessage="Was submitted before the second deadline:"
/>
</th>
<td className="text-center">
<MaybeSucceededIcon success={submittedAt < secondDeadline} />
</td>
</tr>}

<tr>
<th>
Expand All @@ -113,8 +98,8 @@ const EvaluationDetail = ({
<td
className={classnames({
'text-center': true,
'text-danger': !evaluation.isCorrect,
'text-success': evaluation.isCorrect
'text-danger': !isCorrect,
'text-success': isCorrect
})}
>
<b>
Expand All @@ -132,17 +117,15 @@ const EvaluationDetail = ({
<td
className={classnames({
'text-center': true,
'text-danger':
!evaluation.isCorrect && evaluation.bonusPoints === 0,
'text-success':
evaluation.isCorrect && evaluation.bonusPoints === 0,
'text-danger': !isCorrect && evaluation.bonusPoints === 0,
'text-success': isCorrect && evaluation.bonusPoints === 0,
'text-bold': evaluation.bonusPoints === 0
})}
>
{evaluation.points}/{maxPoints}
</td>
</tr>
{evaluation.bonusPoints !== 0 && (
{evaluation.bonusPoints !== 0 &&
<tr>
<th>
<FormattedMessage
Expand All @@ -153,9 +136,8 @@ const EvaluationDetail = ({
<td className="text-center">
<BonusPoints bonus={evaluation.bonusPoints} />
</td>
</tr>
)}
{evaluation.bonusPoints !== 0 && (
</tr>}
{evaluation.bonusPoints !== 0 &&
<tr>
<th>
<FormattedMessage
Expand All @@ -167,31 +149,27 @@ const EvaluationDetail = ({
className={classnames({
'text-center': true,
'text-danger':
!evaluation.isCorrect ||
evaluation.points + evaluation.bonusPoints <= 0,
!isCorrect || evaluation.points + evaluation.bonusPoints <= 0,
'text-success':
evaluation.isCorrect &&
evaluation.points + evaluation.bonusPoints > 0
isCorrect && evaluation.points + evaluation.bonusPoints > 0
})}
>
<b>
{evaluation.points + evaluation.bonusPoints}/{maxPoints}
</b>
</td>
</tr>
)}
</tr>}
</tbody>
</Table>
</Box>
);
</Box>;

EvaluationDetail.propTypes = {
assignment: PropTypes.shape({
firstDeadline: PropTypes.number.isRequired,
allowSecondDeadline: PropTypes.bool.isRequired,
secondDeadline: PropTypes.number
}).isRequired,
note: PropTypes.string,
isCorrect: PropTypes.bool.isRequired,
submittedAt: PropTypes.number.isRequired,
evaluation: PropTypes.object,
maxPoints: PropTypes.number.isRequired
Expand Down
Loading

0 comments on commit 1cebb07

Please sign in to comment.