amfoss / amfoss/ammingo-backend
Tiles can't be marked, it always shows an error "Friend has already been submitted"
- 主要語言
- Python
- 星號
- 2
- 分支
- 4
- 平均合併
- 1 小時 11 分鐘
- 30 天內合併 PR
- 7
描述
### Problem
Submitting any tile in a game always fails with "Friend has already been submitted", even on fresh, never-used tiles. Tiles never get marked and points never accumulate.
### Steps to reproduce
1. Create a game (user A), join with a second account (user B), start the game
2. Open any tile and add a photo
3. Enter friend B's exact name and code, tap "VERIFY AND MARK TILE"
4. The "Friend has already been submitted" error always appears, whatever the tile
### Root cause
In `app/routes/game.py`, `friend_already_submitted` holds a SQLAlchemy `Query` object rather than the query result. A `Query` object is always truthy, so that check raises every time before the tile is saved. `tile.friend_id` is also never set, so the duplicate-friend check wouldn't catch anything regardless.
### Expected behaviour
- First submission marks the tile and updates points
- Reusing the same friend is rejected
- Submitting the same tile twice is rejected
貢獻指南
這個儲存庫沒有索引到貢獻指南
研究方向
Start in app/routes/game.py and inspect the friend_already_submitted check and the tile-saving path. Verify that the duplicate-friend query is evaluated as a result and that tile.friend_id is set before saving. Done means a first submission marks the tile and updates points, reusing a friend is rejected, and submitting the same tile twice is rejected.
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python, sqlalchemy
- 領域
- backend
- Issue 類型
- 缺陷
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 活躍度
- 活躍
- 描述清晰度
- 描述清楚
- 新手友好度
- 85/100