Skip to content

Commit ab887b3

Browse files
Copilotdwarwick
andcommitted
Fix branching demo to use manual product choices instead of presets
Co-authored-by: dwarwick <15970276+dwarwick@users.noreply.github.com>
1 parent 5716cb6 commit ab887b3

File tree

2 files changed

+40
-16
lines changed

2 files changed

+40
-16
lines changed

JwtIdentity.Client/Pages/Survey/EditSurvey.razor

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@
241241
{
242242
<MudPaper>
243243
<MudText Typo="Typo.h6" Class="mb-1">Add the Question Choices</MudText>
244-
<DemoBorder CurrentDemoStep="@DemoStep" StepsToShow="@(new List<int>() { 8 })">
244+
<DemoBorder CurrentDemoStep="@DemoStep" StepsToShow="@(new List<int>() { 11, 14, 17 })">
245245
<MudSelect id="PresetChoices" Label="Preset Choices (Will overwrite existing choices)" T="string" @bind-Value="SelectedPresetChoice" Variant="Variant.Filled" Dense="true">
246246
<MudSelectItem T="string" Value=null>-- Select Preset --</MudSelectItem>
247247
@foreach (var preset in PresetChoices)
@@ -251,7 +251,26 @@
251251
</MudSelect>
252252
</DemoBorder>
253253
<DemoPopup CurrentDemoStep="@DemoStep" StepsToShow="@(new List<int>() { 8 })">
254-
<MudText Typo="Typo.body2">Now we will pick appropriate choices for this question. Expand the Preset Choices drop-down and select Yes No Partially.</MudText>
254+
@if (DemoType == "branching")
255+
{
256+
<MudText Typo="Typo.body2">For this product question, we'll add custom choices. Click Next to add Product A, Product B, and Product C automatically.</MudText>
257+
<DemoBorder CurrentDemoStep="@DemoStep" StepsToShow="@(new List<int>() { 8 })" IsButton="true">
258+
<MudButton OnClick="NextDemoStep" Variant="Variant.Filled" Color="Color.Success">Next</MudButton>
259+
</DemoBorder>
260+
}
261+
else
262+
{
263+
<MudText Typo="Typo.body2">Now we will pick appropriate choices for this question. Expand the Preset Choices drop-down and select Yes No Partially.</MudText>
264+
}
265+
</DemoPopup>
266+
<DemoPopup CurrentDemoStep="@DemoStep" StepsToShow="@(new List<int>() { 11 })">
267+
<MudText Typo="Typo.body2">For the second question about customer service, select <strong>How Satisfied</strong> from the Preset Choices.</MudText>
268+
</DemoPopup>
269+
<DemoPopup CurrentDemoStep="@DemoStep" StepsToShow="@(new List<int>() { 14 })">
270+
<MudText Typo="Typo.body2">For the third question about product recommendation, select <strong>How Likely</strong> from the Preset Choices.</MudText>
271+
</DemoPopup>
272+
<DemoPopup CurrentDemoStep="@DemoStep" StepsToShow="@(new List<int>() { 17 })">
273+
<MudText Typo="Typo.body2">For the fourth question about ease of use, select <strong>Yes No Partially</strong> from the Preset Choices.</MudText>
255274
</DemoPopup>
256275
<MudTextField id="Choice" Label="Choice Text" @bind-Value="NewChoiceOptionText" Variant="Variant.Filled" Lines="1" MaxLines="5" AutoGrow="true" Immediate="true" Counter="50" MaxLength="50" ReadOnly="@IsDemoUser" />
257276

JwtIdentity.Client/Pages/Survey/EditSurvey.razor.cs

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86,21 +86,18 @@ protected string SelectedPresetChoice
8686
if (DemoType == "branching")
8787
{
8888
// Branching demo - different choices for each question
89-
if (DemoStep == 8 && value == "Excellent to Poor")
89+
// First question uses manual choices, so no preset needed
90+
if (DemoStep == 11 && value == "How Satisfied")
9091
{
91-
DemoStep = 9; // First branching question
92+
DemoStep = 12; // Second branching question - customer service
9293
}
93-
else if (DemoStep == 11 && value == "How Satisfied")
94+
else if (DemoStep == 14 && value == "How Likely")
9495
{
95-
DemoStep = 12; // Second branching question
96+
DemoStep = 15; // Third question - recommendation
9697
}
97-
else if (DemoStep == 14 && value == "Yes No Partially")
98+
else if (DemoStep == 17 && value == "Yes No Partially")
9899
{
99-
DemoStep = 15; // Third question
100-
}
101-
else if (DemoStep == 17 && value == "Yes No")
102-
{
103-
DemoStep = 18; // Fourth question
100+
DemoStep = 18; // Fourth question - ease of use
104101
}
105102
}
106103
else
@@ -237,25 +234,33 @@ protected void NextDemoStep()
237234
DemoStep = 5;
238235
break;
239236
case 7:
240-
// First branching question - "Which product did you purchase?"
237+
// First branching question - Which product
241238
QuestionText = "Which product did you purchase?";
242239
DemoStep = 8;
243240
break;
241+
case 8:
242+
// Add product choices manually for first question
243+
MultipleChoiceQuestion.Options.Clear();
244+
MultipleChoiceQuestion.Options.Add(new ChoiceOptionViewModel { OptionText = "Product A", Order = 0 });
245+
MultipleChoiceQuestion.Options.Add(new ChoiceOptionViewModel { OptionText = "Product B", Order = 1 });
246+
MultipleChoiceQuestion.Options.Add(new ChoiceOptionViewModel { OptionText = "Product C", Order = 2 });
247+
DemoStep = 9;
248+
break;
244249
case 10:
245250
// After adding first branching question, create second
246-
QuestionText = "How would you rate our customer service?";
251+
QuestionText = "How satisfied are you with our customer service?";
247252
SelectedQuestionType = "Multiple Choice";
248253
DemoStep = 11;
249254
break;
250255
case 13:
251256
// After adding second branching question, create third (for Group 1)
252-
QuestionText = "What features of the product do you use most?";
257+
QuestionText = "Would you recommend this product to others?";
253258
SelectedQuestionType = "Multiple Choice";
254259
DemoStep = 14;
255260
break;
256261
case 16:
257262
// After adding third question, create fourth (for Group 2)
258-
QuestionText = "What improvements would you suggest for the service?";
263+
QuestionText = "Did you find the product easy to use?";
259264
SelectedQuestionType = "Multiple Choice";
260265
DemoStep = 17;
261266
break;

0 commit comments

Comments
 (0)