AOSSIE-Org / AOSSIE-Org/DebateAI

[BUG]: UpdateDebateVsBotOutcome silently updates nothing — filters on "userId" but is passed an email

未关闭 适合新手
#395 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
bug
主要语言
TypeScript
星标
84
派生
198
平均合并
2 天 19 小时
30 天内合并 PR
30

描述

### 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

贡献指南

这个仓库没有索引到贡献指南

调研方向

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.

由索引模型根据 Issue 内容生成。

评估

技术栈
go
领域
backend, databases
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
冷清
描述清晰度
描述清楚
新手友好度
74/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。