mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-31 10:07:03 -05:00
feat: Implement MFA authentication, add ride statistics model, and update various services, APIs, and tests across the application.
This commit is contained in:
@@ -3,10 +3,11 @@ Rides-specific location services with OpenStreetMap integration.
|
||||
Handles location management for individual rides within parks.
|
||||
"""
|
||||
|
||||
import requests
|
||||
from typing import List, Dict, Any, Optional
|
||||
from django.db import transaction
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
import requests
|
||||
from django.db import transaction
|
||||
|
||||
from ..models import RideLocation
|
||||
|
||||
@@ -27,8 +28,8 @@ class RideLocationService:
|
||||
cls,
|
||||
*,
|
||||
ride,
|
||||
latitude: Optional[float] = None,
|
||||
longitude: Optional[float] = None,
|
||||
latitude: float | None = None,
|
||||
longitude: float | None = None,
|
||||
park_area: str = "",
|
||||
notes: str = "",
|
||||
entrance_notes: str = "",
|
||||
@@ -101,7 +102,7 @@ class RideLocationService:
|
||||
return ride_location
|
||||
|
||||
@classmethod
|
||||
def find_rides_in_area(cls, park, park_area: str) -> List[RideLocation]:
|
||||
def find_rides_in_area(cls, park, park_area: str) -> list[RideLocation]:
|
||||
"""
|
||||
Find all rides in a specific park area.
|
||||
|
||||
@@ -121,7 +122,7 @@ class RideLocationService:
|
||||
@classmethod
|
||||
def find_nearby_rides(
|
||||
cls, latitude: float, longitude: float, park=None, radius_meters: float = 500
|
||||
) -> List[RideLocation]:
|
||||
) -> list[RideLocation]:
|
||||
"""
|
||||
Find rides near given coordinates using PostGIS.
|
||||
Useful for finding rides near a specific location within a park.
|
||||
@@ -153,7 +154,7 @@ class RideLocationService:
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def get_ride_navigation_info(cls, ride_location: RideLocation) -> Dict[str, Any]:
|
||||
def get_ride_navigation_info(cls, ride_location: RideLocation) -> dict[str, Any]:
|
||||
"""
|
||||
Get comprehensive navigation information for a ride.
|
||||
|
||||
@@ -196,8 +197,8 @@ class RideLocationService:
|
||||
def estimate_ride_coordinates_from_park(
|
||||
cls,
|
||||
ride_location: RideLocation,
|
||||
area_offset_meters: Optional[Dict[str, List[float]]] = None,
|
||||
) -> Optional[List[float]]:
|
||||
area_offset_meters: dict[str, list[float]] | None = None,
|
||||
) -> list[float] | None:
|
||||
"""
|
||||
Estimate ride coordinates based on park location and area.
|
||||
Useful when exact ride coordinates are not available.
|
||||
@@ -332,7 +333,7 @@ class RideLocationService:
|
||||
return updated_count
|
||||
|
||||
@classmethod
|
||||
def generate_park_area_map(cls, park) -> Dict[str, List[str]]:
|
||||
def generate_park_area_map(cls, park) -> dict[str, list[str]]:
|
||||
"""
|
||||
Generate a map of park areas and the rides in each area.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user