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

parent 24ca3f55
......@@ -171,8 +171,7 @@ export async function updateSurvey(param: {
} else {
let semester = await getCurrentSemester();
// 若是更新开始时间,则通过模板创建试卷
let tempId = survey.data.id;
let insertData = await insertSurveyInfo(semester.id, surveyName, startTime, endTime, isOpen, description, 2, tempId);
let insertData = await insertSurveyInfo(semester.id, surveyName, startTime, endTime, isOpen, description, 2, surveyId);
let survey_id = (insertData as any).data.id;
await insertSurveyDetail(survey_id, questions);
}
......
......@@ -519,7 +519,6 @@ export async function surveyTeacher(studentId: string, surveyId: number, answers
/**遍历答案并保存 */
for (let answerItem of answers) {
for (let key in answerItem) {
let questionId = parseInt(key);
let rawValue = (answerItem as any)[key];
// 解析答案值(JSON字符串)
......@@ -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) {
continue; // 题目不存在则跳过
}
......@@ -540,7 +539,7 @@ export async function surveyTeacher(studentId: string, surveyId: number, answers
// 根据题目类型保存答案
let answerData: any = {
submission_id: submissionId,
question_id: questionId
question_id: question.data.id
};
if (questionType === 'text') {
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