private async Task ProcessSizeChoice(IDialogContext context, IAwaitable <string> awaitable) { string ans = await awaitable; string currentModel; HandSetFeatures phoneFeatures; int handSetsLeft, handSetsNow = decoder.CurrentNumberofHandsetsLeft(); context.ConversationData.TryGetValue("HandsetModelKey", out currentModel); currentModel = "iphone 7 plus 256gb"; phoneFeatures = handSetsBag.GetModelFeatures(currentModel); if (ans == "THE SAME") { needsScores.CurrentPhone = currentModel; decoder.ExcludeThis(EIntents.Small); decoder.SetSizeRequirements(0, false); handSetsLeft = needsScores.GetTopFive(NodeLuisSubsNeeds.ENeeds.PhoneSize); await UpdateUserAsync(context, handSetsLeft, handSetsNow); } else { if (ans == "SMALLER") { decoder.SetSizeRequirements(Miscellany.Product(phoneFeatures.BodySize), false); } else { decoder.SetSizeRequirements(Miscellany.Product(phoneFeatures.BodySize), true); } await DecodeAndProcessIntentAsync(context); } }
private double SameSizeScore(HandSetFeatures phone) { HandSetFeatures currentPhoneFeatures = basket.GetModelFeatures(CurrentPhone); double currentPhoneSize, candidatePhoneSize, m, b; // m = declive currentPhoneSize = Miscellany.Product(currentPhoneFeatures.BodySize); candidatePhoneSize = Miscellany.Product(phone.BodySize); if ((candidatePhoneSize >= (currentPhoneSize * 0.95)) && (candidatePhoneSize <= (currentPhoneSize * 1.05))) { return(1); } if ((candidatePhoneSize <= (currentPhoneSize * 0.8)) || (candidatePhoneSize >= (currentPhoneSize * 1.2))) { return(0); } if (candidatePhoneSize < currentPhoneSize) { m = 1 / (0.15 * currentPhoneSize); b = -16 / 3; return(candidatePhoneSize * m + b); } else { m = -1 / (0.15 * currentPhoneSize); b = 8; } return(candidatePhoneSize * m + b); }
protected async Task PlanPricesButtonHandlerAsync(IDialogContext context, string modelPicked) { HandSetFeatures handSetFeatures; if (handSets == null) { InitializeDataStruct(); } handSetFeatures = handSets.GetModelFeatures(modelPicked); var heroCard = new HeroCard() { Images = new List <CardImage> { new CardImage(handSetFeatures.MadCalmPicUrl + ".png", "img/jpeg") } }; var message = context.MakeMessage(); message.Attachments.Add(heroCard.ToAttachment()); await context.PostAsync(message); }