Calendar trigger

This commit is contained in:
2024-01-20 23:47:32 +01:00
parent 1ff4a15818
commit b7677bdcce
14 changed files with 502 additions and 24 deletions

View File

@ -65,8 +65,6 @@ public class CalendarReceiver extends BroadcastReceiver implements AutomationLis
public static void addUsedPair(RuleEventPair pair)
{
//TODO: Rule with multiple calendar events should be executed only once
// Add pair only if it's not in the list already.
for(RuleEventPair usedPair : calendarEventsUsed)
{
@ -593,12 +591,20 @@ public class CalendarReceiver extends BroadcastReceiver implements AutomationLis
{
if (!hasEventBeenUsedInRule(rule, event))
{
Miscellaneous.logEvent("i", "mayRuleStillBeActivatedForPendingCalendarEvents()", "Rule " + rule.getName() + " has not been used in conjunction with event " + event, 4);
return true;
/*
If there are multiple parallel calendar events and a rule has multiple
triggers of type calendar event, we don't want the rule to fire only once.
*/
if(rule.getAmountOfTriggersForType(Trigger.Trigger_Enum.calendarEvent) == 1)
{
Miscellaneous.logEvent("i", "mayRuleStillBeActivatedForPendingCalendarEvents()", "Rule " + rule.getName() + " has not been used in conjunction with event " + event, 4);
return true;
}
}
}
}
}
return false;
}