Skip to content

Commit

Permalink
Merge pull request #460 from Aar-if/eighty
Browse files Browse the repository at this point in the history
Issue #000 Bug:  Course Planner Fixes and improvements
  • Loading branch information
itsvick authored Nov 28, 2024
2 parents b469621 + bd4407b commit c7f821a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
5 changes: 5 additions & 0 deletions app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ export const RequisiteType = {
POST_REQUISITES: 'postrequisite',
FACILITATOR_REQUISITE: 'facilitator-requisite',
};

export const COURSE_TYPE = {
FOUNDATION_COURSE: 'Foundation Course',
};

export const entityList = {
TEAM_LEADER: ['center', 'facilitator', 'learner'],
TEACHER: ['center','learner' ],
Expand Down
13 changes: 7 additions & 6 deletions src/pages/course-planner/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { useTranslation } from 'next-i18next';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import { useRouter } from 'next/router';
import React, { useEffect, useState } from 'react';
import { accessControl, frameworkId } from '../../../app.config';
import { accessControl, COURSE_TYPE, frameworkId } from '../../../app.config';
import { useDirection } from '../../hooks/useDirection';
import { types } from 'node:util';
import axios from 'axios';
Expand Down Expand Up @@ -468,6 +468,7 @@ const CoursePlanner = () => {

addQueryParams({ center: cohortId });
setSelectedValue(cohortId);
setType(tStore.type || COURSE_TYPE.FOUNDATION_COURSE);
}
}, [store.cohorts]);

Expand Down Expand Up @@ -562,14 +563,14 @@ const CoursePlanner = () => {
}
};
fetchTaxonomyResults();
}, [value, typeOptions]);
}, [value, typeOptions, selectedValue]);

const handleChange = (event: SelectChangeEvent<string>) => {
const newValue = event.target.value as string;
if (newValue !== value) {
setValue(newValue);
setType(newValue);
}

setValue(newValue);
setType(newValue);

const windowUrl = window.location.pathname;
const cleanedUrl = windowUrl.replace(/^\//, '');
const env = cleanedUrl.split('/')[0];
Expand Down

0 comments on commit c7f821a

Please sign in to comment.