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();
        }
        public async Task SaveReportAsync(ExaminationReportsInformationModel report)
        {
            try
            {
                var result = mapper.Map <ExaminationResult>(report);
                var agent  = mapper.Map <Agent>(report);

                await transactionService.CommitAsync(new[] { TransactionContextScope.Main }, async() =>
                {
                    result.AgentId = await GetOrAddAgent(agent);
                    await examinationResultsRepository.AddAsync(result);
                    await SaveExaminationQuestionResults(result.Id, report.ExaminationReports);
                });
            }
            catch (Exception ex)
            {
                logger.LogError("Error occured while saving examination report from pebbles", ex);
            }
        }
Example #3
0
 public async Task SaveExaminationReportAsync(ExaminationReportsInformationModel reportInformation)
 {
     var url = $"{examinationRemoteSettings.CentralInstanceConnectionString}{ExaminationRequestsConstants.SaveExaminationReports}";
     await httpSenderService.Post(reportInformation, url);
 }
 public async Task SavePebblesExaminationReports([FromBody] ExaminationReportsInformationModel report)
 => await examinationIntegrationService.SaveReportAsync(report);