Fix orientation parameter handling and template URL endpoints

- Add orientation parameter support to create_group and edit_group functions
- Fix manage_group.html template URL endpoint from 'update_group_content_order' to 'update_group_content_order_route'
- Add orientation field and filtering to edit_group.html template with JavaScript functionality
- Update group_player_management.py to handle orientation validation in create and edit operations
- Fix docker-compose.yml to include build directive and correct volume paths
- Update entrypoint.sh to handle fresh deployments without migrations
- Ensure orientation consistency across group and player management

These changes resolve:
- Internal Server Error on manage_group page
- Missing orientation parameter in group creation/editing
- Template URL endpoint mismatches
- Docker deployment issues with fresh installations
This commit is contained in:
2025-08-01 15:15:59 -04:00
parent 70d76f45e7
commit 318f783de3
7 changed files with 76 additions and 18 deletions

View File

@@ -35,15 +35,24 @@ def create_group(name, player_ids, orientation='Landscape'):
log_group_created(name)
return new_group
def edit_group(group_id, name, player_ids):
def edit_group(group_id, name, player_ids, orientation=None):
"""
Edit an existing group, updating its name and players.
Edit an existing group, updating its name, orientation, and players.
Handles locking/unlocking players appropriately.
"""
group = Group.query.get_or_404(group_id)
old_name = group.name # Store old name in case it changes
group.name = name
# Update orientation if provided
if orientation:
group.orientation = orientation
# Validate that all selected players have the matching orientation
for player_id in player_ids:
player = Player.query.get(player_id)
if player and player.orientation != orientation:
raise ValueError(f"Player '{player.username}' has orientation '{player.orientation}', which does not match group orientation '{orientation}'.")
# Get current players in the group
current_player_ids = [player.id for player in group.players]