mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-30 08:07:01 -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,17 +3,18 @@ Selectors for ride-related data retrieval.
|
||||
Following Django styleguide pattern for separating data access from business logic.
|
||||
"""
|
||||
|
||||
from typing import Optional, Dict, Any
|
||||
from django.db.models import QuerySet, Q, Count, Avg, Prefetch
|
||||
from typing import Any
|
||||
|
||||
from django.contrib.gis.geos import Point
|
||||
from django.contrib.gis.measure import Distance
|
||||
from django.db.models import Avg, Count, Prefetch, Q, QuerySet
|
||||
|
||||
from .models import Ride, RideModel, RideReview
|
||||
from .choices import RIDE_CATEGORIES
|
||||
from .models import Ride, RideModel, RideReview
|
||||
|
||||
|
||||
def ride_list_for_display(
|
||||
*, filters: Optional[Dict[str, Any]] = None
|
||||
*, filters: dict[str, Any] | None = None
|
||||
) -> QuerySet[Ride]:
|
||||
"""
|
||||
Get rides optimized for list display with related data.
|
||||
@@ -246,9 +247,10 @@ def rides_with_recent_reviews(*, days: int = 30) -> QuerySet[Ride]:
|
||||
Returns:
|
||||
QuerySet of rides with recent reviews
|
||||
"""
|
||||
from django.utils import timezone
|
||||
from datetime import timedelta
|
||||
|
||||
from django.utils import timezone
|
||||
|
||||
cutoff_date = timezone.now() - timedelta(days=days)
|
||||
|
||||
return (
|
||||
@@ -267,7 +269,7 @@ def rides_with_recent_reviews(*, days: int = 30) -> QuerySet[Ride]:
|
||||
)
|
||||
|
||||
|
||||
def ride_statistics_by_category() -> Dict[str, Any]:
|
||||
def ride_statistics_by_category() -> dict[str, Any]:
|
||||
"""
|
||||
Get ride statistics grouped by category.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user