学生端-导师测评问题修复

parent 24ca3f55
...@@ -171,8 +171,7 @@ export async function updateSurvey(param: { ...@@ -171,8 +171,7 @@ export async function updateSurvey(param: {
} else { } else {
let semester = await getCurrentSemester(); let semester = await getCurrentSemester();
// 若是更新开始时间,则通过模板创建试卷 // 若是更新开始时间,则通过模板创建试卷
let tempId = survey.data.id; let insertData = await insertSurveyInfo(semester.id, surveyName, startTime, endTime, isOpen, description, 2, surveyId);
let insertData = await insertSurveyInfo(semester.id, surveyName, startTime, endTime, isOpen, description, 2, tempId);
let survey_id = (insertData as any).data.id; let survey_id = (insertData as any).data.id;
await insertSurveyDetail(survey_id, questions); await insertSurveyDetail(survey_id, questions);
} }
......
...@@ -519,7 +519,6 @@ export async function surveyTeacher(studentId: string, surveyId: number, answers ...@@ -519,7 +519,6 @@ export async function surveyTeacher(studentId: string, surveyId: number, answers
/**遍历答案并保存 */ /**遍历答案并保存 */
for (let answerItem of answers) { for (let answerItem of answers) {
for (let key in answerItem) { for (let key in answerItem) {
let questionId = parseInt(key);
let rawValue = (answerItem as any)[key]; let rawValue = (answerItem as any)[key];
// 解析答案值(JSON字符串) // 解析答案值(JSON字符串)
...@@ -531,7 +530,7 @@ export async function surveyTeacher(studentId: string, surveyId: number, answers ...@@ -531,7 +530,7 @@ export async function surveyTeacher(studentId: string, surveyId: number, answers
} }
// 查题目类型 // 查题目类型
let question = await selectOneDataByParam(TABLENAME.测评题目表, { id: questionId }); let question = await selectOneDataByParam(TABLENAME.测评题目表, { survey_id: surveyId, question_code: key });
if (!question.data || !(question.data as any).id) { if (!question.data || !(question.data as any).id) {
continue; // 题目不存在则跳过 continue; // 题目不存在则跳过
} }
...@@ -540,7 +539,7 @@ export async function surveyTeacher(studentId: string, surveyId: number, answers ...@@ -540,7 +539,7 @@ export async function surveyTeacher(studentId: string, surveyId: number, answers
// 根据题目类型保存答案 // 根据题目类型保存答案
let answerData: any = { let answerData: any = {
submission_id: submissionId, submission_id: submissionId,
question_id: questionId question_id: question.data.id
}; };
if (questionType === 'text') { if (questionType === 'text') {
answerData.answer_text = typeof parsedValue === 'string' ? parsedValue : JSON.stringify(parsedValue); answerData.answer_text = typeof parsedValue === 'string' ? parsedValue : JSON.stringify(parsedValue);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment