Skip to content

Commit

Permalink
add back topic in create question
Browse files Browse the repository at this point in the history
  • Loading branch information
ernestjx committed Aug 9, 2024
1 parent 9d880dd commit 59d0f18
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions app/(main)/questions/edit/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,23 +142,27 @@ const EditQuestion = () => {
throw "No answer selected"
console.log(answer)
//populate skills for mcq
let selectedTopics: number[] = [];
let selectedSkills: number[] = [];
if(selectedTopicNodes){
Object.entries(selectedTopicNodes).forEach(([key, data]) => {
console.log("key", key, "data", data);
let topic_skill = key.split("-");
if(topic_skill.length>1){
selectedSkills.push(parseInt(topic_skill[1]));
selectedSkills.push(parseInt(topic_skill[1]));
} else {
selectedTopics.push(parseInt(topic_skill[0]));
}
});
}
//instantiate MCQ object before adding
let mcq = {
stem: stem,
options: addedOptions,
// topics: null,
topics: selectedTopics,
skills: selectedSkills,
// isAnswer: answer[0].no,
status: "Draft",
// status: "Draft",

}
console.log("mcq to be created ", mcq);
Expand Down
4 changes: 2 additions & 2 deletions app/(main)/questions/searchlist/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ const QuestioSearchList = () => {
const itemTemplate = (rowData: Questions.MCQ) => {

const topics = rowData.topics.map((topic) =>
<Tag severity="info" value={topic.name} key={topic.id}></Tag>
<Tag style={{marginRight:'1em'}} severity="info" value={topic.name} key={topic.id}></Tag>
)
const skills = rowData.skills.map((skills) =>
<Tag value={skills.name} key={skills.id}></Tag>
<Tag style={{marginRight:'1em'}}value={skills.name} key={skills.id}></Tag>
)
return (
<div className='card mb-1'>
Expand Down

0 comments on commit 59d0f18

Please sign in to comment.