public async Task <QuestionReportDto> GetQuestionReportAsync(PracticeTypeDto model) { List <AnswerRecord> anwserRecordList = await GetAnswerRecordListAsync(model); List <int> questionIdList = anwserRecordList.Where(o => o.AnswerStatus == AnswerStatus.Correct) .Select(o => o.QuestionId).ToList(); QuestionReportDto dto = new QuestionReportDto { ErrorCount = anwserRecordList.Count(o => o.AnswerStatus == AnswerStatus.Error), CurrectCount = anwserRecordList.Count(o => o.AnswerStatus == AnswerStatus.Correct), IgnoreCount = anwserRecordList.Count(o => o.AnswerStatus == AnswerStatus.Ignore) }; if (questionIdList.Any()) { dto.Marks = _Db.Questions.Where(o => questionIdList.Contains(o.Id)).Select(o => o.Mark).DefaultIfEmpty().Sum(); } return(dto); }
private QuestionReportDto ReadQuestionReport(IDataReader reader, ref bool alreadyRead) { QuestionReportDto retval = null; string temp = GetString(reader, 0); int elementId = 0; Int32.TryParse(temp, out elementId); string elementText = GetString(reader, 1); temp = reader.GetString(2); PageElementType pageElementType = Common.Migration.Convert(temp); string pwLabel = GetString(reader, 3); retval = new QuestionReportDto(elementId, elementText, pageElementType, pwLabel); return retval; }
public ReportRowDto(BaseDataReportDto baseData, CustomerAnswerReportDto[] dynamicQuestions, ShippingAddressReportDto shippingAddress, QuestionReportDto[] questions) { DynamicQuestions = dynamicQuestions; _shippingAddress = shippingAddress; BaseData = baseData; Questions = questions; }