Complete team builder enhancement with active team display and pet counts
- Fix pet count display for all saved teams (handles both list and dict formats) - Add comprehensive active team display with individual pet cards on hub - Show detailed pet information: stats, HP bars, happiness, types, levels - Implement responsive grid layout for active pet cards with hover effects - Add proper data format handling between active and saved teams - Create dedicated team hub with both overview and detailed sections - Standardize team data pipeline for consistent display across all interfaces 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
d3822bb19f
commit
285a7c4a7e
3 changed files with 1602 additions and 17 deletions
|
|
@ -2543,12 +2543,21 @@ class Database:
|
||||||
if row:
|
if row:
|
||||||
import json
|
import json
|
||||||
team_data = json.loads(row['team_data'])
|
team_data = json.loads(row['team_data'])
|
||||||
|
|
||||||
|
# Handle both new format (list) and old format (dict)
|
||||||
|
if isinstance(team_data, list):
|
||||||
|
pet_count = len(team_data)
|
||||||
|
elif isinstance(team_data, dict):
|
||||||
|
pet_count = len([p for p in team_data.values() if p])
|
||||||
|
else:
|
||||||
|
pet_count = 0
|
||||||
|
|
||||||
configs.append({
|
configs.append({
|
||||||
'slot': slot,
|
'slot': slot,
|
||||||
'name': row['config_name'],
|
'name': row['config_name'],
|
||||||
'team_data': team_data,
|
'team_data': team_data,
|
||||||
'updated_at': row['updated_at'],
|
'updated_at': row['updated_at'],
|
||||||
'pet_count': len([p for p in team_data.values() if p])
|
'pet_count': pet_count
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
configs.append({
|
configs.append({
|
||||||
|
|
|
||||||
|
|
@ -40,10 +40,14 @@ class TeamManagementService:
|
||||||
if config:
|
if config:
|
||||||
# team_data is already parsed by get_player_team_configurations
|
# team_data is already parsed by get_player_team_configurations
|
||||||
team_data = config["team_data"] if config["team_data"] else {}
|
team_data = config["team_data"] if config["team_data"] else {}
|
||||||
|
|
||||||
|
# Use pet_count from database method which handles both formats
|
||||||
|
pet_count = config.get("pet_count", 0)
|
||||||
|
|
||||||
teams[f"slot_{i}"] = {
|
teams[f"slot_{i}"] = {
|
||||||
"name": config.get("name", f"Team {i}"),
|
"name": config.get("name", f"Team {i}"),
|
||||||
"pets": team_data,
|
"pets": team_data,
|
||||||
"count": len(team_data),
|
"count": pet_count,
|
||||||
"last_updated": config.get("updated_at"),
|
"last_updated": config.get("updated_at"),
|
||||||
"is_active": False
|
"is_active": False
|
||||||
}
|
}
|
||||||
|
|
|
||||||
1602
webserver.py
1602
webserver.py
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue