class Question{static parseQuestin(e){const t=e.questions.map((e=>{const t=[];if("R"===e.type||"C"===e.type)for(let s=1;s<=10;s++)e[`option${s}`]&&t.push({option:this.number2Letter(s),text:e[`option${s}`],isSelect:!1});return{questionId:e.questionId,subjectTitle:e.name,subjectOptions:t,required:"Y"===e.required,scoreEnabled:"Y"===e.scoreEnabled,score:e.score,type:e.type,typeText:"C"===e.type?"(多选) ":"",answerText:""}}));return{questionnaireId:e.questionnaireId,questionTitle:e.questionnaireTitle,subjectList:t}}static number2Letter(e){return e=Number(e)+64,String.fromCharCode(e)}static buildAnswerData(e){const t=[];for(let s=0;s<e.length;s++){const n=e[s];if("R"===n.type||"C"===n.type){const e=n.subjectOptions.filter((e=>e.isSelect));if(n.required&&0===e.length)return`请回答第${s+1}题`;t.push({questionId:n.questionId,answer:e.map((e=>e.option)).join("")})}if("Q"===n.type){const e=n.answerText;if(n.required&&""===e)return`请回答第${s+1}题`;t.push({questionId:n.questionId,answer:e})}}return t}}module.exports=Question;