mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-25 00:34:32 +00:00
Allow spots and alerts to have multiple activities #143
This commit is contained in:
@@ -169,13 +169,13 @@ def alert_allowed_by_query(alert, query):
|
||||
# the alert is a dxpedition, or contests_skip_max_duration_check and the alert is a contest, it also
|
||||
# always passes the check.
|
||||
if (
|
||||
alert.activity == ActivityName.DXPEDITION
|
||||
ActivityName.DXPEDITION in alert.activities
|
||||
and "dxpeditions_skip_max_duration_check" in query
|
||||
and query.get("dxpeditions_skip_max_duration_check").upper() == "TRUE"
|
||||
):
|
||||
continue
|
||||
if (
|
||||
alert.activity == ActivityName.CONTEST
|
||||
ActivityName.CONTEST in alert.activities
|
||||
and "contests_skip_max_duration_check" in query
|
||||
and query.get("contests_skip_max_duration_check").upper() == "TRUE"
|
||||
):
|
||||
@@ -187,13 +187,13 @@ def alert_allowed_by_query(alert, query):
|
||||
if not alert.source or alert.source not in sources:
|
||||
return False
|
||||
case "activity":
|
||||
# If a list of activities is provided, the alert must have an activity and it must match one of them.
|
||||
# The special activity "NO_ACTIVITY", when supplied in the list, matches alerts with no activity.
|
||||
# If a list of activities is provided, the alert must have at least one activity that matches one of
|
||||
# them. The special activity "NO_ACTIVITY", when supplied in the list, matches alerts with no activity.
|
||||
activities = query.get(k).split(",")
|
||||
include_no_activity = "NO_ACTIVITY" in activities
|
||||
if not alert.activity and not include_no_activity:
|
||||
if not alert.activities and not include_no_activity:
|
||||
return False
|
||||
if alert.activity and alert.activity not in activities:
|
||||
if alert.activities and not any(a in activities for a in alert.activities):
|
||||
return False
|
||||
case "dx_continent":
|
||||
dxconts = query.get(k).split(",")
|
||||
|
||||
Reference in New Issue
Block a user