/// <summary> /// Phương thức kiểm tra xem dã đầy đủ câu trả lời chưa, nếu chưa trả về lỗi, còn không bỏ trống /// </summary> public string IsFullAnswers() { if (!Config.IsCheckFullTestPaper) { return(string.Empty); } if (!ListeningTestPaper.IsPaperFullSelection()) { return("You have not yet answered all the questions of the Listening test"); } if (!ReadingTestPaper.IsPaperFullSelection()) { return("You have not yet answered all the questions of the Reading test"); } if (!WritingTestPaper.IsPaperFullSelection()) { return("You have not written the Writing Part 2 section"); } if (string.IsNullOrEmpty(WritingTestPaper.WritingPartTwos.UserParagraph)) { return("You have not yet answered all the questions of the Writing test"); } // Đã đầy đủ thì trả về rỗng return(string.Empty); }
public void ScoreCalculate(GeneralTestPaper resultPaper) { // Tính điểm cho Listening ListeningTestPaper.ScoreCalculate(resultPaper.ListeningTestPaper); // Tính điểm cho READING ReadingTestPaper.ScoresCalculate(resultPaper.ReadingTestPaper); // Tính điểm cho Writin Part 1 WritingTestPaper.ScoreCalculate(resultPaper.WritingTestPaper); // Điểm tổng phải là -1 kèm WRITING PART 2 và SPEAKING WritingTestPaper.WritingPartTwos.Scores = -1; SpeakingTestPaper.SpeakingPart.Scores = -1; }
public float ScoreCalculate(WritingTestPaper resultPaper) { if (WritingPartOnes.WritingPart != null && WritingPartOnes.WritingPart.Count > 0 && resultPaper.WritingPartOnes.WritingPart != null && WritingPartOnes.WritingPart.Count == resultPaper.WritingPartOnes.WritingPart.Count) { // Tính số câu đúng int count = 0; for (int i = 0; i < WritingPartOnes.WritingPart.Count; i++) { try { // Lấy câu trả lời mà học viên đã nhập vào string answerInputed = WritingPartOnes.WritingPart[i].Answers; // Nếu câu trả lời khớp với bất kỳ đáp án nào, tiến hành cho điểm if (resultPaper.WritingPartOnes .WritingPart[i] .BaseAnswers .Any(x => x.AnswerContent != null && x.AnswerContent.ToLower().Trim() == answerInputed.ToLower().Trim())) { count++; } } catch (Exception) { // Bỏ qua } } // Tính điểm luôn cho part 1 WritingPartOnes.Scores = ScoresUtils.ScoresCalculate(count, TotalQuestions(), Config.SCORES_FULL_WRITING_PART_1); return(WritingPartOnes.Scores); } else { return(-1); } }
public float ScoreCalculate(string readingTestPaperJson) { WritingTestPaper paper = JsonConvert.DeserializeObject <WritingTestPaper>(readingTestPaperJson); return(ScoreCalculate(paper)); }