shorter lines
Some checks failed
Build and deploy the backend to staging / Build and push image (pull_request) Successful in 2m27s
Run linting on the backend code / Build (pull_request) Failing after 36s
Run testing on the backend code / Build (pull_request) Failing after 1m25s
Build and deploy the backend to staging / Deploy to staging (pull_request) Successful in 15s
Some checks failed
Build and deploy the backend to staging / Build and push image (pull_request) Successful in 2m27s
Run linting on the backend code / Build (pull_request) Failing after 36s
Run testing on the backend code / Build (pull_request) Failing after 1m25s
Build and deploy the backend to staging / Deploy to staging (pull_request) Successful in 15s
This commit is contained in:
@@ -6,9 +6,11 @@ from ..utils.get_time_separation import get_time
|
||||
class LinkedLandmarks:
|
||||
"""
|
||||
A list of landmarks that are linked together, e.g. in a route.
|
||||
Each landmark serves as a node in the linked list, but since we expect these to be consumed through the rest API,
|
||||
a pythonic reference to the next landmark is not well suited. Instead we use the uuid of the next landmark
|
||||
to reference the next landmark in the list. This is not very efficient, but appropriate for the expected use case
|
||||
Each landmark serves as a node in the linked list, but since we expect
|
||||
these to be consumed through the rest API, a pythonic reference to the next
|
||||
landmark is not well suited. Instead we use the uuid of the next landmark
|
||||
to reference the next landmark in the list. This is not very efficient,
|
||||
but appropriate for the expected use case
|
||||
("short" trips with onyl few landmarks).
|
||||
"""
|
||||
|
||||
@@ -21,7 +23,8 @@ class LinkedLandmarks:
|
||||
where the first landmark is the starting point and the last landmark is the end point.
|
||||
|
||||
Args:
|
||||
data (list[Landmark], optional): The list of landmarks that are linked together. Defaults to None.
|
||||
data (list[Landmark], optional): The list of landmarks that are linked together.
|
||||
Defaults to None.
|
||||
"""
|
||||
self._landmarks = data if data else []
|
||||
self._link_landmarks()
|
||||
@@ -29,7 +32,8 @@ class LinkedLandmarks:
|
||||
|
||||
def _link_landmarks(self) -> None:
|
||||
"""
|
||||
Create the links between the landmarks in the list by setting their .next_uuid and the .time_to_next attributes.
|
||||
Create the links between the landmarks in the list by setting their
|
||||
.next_uuid and the .time_to_next attributes.
|
||||
"""
|
||||
|
||||
# Mark secondary landmarks as such
|
||||
@@ -57,12 +61,12 @@ class LinkedLandmarks:
|
||||
if len(scores) >= 10:
|
||||
threshold_score = scores[9]
|
||||
else:
|
||||
# If there are fewer than 10 landmarks, use the lowest score in the list as the threshold
|
||||
# If there are fewer than 10 landmarks, use the lowest score as the threshold
|
||||
threshold_score = min(scores) if scores else 0
|
||||
|
||||
# Update 'is_secondary' for landmarks with attractiveness below the threshold score
|
||||
for landmark in self._landmarks:
|
||||
if landmark.attractiveness < threshold_score and landmark.type not in ["start", "finish"]:
|
||||
if (landmark.attractiveness < threshold_score and landmark.type not in ["start", "finish"]):
|
||||
landmark.is_secondary = True
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user