mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-20 22:37:44 +00:00
Add a has_refs field to activities #147
This commit is contained in:
+5
-4
@@ -12,6 +12,7 @@ from pyhamtools.locator import latlong_to_locator, locator_to_latlong
|
||||
from core.activity_lookup_helper import populate_missing_activity_ref_info
|
||||
from core.activity_utils import (
|
||||
ANY_ACTIVITY_REGEX,
|
||||
get_activity_by_name,
|
||||
get_activity_name_from_comment_name,
|
||||
get_icon_for_activity,
|
||||
get_ref_regex_for_activity,
|
||||
@@ -296,10 +297,10 @@ class Spot:
|
||||
|
||||
# Now look to see if that activity name was followed by something that looks like a reference ID
|
||||
# for that activity. If so, add that to the sig_refs list for this spot.
|
||||
ref_regex = get_ref_regex_for_activity(found_activity)
|
||||
if ref_regex:
|
||||
found_activity_info = get_activity_by_name(found_activity)
|
||||
if found_activity_info and found_activity_info.has_refs and found_activity_info.ref_regex:
|
||||
ref_matches = re.finditer(
|
||||
r"(^|\W)" + found_activity + r"([ -])(" + ref_regex + r")($|\W)",
|
||||
r"(^|\W)" + found_activity + r"([ -])(" + found_activity_info.ref_regex + r")($|\W)",
|
||||
self.comment,
|
||||
re.IGNORECASE,
|
||||
)
|
||||
@@ -313,7 +314,7 @@ class Spot:
|
||||
# activity.
|
||||
if self.comment:
|
||||
for activity in ACTIVITIES.values():
|
||||
if activity.refs_globally_unique and activity.ref_regex:
|
||||
if activity.has_refs and activity.refs_globally_unique and activity.ref_regex:
|
||||
ref_matches = re.finditer(
|
||||
r"(^|\W)(" + activity.ref_regex + r")($|\W)", self.comment, re.IGNORECASE
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user