AOSSIE-Org / AOSSIE-Org/DebateAI
[Bug Report] Debate Outcome Not Persisted for Debate vs Bot
- Lenguaje dominante
- TypeScript
- Estrellas
- 84
- Forks
- 198
- Merge medio
- 2 d 19 h
- PR fusionados (30 d)
- 30
Descripción
## 📌 Summary
Debate outcomes for **Debate vs Bot** sessions are not being persisted in the database due to an identifier mismatch between the database schema and the update query. This causes silent failures where debate results (win/loss/draw) are never saved, breaking downstream logic such as Elo updates, analytics, and user performance tracking.
---
## 🧩 Affected Components
- **Database Layer:** `backend/db/db.go`
- **Controller:** `backend/controllers/debatevsbot_controller.go`
- **Feature Area:** Debate vs Bot → Judging & Outcome Persistence
---
## 🔍 Root Cause Analysis
The database update function filters by `userId`, while the underlying MongoDB model stores `email`. The controller passes an email string to the update function, resulting in zero documents matched and no errors surfaced.
---
However:
- The DebateVsBot MongoDB model does not store userId
- It stores the user's email instead
- The controller passes an email string to this function
- This results in:
- MongoDB update query matching zero documents
- No error returned
- Silent failure
---
## ❌ Expected Behavior
- When a Debate vs Bot session is judged:
- The corresponding debate record should be updated with the correct outcome
- The update should target the correct debate document
---
## ✅ Actual Behavior
- No document is matched
- Debate outcome is never updated
- Application behaves as if the update succeeded
---
## 🧪 Steps to Reproduce
- Start a Debate vs Bot session
- Complete the debate and trigger judging
- Check the debate_vs_bot collection in MongoDB
- Observe that the outcome field remains unchanged or missing
---
## 💥 Impact
- Breaks debate result persistence
- Corrupts user statistics
- Makes Elo calculation and performance analytics inaccurate
- Silent failure makes debugging difficult
I am willing to submit a PR.
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.