From c397ff2c7261fae680080ee9799bc78707a7c824 Mon Sep 17 00:00:00 2001 From: Roberto T Date: Thu, 9 May 2024 10:32:46 -0600 Subject: [PATCH] DYN-6874 Logging Packages Tour Due that the Packages guide doesn't have a Welcome popup (like the other guides) the Guide.Sequence starts at 1 (instead of 0) so I had to do a fix for calculating the number of steps correctly and modify the validation which is logging information when packages tour is completed. --- src/DynamoCoreWpf/UI/GuidedTour/Guide.cs | 4 +++- src/DynamoCoreWpf/UI/GuidedTour/GuidesManager.cs | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/DynamoCoreWpf/UI/GuidedTour/Guide.cs b/src/DynamoCoreWpf/UI/GuidedTour/Guide.cs index 30996f37a36..874486afa6b 100644 --- a/src/DynamoCoreWpf/UI/GuidedTour/Guide.cs +++ b/src/DynamoCoreWpf/UI/GuidedTour/Guide.cs @@ -143,7 +143,9 @@ internal void Play() /// internal void Initialize() { - TotalSteps = GuideSteps.Count; + //There are guided tours containing repeated Sequences due that we can have different Steps flow (conditional flows) + var differentSteps = GuideSteps.Select(step => step.Sequence).Distinct().ToList(); + TotalSteps = differentSteps.Count; SetLibraryViewVisible(false); diff --git a/src/DynamoCoreWpf/UI/GuidedTour/GuidesManager.cs b/src/DynamoCoreWpf/UI/GuidedTour/GuidesManager.cs index c313d01b0a1..ae1f1066f33 100644 --- a/src/DynamoCoreWpf/UI/GuidedTour/GuidesManager.cs +++ b/src/DynamoCoreWpf/UI/GuidedTour/GuidesManager.cs @@ -240,7 +240,11 @@ internal void ExitTour() } string guidName = Resources.ResourceManager.GetString(currentGuide.GuideNameResource, System.Globalization.CultureInfo.InvariantCulture).Replace("_", ""); - if (currentGuide.TotalSteps - 1 == currentGuide.CurrentStep.Sequence) + int offSet = 1; + //Due that the Packages guide doesn't have a Welcome popup (like the other guides) then the Guide.Sequence starts at 1 (instead of 0) when we need to use a offSet = 0 + if (currentGuide.Name == PackagesGuideName) + offSet = 0; + if (currentGuide.TotalSteps - offSet == currentGuide.CurrentStep.Sequence) { Logging.Analytics.TrackEvent(Logging.Actions.Completed, Logging.Categories.GuidedTourOperations, guidName, currentGuide.CurrentStep.Sequence); }