Skip to content

Commit

Permalink
Issue #PS-2233 bug: Topic/Subtopic is not getting removed upon edit s…
Browse files Browse the repository at this point in the history
…ubject of event- fix
  • Loading branch information
suvarnakale committed Nov 27, 2024
1 parent 6f25b8d commit a385746
Showing 1 changed file with 23 additions and 16 deletions.
39 changes: 23 additions & 16 deletions src/components/SessionCardFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,21 @@ const SessionCardFooter: React.FC<SessionCardFooterProps> = ({
const response = await fetchTargetedSolutions();

if (response?.result?.data == '') {
setTopicList([]);
return;
}

let courseData = response?.result?.data[0];
let courseId = courseData._id;

if (!courseId) {
courseId = await fetchCourseIdFromSolution(courseData?.solutionId, cohortId as string);
courseId = await fetchCourseIdFromSolution(
courseData?.solutionId,
cohortId as string
);
courseData = response?.result?.data[0];
}

const res = await getUserProjectDetails({
id: courseId,
});
Expand Down Expand Up @@ -131,18 +135,17 @@ const SessionCardFooter: React.FC<SessionCardFooterProps> = ({
};

const fetchTargetedSolutions = async () => {
const response = await getTargetedSolutions({
state: state,
medium: medium,
class: grade,
board: board,
type: item?.metadata?.courseType,
subject: item?.metadata?.subject,
entityId: cohortId,
});
return response;

}
const response = await getTargetedSolutions({
state: state,
medium: medium,
class: grade,
board: board,
type: item?.metadata?.courseType,
subject: item?.metadata?.subject,
entityId: cohortId,
});
return response;
};

const handleTopicSelection = (topic: string) => {
setSelectedTopic(topic);
Expand Down Expand Up @@ -244,7 +247,11 @@ const SessionCardFooter: React.FC<SessionCardFooterProps> = ({

const handleClick = () => {
handleComponentOpen();
if (topicList && transformedTasks && eventStatus === EventStatus.UPCOMING) {
if (
topicList.length >= 1 &&
transformedTasks &&
eventStatus === EventStatus.UPCOMING
) {
handleOpen();
} else {
handleError();
Expand Down

0 comments on commit a385746

Please sign in to comment.