jichoi / lms_front star
박민혁 박민혁 08-23
240823 박민혁 퀴즈 등록 수정 로직 수정
@3f206aab471a7af6645fc38567b9e5843bb702fa
client/views/pages/teacher/QuestionDetail.vue
--- client/views/pages/teacher/QuestionDetail.vue
+++ client/views/pages/teacher/QuestionDetail.vue
@@ -291,13 +291,13 @@
             file_mng_id: '',
             prblmDetail: {
                 answers: {
-                    1: { text: '', isCorrect: 'N', fileMngId: null, fileInfo: '' },
+                    1: { text: '', isCorrect: 'Y', fileMngId: null, fileInfo: '' },
                     2: { text: '', isCorrect: 'N', fileMngId: null, fileInfo: '' },
                     3: { text: '', isCorrect: 'N', fileMngId: null, fileInfo: '' },
                     4: { text: '', isCorrect: 'N', fileMngId: null, fileInfo: '' },
                     5: { text: '', isCorrect: 'N', fileMngId: null, fileInfo: '' },
                 },
-                correctIndex: null, // 정답으로 선택된 답의 인덱스
+                correctIndex: 1, // 정답으로 선택된 답의 인덱스
             },
             books: [],
             units: [],
@@ -384,10 +384,6 @@
                     }
 
                     vm.prblmDetail.correctIndex = vm.problemDetail.findIndex(detail => detail.prblmYn === 'Y') + 1;
-
-                    if (vm.dataList.prblmTypeId === 'prblm_type_009') {
-                        vm.prblmDetail.answer1 = vm.problemDetail.find(detail => detail.prblmYn === 'Y') ? 'O' : 'X';
-                    }
                 }
 
                 if (vm.file_mng_id) {
@@ -455,7 +451,6 @@
                 console.log('성공:', response.data);
                 const problemDetails = await this.prepareProblemDetails();
                 await this.submitDetailForm(problemDetails);
-
                 alert('문제가 성공적으로 수정되었습니다.');
 
                 this.goToPage('QuestionList');
@@ -507,7 +502,8 @@
                 details.push({
                     prblmDtlId: answers[i].prblmDtlId,
                     prblmDtlExpln: answers[i].text || '',
-                    prblmYn: answers[i].isCorrect, // isCorrect가 'Y' 또는 'N'으로 설정됨
+                    prblmYn: this.selectedSearchOption2.prblm_type_cls === '서술형' || 
+                    this.selectedSearchOption2.prblm_type_cls === 'OX 문제' ? 'Y' : answers[i].isCorrect, // 서술형 및 OX 문제의 경우 항상 'Y'
                     fileMngId: answers[i].fileMngId,
                 });
             }
@@ -528,13 +524,13 @@
             this.prblmDetail = {
 
                 answers: {
-                    1: { text: '', isCorrect: 'N', fileMngId: null, fileInfo: '' },
+                    1: { text: '', isCorrect: 'Y', fileMngId: null, fileInfo: '' },
                     2: { text: '', isCorrect: 'N', fileMngId: null, fileInfo: '' },
                     3: { text: '', isCorrect: 'N', fileMngId: null, fileInfo: '' },
                     4: { text: '', isCorrect: 'N', fileMngId: null, fileInfo: '' },
                     5: { text: '', isCorrect: 'N', fileMngId: null, fileInfo: '' },
                 },
-                correctIndex: null,
+                correctIndex: 1,
             };
             this.selectedFiles = {};
         },
client/views/pages/teacher/QuestionInsert.vue
--- client/views/pages/teacher/QuestionInsert.vue
+++ client/views/pages/teacher/QuestionInsert.vue
@@ -345,7 +345,7 @@
                     4: { text: '', isCorrect: 'N', fileMngId: null },
                     5: { text: '', isCorrect: 'N', fileMngId: null },
                 },
-                correctIndex: null, // 정답으로 선택된 답의 인덱스
+                correctIndex: 1, // 정답으로 선택된 답의 인덱스
             },
         };
     },
@@ -492,7 +492,8 @@
                 details.push({
                     prblmId,
                     prblmDtlExpln: answers[i].text || '',
-                    prblmYn: answers[i].isCorrect, // isCorrect가 'Y' 또는 'N'으로 설정됨
+                    prblmYn: this.selectedSearchOption2.prblm_type_cls === '서술형' || 
+                    this.selectedSearchOption2.prblm_type_cls === 'OX 문제' ? 'Y' : answers[i].isCorrect, // 서술형 및 OX 문제의 경우 항상 'Y'
                     fileMngId: answers[i].fileMngId,
                 });
             }
@@ -512,13 +513,13 @@
             this.prblmDetail = {
 
                 answers: {
-                    1: { text: '', isCorrect: 'N', fileMngId: null },
+                    1: { text: '', isCorrect: 'Y', fileMngId: null },
                     2: { text: '', isCorrect: 'N', fileMngId: null },
                     3: { text: '', isCorrect: 'N', fileMngId: null },
                     4: { text: '', isCorrect: 'N', fileMngId: null },
                     5: { text: '', isCorrect: 'N', fileMngId: null },
                 },
-                correctIndex: null,
+                correctIndex: 1,
             };
             this.selectedFiles = {};
         },
Add a comment
List