From 3f4582870e18b5056786fdad9ab10c89f8c91b01 Mon Sep 17 00:00:00 2001 From: aparriaran Date: Fri, 15 Nov 2024 11:11:28 -0600 Subject: [PATCH] Fixed the cannot read properties of null (reading assessment_task_id) error --- .../CompleteAssessmentTask/CompleteAssessmentTask.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/FrontEndReact/src/View/Admin/View/CompleteAssessmentTask/CompleteAssessmentTask.js b/FrontEndReact/src/View/Admin/View/CompleteAssessmentTask/CompleteAssessmentTask.js index 9a7ef972f..991c3ce07 100644 --- a/FrontEndReact/src/View/Admin/View/CompleteAssessmentTask/CompleteAssessmentTask.js +++ b/FrontEndReact/src/View/Admin/View/CompleteAssessmentTask/CompleteAssessmentTask.js @@ -59,14 +59,18 @@ class CompleteAssessmentTask extends Component { this.handleDone = () => { var navbar = this.props.navbar; - let chosenAssessmentTask; + let chosenAssessmentTask = null; - if (navbar.state.chosenCompleteAssessmentTask !== null) { + if (navbar.state.chosenCompleteAssessmentTask && navbar.state.chosenCompleteAssessmentTask.assessment_task_id) { chosenAssessmentTask = navbar.state.chosenCompleteAssessmentTask; - } else { + } else if(navbar.state.chosenAssessmentTask && navbar.state.chosenAssessmentTask.assessment_task_id) { chosenAssessmentTask = navbar.state.chosenAssessmentTask; } + if(!chosenAssessmentTask) { + return; + } + genericResourceGET( `/completed_assessment?assessment_task_id=${chosenAssessmentTask["assessment_task_id"]}&unit=${this.state.unitOfAssessment ? "team" : "individual"}`, "completed_assessments", this, {dest: "completedAssessments"}