From 9ea05a51e8dd05596458169720394a7db0524254 Mon Sep 17 00:00:00 2001 From: Petr Stefan Date: Thu, 26 Oct 2017 17:08:03 +0200 Subject: [PATCH 1/4] Evaluation detail props reorganization --- .../EvaluationDetail/EvaluationDetail.js | 23 ++----- .../ReferenceSolutionEvaluationDetail.js | 19 +++--- .../EvaluationDetail/EvaluationDetail.js | 68 +++++++------------ .../SubmissionDetail/SubmissionDetail.js | 31 ++++----- 4 files changed, 55 insertions(+), 86 deletions(-) diff --git a/src/components/ReferenceSolutions/EvaluationDetail/EvaluationDetail.js b/src/components/ReferenceSolutions/EvaluationDetail/EvaluationDetail.js index a6d03e145..2d7cba726 100644 --- a/src/components/ReferenceSolutions/EvaluationDetail/EvaluationDetail.js +++ b/src/components/ReferenceSolutions/EvaluationDetail/EvaluationDetail.js @@ -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 }) => ( - - - - - - - - - ( @@ -85,12 +73,11 @@ const EvaluationDetail = ({ evaluation, note = '' }) => ( - -); + ; EvaluationDetail.propTypes = { evaluation: PropTypes.object.isRequired, - note: PropTypes.string + isCorrect: PropTypes.bool.isRequired }; export default EvaluationDetail; diff --git a/src/components/ReferenceSolutions/ReferenceSolutionEvaluationDetail/ReferenceSolutionEvaluationDetail.js b/src/components/ReferenceSolutions/ReferenceSolutionEvaluationDetail/ReferenceSolutionEvaluationDetail.js index 7827949e7..effa86b60 100644 --- a/src/components/ReferenceSolutions/ReferenceSolutionEvaluationDetail/ReferenceSolutionEvaluationDetail.js +++ b/src/components/ReferenceSolutions/ReferenceSolutionEvaluationDetail/ReferenceSolutionEvaluationDetail.js @@ -33,7 +33,7 @@ class ReferenceSolutionEvaluationDetail extends Component { exerciseId={exerciseId} /> - {referenceSolution.solution.files.map(file => ( + {referenceSolution.solution.files.map(file => - ))} + )} - {solutionEvaluation.evaluation && ( + {solutionEvaluation.evaluation && - )} + />} - {solutionEvaluation.evaluation && ( + {solutionEvaluation.evaluation && - + - - )} + } ( +}) => - {submittedAt < firstDeadline ? ( - - ) : ( - - )} + {submittedAt < firstDeadline + ? + : } {submittedAt >= firstDeadline && - allowSecondDeadline === true && ( - - - - - - - - - )} - - - - - - - - - + allowSecondDeadline === true && + + + + + + + + } @@ -113,8 +98,8 @@ const EvaluationDetail = ({ @@ -142,7 +127,7 @@ const EvaluationDetail = ({ {evaluation.points}/{maxPoints} - {evaluation.bonusPoints !== 0 && ( + {evaluation.bonusPoints !== 0 && - - )} - {evaluation.bonusPoints !== 0 && ( + } + {evaluation.bonusPoints !== 0 && - - )} + } - -); + ; EvaluationDetail.propTypes = { assignment: PropTypes.shape({ @@ -191,7 +173,7 @@ EvaluationDetail.propTypes = { 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 diff --git a/src/components/Submissions/SubmissionDetail/SubmissionDetail.js b/src/components/Submissions/SubmissionDetail/SubmissionDetail.js index c6335b5e5..ea01ac235 100644 --- a/src/components/Submissions/SubmissionDetail/SubmissionDetail.js +++ b/src/components/Submissions/SubmissionDetail/SubmissionDetail.js @@ -32,7 +32,8 @@ class SubmissionDetail extends Component { evaluation, accepted, originalSubmissionId, - runtimeEnvironmentId + runtimeEnvironmentId, + isCorrect }, assignment, isSupervisor @@ -54,7 +55,7 @@ class SubmissionDetail extends Component { assignmentId={assignment.id} /> - {files.map(file => ( + {files.map(file => - ))} + )} - {evaluation && ( + {evaluation && - )} + />} - {evaluation && ( + {evaluation && - {isSupervisor && ( + {isSupervisor && - )} + />} - {isSupervisor && ( + {isSupervisor && - - )} - - )} + } + } Date: Thu, 26 Oct 2017 17:48:44 +0200 Subject: [PATCH 2/4] Display points threshold on assignment page --- .../AssignmentDetails/AssignmentDetails.js | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/components/Assignments/Assignment/AssignmentDetails/AssignmentDetails.js b/src/components/Assignments/Assignment/AssignmentDetails/AssignmentDetails.js index bcd0e3b85..73ede757a 100644 --- a/src/components/Assignments/Assignment/AssignmentDetails/AssignmentDetails.js +++ b/src/components/Assignments/Assignment/AssignmentDetails/AssignmentDetails.js @@ -26,7 +26,8 @@ const AssignmentDetails = ({ isAfterSecondDeadline, isBonus, runtimeEnvironments, - canSubmit + canSubmit, + pointsPercentualThreshold }) => } + + + + + + + + + {pointsPercentualThreshold * 100} % + + @@ -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; From ddcd3a5ff39c8f9286c78b2bea8ca8268644f070 Mon Sep 17 00:00:00 2001 From: Martin Polanka Date: Fri, 27 Oct 2017 08:51:54 +0200 Subject: [PATCH 3/4] isCorrect fixes --- .../Submissions/EvaluationDetail/EvaluationDetail.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/components/Submissions/EvaluationDetail/EvaluationDetail.js b/src/components/Submissions/EvaluationDetail/EvaluationDetail.js index 45c9234ad..cff6fb46c 100644 --- a/src/components/Submissions/EvaluationDetail/EvaluationDetail.js +++ b/src/components/Submissions/EvaluationDetail/EvaluationDetail.js @@ -117,10 +117,8 @@ const EvaluationDetail = ({ @@ -151,11 +149,9 @@ 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 })} > From 27f99e0366530d72cd6ffeedb1f22351cdd26c53 Mon Sep 17 00:00:00 2001 From: Martin Polanka Date: Fri, 27 Oct 2017 09:04:35 +0200 Subject: [PATCH 4/4] Another isCorrect correction --- .../EvaluationTable/EvaluationTable.js | 33 ++++++++----------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/src/components/ReferenceSolutions/EvaluationTable/EvaluationTable.js b/src/components/ReferenceSolutions/EvaluationTable/EvaluationTable.js index 646b6dccf..f0f58e6c5 100644 --- a/src/components/ReferenceSolutions/EvaluationTable/EvaluationTable.js +++ b/src/components/ReferenceSolutions/EvaluationTable/EvaluationTable.js @@ -18,7 +18,7 @@ const EvaluationTable = ({ referenceSolutionId, exerciseId, links: { REFERENCE_SOLUTION_EVALUATION_URI_FACTORY } -}) => ( +}) => @@ -46,7 +46,7 @@ const EvaluationTable = ({ } return b.evaluation.evaluatedAt - a.evaluation.evaluatedAt; }) - .map(e => ( + .map(e => - {e.evaluation && ( + {e.evaluation && - )} - {e.evaluation && ( + } + {e.evaluation && - )} - {!e.evaluation && ( + } + {!e.evaluation && - )} + } - ))} + )} - {evaluations.length === 0 && ( + {evaluations.length === 0 && - - )} + } -
  - - -
-); + ; EvaluationTable.propTypes = { evaluations: PropTypes.array.isRequired,