Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BugFix - Log Previous Activity And Actions When Continued #3709

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 58 additions & 2 deletions Ginger/Ginger/AutomatePageLib/NewAutomatePage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1262,10 +1262,66 @@
await mExecutionEngine.ContinueRunAsync(eContinueLevel.StandalonBusinessFlow, eContinueFrom.LastStoppedAction);
break;
case eContinueFrom.SpecificAction:
await mExecutionEngine.ContinueRunAsync(eContinueLevel.StandalonBusinessFlow, eContinueFrom.SpecificAction, mBusinessFlow, (Activity)((Tuple<Activity, Act>)executedItem).Item1, (Act)((Tuple<Activity, Act>)executedItem).Item2);
Activity parentActivity = (Activity)((Tuple<Activity, Act>)executedItem).Item1;
Act actionToExecute = (Act)((Tuple<Activity, Act>)executedItem).Item2;

Check notice on line 1266 in Ginger/Ginger/AutomatePageLib/NewAutomatePage.xaml.cs

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

Ginger/Ginger/AutomatePageLib/NewAutomatePage.xaml.cs#L1266

Remove this unnecessary cast to 'Act'.
try
{
if (mExecutionEngine.ExecutionLoggerManager.Configuration.SelectedDataRepositoryMethod == ExecutionLoggerConfiguration.DataRepositoryMethod.LiteDB)
{
bool reachedCurrentAction = false;
foreach (Activity activity in mBusinessFlow.Activities)
{
foreach (Act action in activity.Acts.Cast<Act>())
{
if (activity == parentActivity && action == actionToExecute)
{
reachedCurrentAction = true;
break;
}
mExecutionEngine.ExecutionLoggerManager.ActionEnd(0, action);
}
if (reachedCurrentAction)
{
break;
}
mExecutionEngine.ExecutionLoggerManager.ActivityEnd(0, activity);
}
}
}
catch (Exception ex)
{
Reporter.ToLog(eLogLevel.ERROR, "Error while logging previous activity and actions", ex);
}

await mExecutionEngine.ContinueRunAsync(eContinueLevel.StandalonBusinessFlow, eContinueFrom.SpecificAction, mBusinessFlow, parentActivity, actionToExecute);
break;
case eContinueFrom.SpecificActivity:
mBusinessFlow.CurrentActivity = (Activity)executedItem;
Activity activityToExecute = (Activity)executedItem;
try
{
if (mExecutionEngine.ExecutionLoggerManager.Configuration.SelectedDataRepositoryMethod == ExecutionLoggerConfiguration.DataRepositoryMethod.LiteDB)
{
foreach (Activity activity in mBusinessFlow.Activities)
{
if (activity == activityToExecute)
{
break;
}
foreach (Act action in activity.Acts.Cast<Act>())
{
mExecutionEngine.ExecutionLoggerManager.ActionEnd(0, action);
}
mExecutionEngine.ExecutionLoggerManager.ActivityEnd(0, activity);
}
}
}
catch (Exception ex)
{
Reporter.ToLog(eLogLevel.ERROR, "Error while logging previous activity and actions", ex);
}

mBusinessFlow.CurrentActivity = activityToExecute;

await mExecutionEngine.ContinueRunAsync(eContinueLevel.StandalonBusinessFlow, eContinueFrom.SpecificActivity, mBusinessFlow, (Activity)executedItem);
break;
default:
Expand Down
Loading