mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 12:11:13 -05:00
- Add complete backend/ directory with full Django application - Add frontend/ directory with Vite + TypeScript setup ready for Next.js - Add comprehensive shared/ directory with: - Complete documentation and memory-bank archives - Media files and avatars (letters, park/ride images) - Deployment scripts and automation tools - Shared types and utilities - Add architecture/ directory with migration guides - Configure pnpm workspace for monorepo development - Update .gitignore to exclude .django_tailwind_cli/ build artifacts - Preserve all historical documentation in shared/docs/memory-bank/ - Set up proper structure for full-stack development with shared resources
76 lines
2.4 KiB
Python
76 lines
2.4 KiB
Python
from typing import Dict
|
|
|
|
|
|
def get_ride_display_changes(changes: Dict) -> Dict:
|
|
"""Returns a human-readable version of the ride changes"""
|
|
field_names = {
|
|
"name": "Name",
|
|
"description": "Description",
|
|
"status": "Status",
|
|
"post_closing_status": "Post-Closing Status",
|
|
"opening_date": "Opening Date",
|
|
"closing_date": "Closing Date",
|
|
"status_since": "Status Since",
|
|
"capacity_per_hour": "Hourly Capacity",
|
|
"min_height_in": "Minimum Height",
|
|
"max_height_in": "Maximum Height",
|
|
"ride_duration_seconds": "Ride Duration",
|
|
}
|
|
|
|
display_changes = {}
|
|
for field, change in changes.items():
|
|
if field in field_names:
|
|
old_value = change.get("old", "")
|
|
new_value = change.get("new", "")
|
|
|
|
# Format specific fields
|
|
if field == "status":
|
|
from .models import Ride
|
|
|
|
choices = dict(Ride.STATUS_CHOICES)
|
|
old_value = choices.get(old_value, old_value)
|
|
new_value = choices.get(new_value, new_value)
|
|
elif field == "post_closing_status":
|
|
from .models import Ride
|
|
|
|
choices = dict(Ride.POST_CLOSING_STATUS_CHOICES)
|
|
old_value = choices.get(old_value, old_value)
|
|
new_value = choices.get(new_value, new_value)
|
|
|
|
display_changes[field_names[field]] = {
|
|
"old": old_value,
|
|
"new": new_value,
|
|
}
|
|
|
|
return display_changes
|
|
|
|
|
|
def get_ride_model_display_changes(changes: Dict) -> Dict:
|
|
"""Returns a human-readable version of the ride model changes"""
|
|
field_names = {
|
|
"name": "Name",
|
|
"description": "Description",
|
|
"category": "Category",
|
|
}
|
|
|
|
display_changes = {}
|
|
for field, change in changes.items():
|
|
if field in field_names:
|
|
old_value = change.get("old", "")
|
|
new_value = change.get("new", "")
|
|
|
|
# Format category field
|
|
if field == "category":
|
|
from .models import CATEGORY_CHOICES
|
|
|
|
choices = dict(CATEGORY_CHOICES)
|
|
old_value = choices.get(old_value, old_value)
|
|
new_value = choices.get(new_value, new_value)
|
|
|
|
display_changes[field_names[field]] = {
|
|
"old": old_value,
|
|
"new": new_value,
|
|
}
|
|
|
|
return display_changes
|