// NOTE: status of exam router -> 0 No Action(ยังไม่มีการกระทำใดๆ ทั้งสิ้น) It's First state / 1 Success(ทำข้อสอบสำเร็จ) / -1 Unsuccess(ทำข้อสอบไม่ผ่าน) / 2 Skip(ข้ามกระบวนการ) / -2 no authorize exam because exam before not pass(ไม่มีสิทธิ์ทำข้อสอบเนื่องจากทำข้อสอบชุดก่อนไม่ผ่าน) // 3 waiting for checking score // 10 Approve for Exam(ทำการยืนยันให้ทำข้อสอบ) // -10 Wait for approve examination(รอการอนุมัติการทำข้อสอบ) class ExamRouter{ constructor(){ this.examrouter = [] } setExamRouter(obj){ this.examrouter = obj } addExamRouter(obj){ this.examrouter.push({ id: obj.examid, flow: 1, examdata: obj.examdata, question: obj.question, status: 0, skipby: '', step: 2, swlangcode: 'SW012940' }) } removeExamRouter(index){ this.examrouter.splice(index, 1) } changePositionList(index, inc){ let tmpfirst = this.examrouter[index], tmpsecond = this.examrouter[index+inc] if (tmpfirst.flow === 2){ tmpfirst.flow = '' } if (tmpsecond.flow === 2){ tmpsecond.flow = '' } this.examrouter[index] = tmpsecond this.examrouter[index+inc] = tmpfirst } getExamRouter(){ return this.examrouter } getAutoCheckingByIndex(index){ return this.examrouter[index].examdata.autochecking } getResultAutoChecking(index){ let result = false if (this.examrouter[index].examdata.autochecking && this.examrouter[index].examdata.evaluate.isevaluate){ result = true } return result } countExamRouter(){ return this.examrouter.length } }