mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 12:51:09 -05:00
fixing the home page
This commit is contained in:
@@ -6,22 +6,22 @@ from rides.models import Ride
|
||||
from .models import Park
|
||||
|
||||
def update_park_ride_counts(park):
|
||||
"""Update total_rides and total_roller_coasters for a park"""
|
||||
"""Update ride_count and coaster_count for a park"""
|
||||
operating_rides = Q(status='OPERATING')
|
||||
|
||||
# Count total operating rides
|
||||
total_rides = park.rides.filter(operating_rides).count()
|
||||
ride_count = park.rides.filter(operating_rides).count()
|
||||
|
||||
# Count total operating roller coasters
|
||||
total_coasters = park.rides.filter(
|
||||
coaster_count = park.rides.filter(
|
||||
operating_rides,
|
||||
category='RC'
|
||||
).count()
|
||||
|
||||
# Update park counts
|
||||
Park.objects.filter(id=park.id).update(
|
||||
total_rides=total_rides,
|
||||
total_roller_coasters=total_coasters
|
||||
ride_count=ride_count,
|
||||
coaster_count=coaster_count
|
||||
)
|
||||
|
||||
@receiver(post_save, sender=Ride)
|
||||
|
||||
Reference in New Issue
Block a user