AOSSIE-Org / AOSSIE-Org/DebateAI

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

Abierto Apto para principiantes
#395 0 comentarios 0 reacciones 0 asignados Ver en GitHub
bug
Lenguaje dominante
TypeScript
Estrellas
84
Forks
198
Merge medio
2 d 19 h
PR fusionados (30 d)
30

Descripción

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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
go
Área
backend, databases
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Tranquilo
Claridad
Bien especificado
Aptitud para principiantes
74/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.