AOSSIE-Org / AOSSIE-Org/DebateAI
[BUG]: UpdateDebateVsBotOutcome silently updates nothing — filters on "userId" but is passed an email
- Ngôn ngữ chính
- TypeScript
- Star
- 84
- Fork
- 198
- Merge trung bình
- 2 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 30
Mô tả
### Bug Description
`backend/controllers/debatevsbot_controller.go` line 211 calls `db.UpdateDebateVsBotOutcome` passing the user's **email**, but the update filter in `backend/db/db.go` (lines 73-76) matches on a `userId` field, while the `DebateVsBot` model stores the value under `email` (`backend/models/debatevsbot.go` line 22). The filter matches zero documents, and the error return is swallowed by an empty `if err != nil { }` block (lines 211-212).
## Impact
The bot-debate outcome record is never updated; the feature only appears to work because `SaveDebateTranscript` (line 270-279) separately persists the result. Dead write + swallowed error hides the defect.
## Suggested Fix
Align the filter field with the model (`email`), and log/propagate the error instead of discarding it.
### Steps to Reproduce
_No response_
### Logs and Screenshots
_No response_
### Environment Details
_No response_
### Impact
Critical - Application is unusable
### Code of Conduct
- [x] I have joined the [Discord server](https://discord.gg/hjUhu33uAn) and will post updates there
- [x] I have searched existing issues to avoid duplicates
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Start with backend/controllers/debatevsbot_controller.go lines 211-212, then compare the update filter in backend/db/db.go lines 73-76 with the email field in backend/models/debatevsbot.go line 22. Verify that the outcome update matches the stored identifier and that failures are no longer silently discarded; confirm the existing transcript-save flow remains intact.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- go
- Lĩnh vực
- backend, databases
- Loại issue
- Lỗi
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 74/100