Skip to content

Commit

Permalink
fix: temporarily remove end exam button when viewing non exam content (
Browse files Browse the repository at this point in the history
…#33)

* fix: temporarily remove end exam button when viewing non exam content

* fix: use default prop to limit code impact
  • Loading branch information
zacharis278 authored Jul 2, 2021
1 parent 223547c commit ca6845b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/exam/Exam.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ const Exam = ({ isTimeLimited, children }) => {

const sequenceContent = <>{children}</>;

// Temporary fix for CR-3842. We need to show this timer but the end exam button does not
// fully work yet.
const allowEndExam = !!examId;

return (
<div className="d-flex flex-column justify-content-center">
{showTimer && (
Expand All @@ -58,6 +62,7 @@ const Exam = ({ isTimeLimited, children }) => {
expireExamAttempt={expireExam}
pollExamAttempt={pollAttempt}
pingAttempt={pingAttempt}
allowEndExam={allowEndExam}
/>
)}
{apiErrorMsg && <ExamAPIError />}
Expand Down
8 changes: 7 additions & 1 deletion src/timer/ExamTimerBlock.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
* Exam timer block component.
*/
const ExamTimerBlock = injectIntl(({
attempt, stopExamAttempt, expireExamAttempt, pollExamAttempt, intl, pingAttempt,
attempt, stopExamAttempt, expireExamAttempt, pollExamAttempt, intl, pingAttempt, allowEndExam,
}) => {
const [isShowMore, showMore, showLess] = useToggle(false);
const [alertVariant, setAlertVariant] = useState('info');
Expand Down Expand Up @@ -94,6 +94,7 @@ const ExamTimerBlock = injectIntl(({
>

{attempt.attempt_status !== ExamStatus.READY_TO_SUBMIT
&& allowEndExam
&& (
<Button className="mr-3" variant="outline-primary" onClick={stopExamAttempt}>
<FormattedMessage
Expand Down Expand Up @@ -123,6 +124,11 @@ ExamTimerBlock.propTypes = {
}),
stopExamAttempt: PropTypes.func.isRequired,
expireExamAttempt: PropTypes.func.isRequired,
allowEndExam: PropTypes.bool,
};

ExamTimerBlock.defaultProps = {
allowEndExam: true,
};

export default ExamTimerBlock;

0 comments on commit ca6845b

Please sign in to comment.