diff --git a/client/src/App.js b/client/src/App.js
index 4b4b0d3..8659bb8 100644
--- a/client/src/App.js
+++ b/client/src/App.js
@@ -14,7 +14,7 @@ import "react-toastify/dist/ReactToastify.css";
import CourseTable from "./Pages/CourseTable";
import GenerateCSV from "./Pages/GenerateCSV";
import ConsolidatedTable from "./Pages/ConsolidatedTable";
-import CourseConsolidated from "./Pages/courseConsolidated";
+import CourseConsolidated from "./Pages/CourseConsolidated";
function App() {
return (
diff --git a/client/src/Pages/CourseForm.jsx b/client/src/Pages/CourseForm.jsx
index b1f5a60..1b8aa2b 100644
--- a/client/src/Pages/CourseForm.jsx
+++ b/client/src/Pages/CourseForm.jsx
@@ -1,6 +1,6 @@
import React, { useState, useEffect } from "react";
import { useLocation, useParams, useNavigate } from "react-router-dom";
-import { fetchFaculties, saveAppointment, updateCourseStatus } from "../api";
+import { fetchFaculties, saveAppointment } from "../api";
import "./CourseForm.css";
import "./Navbar.jsx";
import Navbar from "./Navbar.jsx";
@@ -9,7 +9,7 @@ const CourseForm = () => {
const { id } = useParams();
const location = useLocation();
const navigate = useNavigate();
- const { course } = location.state || {};
+ const { course, academicYear } = location.state || {};
const [options, setOptions] = useState({ faculties: [] });
const [suggestions, setSuggestions] = useState({});
@@ -32,7 +32,7 @@ const CourseForm = () => {
});
const [examPeriod, setExamPeriod] = useState({
- year: "",
+ year: academicYear || "",
startMonth: "",
endMonth: "",
});
@@ -110,6 +110,7 @@ const CourseForm = () => {
if (validateForm()) {
try {
const groupedTasks = {};
+ const academicYear = course?.academicYear || examPeriod.year;
Object.entries(tempAssignments).forEach(([field, facultyList]) => {
facultyList.forEach((faculty) => {
const assignedFaculty = options.faculties.find(
@@ -121,7 +122,8 @@ const CourseForm = () => {
facultyId: assignedFaculty.facultyId,
courseId: course?.courseId || id,
tasks: [],
- examPeriod: `${examPeriod.year} (${examPeriod.startMonth} - ${examPeriod.endMonth})`,
+ examPeriod: `${examPeriod.startMonth} - ${examPeriod.endMonth}`,
+ academicYear,
};
}
groupedTasks[assignedFaculty.facultyId].tasks.push(field);
@@ -131,14 +133,14 @@ const CourseForm = () => {
const payload = Object.values(groupedTasks);
await saveAppointment(payload);
- await updateCourseStatus(course?.courseId || id);
+ // await updateCourseStatus(course?.courseId || id);
const filteredCourses =
JSON.parse(localStorage.getItem("filteredCourses")) || [];
navigate("/courses", {
state: {
courses: filteredCourses,
- updatedCourse: { ...course, status: "Submitted" },
+ academicYear: academicYear,
},
});
} catch (error) {
@@ -169,16 +171,12 @@ const CourseForm = () => {
-
+ readOnly
+ />