Answer Sheet Changes

main
Pedram Keshavarzi 3 years ago
parent 38e7771575
commit 37efa111ea
  1. 8
      src/components/AnswerSheet/index.js
  2. 4
      src/components/selectedCourse/index.js
  3. 15
      src/view/addExam/views/addQuestions.js

@ -6,7 +6,7 @@ const AnswerSheet = ({questionsQuantity, optionsQuantity }) => {
useEffect(() => {
let array = [];
let optionsArray = [];
for(var i =1; i <= questionsQuantity; i++){
for(var i =1; i <= questionsQuantity; i++){
array.push({
questionId : i,
answer: null,
@ -21,7 +21,7 @@ const AnswerSheet = ({questionsQuantity, optionsQuantity }) => {
setOptions(optionsArray);
setData(array)
console.log(data, options)
}, [])
}, [questionsQuantity])
return(
<div className="w-full flex flex-col border border-gray-200 rounded-xl bg-white">
@ -44,7 +44,9 @@ const AnswerSheet = ({questionsQuantity, optionsQuantity }) => {
setData(newArray)
console.log(data)
}} />
}} >
</p>
)

@ -1,6 +1,6 @@
import React from "react";
const SelectedCourse = ({ openAnswerSheet, title, questionQuantity, coefficient, optionsQuantity }) => {
const SelectedCourse = ({ onClick, title, questionQuantity, coefficient, optionsQuantity }) => {
return (
<div className="w-full border border-gray-400 rounded-xl bg-white flex items-center justify-between px-6 py-8 mt-8">
<div className="flex flex-col w-full">
@ -32,7 +32,7 @@ const SelectedCourse = ({ openAnswerSheet, title, questionQuantity, coefficient,
</textarea>
</div>
<h1 className="w-40 text-center text-lg text-blue3A font-bold cursor-pointer" onClick={openAnswerSheet}>
<h1 className="w-40 text-center text-lg text-blue3A font-bold cursor-pointer" onClick={onClick}>
پاسخ برگ
</h1>
</div>

@ -15,7 +15,15 @@ const AddQuestions = ({ grades, addExamState, dispatch, stepClick, backStep }) =
const [questionarePopUp, setQuestionairePopUp] = useState(false);
const [showCoursesInList, setShowCoursesInList] = useState([]);
const [choosedQuestionaries, seChoosedQuestionaries] = useState([]);
const [selectedQuestionare, setSelectedQuestionare] = useState(null)
const [selectedQuestionare, setSelectedQuestionare] = useState(null);
const [selectedCourse, setSelectedCourse] = useState({
sortId: 1,
title: 'ادبیات فارسی',
coefficient: 3,
questionStart: 1,
questionEnd: 0,
})
console.log(choosedQuestionaries)
useEffect(() => {
@ -235,7 +243,8 @@ const AddQuestions = ({ grades, addExamState, dispatch, stepClick, backStep }) =
{
selectedQuestionare?.courses.map(
(item) => (
<SelectedCourse title={item.title} coefficient={item.coefficient} questionQuantity={item.questionEnd - item.questionStart + 1}/>
<SelectedCourse title={item.title} coefficient={item.coefficient} questionQuantity={item.questionEnd - item.questionStart + 1}
onClick={() => {setSelectedCourse(item); console.log(selectedCourse)}}/>
)
)
}
@ -246,7 +255,7 @@ const AddQuestions = ({ grades, addExamState, dispatch, stepClick, backStep }) =
</div>
<div className="w-1/2 flex justify-center">
<div className="w-4/5 py-8">
<AnswerSheet questionsQuantity={30} optionsQuantity={4}/>
<AnswerSheet questionsQuantity={selectedCourse.questionEnd - selectedCourse.questionStart + 1} optionsQuantity={4}/>
</div>
</div>

Loading…
Cancel
Save