checkInteractionGoalAchievedFromMap static method
Implementation
static bool checkInteractionGoalAchievedFromMap(
InteractionGoal goal, Map<String, bool?> interactionMap) {
bool isGoalAchieved = false;
if (goal.type != InteractionGoalTypeConstants.none) {
switch (goal.type) {
case InteractionGoalTypeConstants.anyAction:
if (interactionMap.isNotEmpty) {
isGoalAchieved = true;
}
break;
case InteractionGoalTypeConstants.allOf:
bool check = true;
for (String elementId in goal.elementIds) {
if (interactionMap[elementId] == null) {
check = false;
break;
}
}
isGoalAchieved = check;
break;
case InteractionGoalTypeConstants.anyOf:
bool check = false;
for (String elementId in goal.elementIds) {
if (interactionMap[elementId] != null) {
check = true;
break;
}
}
isGoalAchieved = check;
break;
}
}
return isGoalAchieved;
}