mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-28 18:22:05 +00:00
Allow spotting upstream to cluster. #39
This commit is contained in:
@@ -21,16 +21,18 @@ def build_options():
|
||||
"""Build the options data that is returned by the /options API and used to populate the web UI templates. This
|
||||
doesn't change at runtime, so it is built once on first use and then cached."""
|
||||
|
||||
# Build a map of activity name -> list of provider names that can submit spots for that activity
|
||||
# Build a map of activity name -> list of provider names that can submit spots for that activity. Spots with no
|
||||
# activity use the empty string as the key as that's effectively what is in the "blank" entry in the drop-down
|
||||
# on the Add Spot page
|
||||
spot_submit_providers = {}
|
||||
|
||||
# Spothole v2.0 - disable this for now, API changes are in but this functionality is not ready yet. TODO
|
||||
# for provider in DATA_PROVIDERS.spot_providers:
|
||||
# if not provider.enabled:
|
||||
# continue
|
||||
# for activity in ACTIVITIES.values():
|
||||
# if provider.can_submit_spot(activity.name):
|
||||
# spot_submit_providers.setdefault(activity.name, []).append(provider.name)
|
||||
for provider in DATA_PROVIDERS.spot_providers:
|
||||
if not provider.enabled:
|
||||
continue
|
||||
for activity_name in [None, *(activity.name for activity in ACTIVITIES.values())]:
|
||||
if provider.can_submit_spot(activity_name):
|
||||
names = spot_submit_providers.setdefault(activity_name or "", [])
|
||||
if provider.name not in names:
|
||||
names.append(provider.name)
|
||||
|
||||
# Spot/alert sources are filtered for only ones that are enabled in config, no point letting the user toggle
|
||||
# things that aren't even available.
|
||||
|
||||
Reference in New Issue
Block a user