private void AddEmbeddedDataInformation(OutcomeViewModel model, SurveyLinkViewModel surveyLinkViewModel)
        {
            var embeddedData = Mapper.Map <EmbeddedData>(model);

            embeddedData.QURL = string.Format("{0}API/v3/surveys/{1}/responses", _configuration.QualtricsApiBaseUrl, _configuration.QualtricsRecommendedServiceSurveyId);
            surveyLinkViewModel.EmbeddedData = embeddedData;
        }
        public void LogSurveyInterstitial(SurveyLinkViewModel model)
        {
            var audit = model.ToAuditEntry();

            audit.Page = "Survey Interstitial";
            Log(audit);
        }
        public void No_Grouped_Services()
        {
            var surveyLinkViewModel = new SurveyLinkViewModel();

            _sut.AddServiceInformation(_modelNoGroupedServices, surveyLinkViewModel);

            Assert.AreEqual(BookPharmacyCallModelBuilder.gp_phcas_click, surveyLinkViewModel.BookPharmacyCall);
        }
        public void No_Pharmacy_Services()
        {
            var surveyLinkViewModel = new SurveyLinkViewModel();

            _sut.AddServiceInformation(_modelNoService, surveyLinkViewModel);

            Assert.AreEqual(surveyLinkViewModel.BookPharmacyCall, BookPharmacyCallModelBuilder.gp_nophcas);
        }
        public void No_Services_Offered()
        {
            var surveyLinkViewModel = new SurveyLinkViewModel();

            _sut.AddServiceInformation(_modelNoService, surveyLinkViewModel);

            Assert.AreEqual(string.Empty, surveyLinkViewModel.ServiceOptions);
            Assert.AreEqual(0, surveyLinkViewModel.ServiceCount);
        }
        public void Grouped_DoS_But_No_Services_Exist()
        {
            var surveyLinkViewModel = new SurveyLinkViewModel();

            _sut.AddServiceInformation(_model, surveyLinkViewModel);

            Assert.AreEqual("Callback", surveyLinkViewModel.ServiceOptions);
            Assert.AreEqual(1, surveyLinkViewModel.ServiceCount);
        }
示例#7
0
        public static AuditEntry ToAuditEntry(this SurveyLinkViewModel model)
        {
            var audit = new AuditEntry
            {
                SessionId    = GetSessionId(model.Campaign, model.SessionId),
                JourneyId    = Guid.Parse(model.JourneyId) != Guid.Empty ? model.JourneyId : null,
                Campaign     = model.Campaign,
                PathwayId    = model.EndPathwayNo,
                PathwayTitle = model.EndPathwayTitle,
                DxCode       = model.DispositionCode
            };

            return(audit);
        }
        public void AddServiceInformation(OutcomeViewModel model, SurveyLinkViewModel surveyLinkViewModel)
        {
            var serviceOptions = new List <string>();
            var services       = new List <ServiceViewModel>();

            if (model.GroupedDosServices != null)
            {
                services       = model.GroupedDosServices.SelectMany(g => g.Services).ToList();
                serviceOptions = services.GroupBy(s => s.OnlineDOSServiceType.Id).Select(s => s.Key).ToList();
            }

            surveyLinkViewModel.Services = new List <ServiceViewModel>();

            //For covid specific outcomes, only set these params if the results contain itk services
            if (OutcomeGroup.Isolate111.Equals(model.OutcomeGroup))
            {
                if (model.DosCheckCapacitySummaryResult.HasITKServices)
                {
                    surveyLinkViewModel.ServiceCount   = services.Count;
                    surveyLinkViewModel.ServiceOptions = string.Join(",", serviceOptions);
                }
            }
            else
            {
                surveyLinkViewModel.ServiceCount   = services.Count;
                surveyLinkViewModel.ServiceOptions = string.Join(",", serviceOptions);
            }

            if (!model.DosCheckCapacitySummaryResult.ResultListEmpty)
            {
                var recommendedService = model.DosCheckCapacitySummaryResult.Success.Services.First();
                surveyLinkViewModel.RecommendedServiceId   = recommendedService.Id;
                surveyLinkViewModel.RecommendedServiceType = recommendedService.OnlineDOSServiceType.Id;
                surveyLinkViewModel.RecommendedServiceName = recommendedService.PublicName;

                var otherServices = model.DosCheckCapacitySummaryResult.Success.Services.Skip(1).ToList();
                services       = model.DosCheckCapacitySummaryResult.Success.Services;
                serviceOptions = services.GroupBy(s => s.OnlineDOSServiceType.Id).Select(s => s.Key).ToList();
            }

            surveyLinkViewModel.ServiceCount   = services.Count;
            surveyLinkViewModel.ServiceOptions = string.Join(",", serviceOptions);

            var serviceTypeId = model.SelectedService != null ? model.SelectedService.ServiceType.Id : -1;

            surveyLinkViewModel.BookPharmacyCall            = BookPharmacyCallModelBuilder.BookPharmacyCallValue(model.Id, serviceTypeId, services, OutcomeGroup.PrePopulatedDosResultsOutcomeGroups.Contains(model.OutcomeGroup));
            surveyLinkViewModel.RecommendedServiceTypeAlias = ServiceViewModel.GetServiceTypeAliasValue(model);
        }
        public async Task <SurveyLinkViewModel> SurveyLinkBuilder(OutcomeViewModel model)
        {
            var jsonParser            = new JourneyJsonParser(model.JourneyJson);
            var businessApiPathwayUrl = _configuration.GetBusinessApiPathwayIdUrl(jsonParser.LastPathwayNo, model.UserInfo.Demography.Gender, model.UserInfo.Demography.Age);
            var response = await _restClient.ExecuteAsync <Pathway>(new JsonRestRequest(businessApiPathwayUrl, Method.GET));

            CheckResponse(response);

            var pathway         = response.Data;
            var resultingDxCode = model.Is999Callback ? FromOutcomeViewModelToDosViewModel.DispositionResolver.Remap(model.Id) : model.Id;
            var result          = new SurveyLinkViewModel
            {
                DispositionCode             = model.Id,
                DispositionDateTime         = model.DispositionTime,
                EndPathwayNo                = (pathway != null) ? pathway.PathwayNo : string.Empty,
                EndPathwayTitle             = (pathway != null) ? pathway.Title : string.Empty,
                JourneyId                   = model.JourneyId.ToString(),
                SessionId                   = model.SessionId,
                PathwayNo                   = model.PathwayNo,
                DigitalTitle                = model.DigitalTitle,
                Campaign                    = model.Campaign,
                CampaignSource              = model.Source,
                ValidationCallbackOffered   = model.HasAcceptedCallbackOffer.HasValue,
                GuidedSelection             = GetGuidedSelectionParameterFrom(model),
                RecommendedServiceTypeAlias = ServiceViewModel.GetServiceTypeAliasValue(model),
                StartUrl                    = model.StartParameter
            };

            var isPharmacyPathway = result.EndPathwayNo == "PW1827";

            result.SurveyId = isPharmacyPathway ? _surveyLinkFeature.PharmacySurveyId : _surveyLinkFeature.SurveyId;
            AddServiceInformation(model, result);

            model.SurveyLink = result;
            AddEmbeddedDataInformation(model, result);

            return(result);
        }
 public void AddDispositionReason(string reason, SurveyLinkViewModel surveyLinkViewModel)
 {
     surveyLinkViewModel.DispositionChoiceReasoning = reason;
 }
示例#11
0
 public async Task <ActionResult> SurveyInterstitial(SurveyLinkViewModel model, string fromRoute)
 {
     _auditLogger.LogSurveyInterstitial(model);
     return(View("~\\Views\\Outcome\\SurveyInterstitial.cshtml", model));
 }