This commit is contained in:
2026-04-20 14:39:59 +03:00
parent 1388a5fd6b
commit 3bf1598927
5 changed files with 3235 additions and 1275 deletions

View File

@@ -13,5 +13,8 @@ flask create-demo-rooms
# 5. Валидация баланса # 5. Валидация баланса
flask validate-balance flask validate-balance
# 6. Запустите сервер # 6. Проверка прибыльности
flask test-income
# 7. Запустите сервер
python app.py python app.py

1033
app.py

File diff suppressed because it is too large Load Diff

View File

@@ -15,9 +15,9 @@ class GameConfig:
# Тайминги фаз (секунды) # Тайминги фаз (секунды)
PHASE_DURATIONS = { PHASE_DURATIONS = {
'action': 120, 'action': 120,
'market': 30, 'market': 20,
'event': 30, 'event': 20,
'results': 45 'results': 25
} }
# Режимы скорости # Режимы скорости

File diff suppressed because it is too large Load Diff

View File

@@ -612,8 +612,8 @@
return; return;
} }
const readyPlayers = {{ players|selectattr('is_ready')|list|length }}; const readyPlayers = document.querySelectorAll('.player-ready.ready').length;
const totalPlayers = {{ players|length }}; const totalPlayers = document.querySelectorAll('.player-item').length;
if (totalPlayers < 2) { if (totalPlayers < 2) {
showNotification('❌ Нужно минимум 2 игрока для начала игры', 'error'); showNotification('❌ Нужно минимум 2 игрока для начала игры', 'error');
@@ -626,6 +626,8 @@
} }
} }
showNotification('🔄 Запуск игры...', 'info');
fetch('/room/{{ room.code }}/start', { fetch('/room/{{ room.code }}/start', {
method: 'POST', method: 'POST',
headers: { headers: {
@@ -633,7 +635,12 @@
'X-CSRFToken': '{{ csrf_token() if csrf_token else "" }}' 'X-CSRFToken': '{{ csrf_token() if csrf_token else "" }}'
} }
}) })
.then(response => response.json()) .then(response => {
if (!response.ok) {
return response.json().then(err => Promise.reject(err));
}
return response.json();
})
.then(data => { .then(data => {
if (data.success) { if (data.success) {
showNotification('✅ Игра начинается!', 'success'); showNotification('✅ Игра начинается!', 'success');
@@ -647,8 +654,8 @@
} }
}) })
.catch(error => { .catch(error => {
console.error('Error:', error); console.error('Error starting game:', error);
showNotification('❌ Ошибка при запуске игры', 'error'); showNotification('❌ Ошибка при запуске игры: ' + (error.error || error.message || 'Неизвестная ошибка'), 'error');
}); });
} }