🌊 Волна 10: backend client-controlled + лимиты (5 багов)
- client_controlled_hints_game: hints_used из user_progress (game.py + database.py) - client_controlled_hints_bubblewords: current_hints_used из bubble_words_progress (bubblewords.py + database.py) - client_controlled_mistakes_wordquiz: current_mistakes из word_quiz_progress (wordquiz.py + database.py) - sentence_hint_no_limit: таблица sentence_hints_used + лимит 1 раз (sentences.py + database.py) - typing_hint_no_limit: таблица typing_hints_used + лимит 1 раз (typing.py + database.py) Аудит v2: Issue #5, backend 5/10 задач
This commit is contained in:
@@ -20,6 +20,21 @@ async def get_sentence_hint(sentence_id: int, request: Request):
|
||||
if not row:
|
||||
raise HTTPException(404, "Sentence not found")
|
||||
|
||||
# 🔧 ФИКС (24.09.2026): sentence_hint_no_limit — лимит 1 раз на предложение.
|
||||
already_used = await conn.fetchval(
|
||||
"SELECT 1 FROM sentence_hints_used WHERE user_id = $1 AND sentence_id = $2",
|
||||
telegram_id, sentence_id
|
||||
)
|
||||
if already_used:
|
||||
raise HTTPException(403, "Hint already used for this sentence")
|
||||
|
||||
# Записываем использование
|
||||
await conn.execute("""
|
||||
INSERT INTO sentence_hints_used (user_id, sentence_id)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (user_id, sentence_id) DO NOTHING
|
||||
""", telegram_id, sentence_id)
|
||||
|
||||
return {
|
||||
"sentence_pl": row["sentence_pl"],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user