Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Commit

Permalink
fix selection box course bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ALBERICLOOS committed May 23, 2024
1 parent 28d37c1 commit ac31aa5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions frontend/src/components/ProjectTeacherComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,10 @@ export function ProjectTeacherComponent(props: {
updateTitle?: (name: string) => void,
is_new?: boolean,
}): JSX.Element {
const course_options = props.project.all_courses.filter(course => !course.course_archived).map(course => course.course_name);

const navigate = useNavigate();
const {t} = useTranslation();
const [projectName, setProjectName] = useState<string>(props.project.projectName)
const [courseName, setCourseName] = useState<string>(course_options[0])
const [courseName, setCourseName] = useState<string>(props.project.courseName)
const [hours, setHours] = useState<number>(props.project.hours);
const [minutes, setMinutes] = useState<number>(props.project.minutes);
const [deadline, setDeadline] = useState<string>(props.project.deadline);
Expand Down Expand Up @@ -81,7 +79,7 @@ export function ProjectTeacherComponent(props: {
_.isEqual(dockerString, initialValues.value10) &&
_.isEqual(visible, initialValues.value11) &&
_.isEqual(archived, initialValues.value12);
_.isEqual(groups, initialValues.value13);
_.isEqual(groups, initialValues.value13);
const second_part_1 = deadline;
const second_part_2 = initialValues.value5;
const second_part = _.isEqual(second_part_1, second_part_2);
Expand All @@ -97,6 +95,7 @@ export function ProjectTeacherComponent(props: {
}
};

const course_options = props.project.all_courses.filter(course => !course.course_archived).map(course => course.course_name);

const hours_array = Array.from({length: 24}, (_, index) => index.toString());
const minutes_array = Array.from({length: 60}, (_, index) => index.toString());
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/teacher/CreateProject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function CreateProject(): JSX.Element {

const emptyProjectTeacher: ProjectTeacher = {
projectId: -1,
courseName: data.courses[0].course_name,
courseName: data.courses.filter(course => !course.course_archived)[0].course_name,
all_courses: data.courses,
deadline: (new Date(Date.now())).toISOString(),
description: "",
Expand Down

0 comments on commit ac31aa5

Please sign in to comment.