Example #1
0
        public async Task SaveReportsToServer()
        {
            if (reports.Count == 0)
            {
                return;
            }

            var summary           = GetExaminationSummary();
            var reportInformation = new ExaminationReportsInformationModel
            {
                TimeUps             = summary.TimeUps,
                ExaminationReports  = reports.ToArray(),
                AllQuestions        = reports.Count(),
                CorrectAnswers      = summary.CorrectAnswers,
                FailedAnswers       = summary.IncorrectAnswers,
                AverageReactionTime = summary.AverageReactionTime,
                EndDate             = dateTimeService.GetCurrentServerDateTime(),
                InstanceId          = examinationRemoteSettings.InstanceId,
                UserInformation     = examinationInformation.User,
                AllAnswers          = summary.IncorrectAnswers + summary.CorrectAnswers,
                StartDate           = examinationInformation.State.StartTime,
                ExaminationId       = examinationInformation.State.CurrentExaminationId,
            };

            if (summary.AnsweredTestCasesCount != 0 || summary.TimeUps != 0)
            {
                await examinationHttpRequestService.SaveExaminationReportAsync(reportInformation);
            }

            reports.Clear();
        }