AOSSIE-Org / AOSSIE-Org/DebateAI

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

Ouverte Adaptée aux débutants
#395 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
bug
Langage dominant
TypeScript
Étoiles
84
Forks
198
Merge moyen
2 j 19 h
PR mergées (30 j)
30

Description

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

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
go
Domaine
backend, databases
Type d'issue
Bug
Difficulté
2/5
Temps estimé
1-3 heures
Activité
Calme
Clarté
Clairement spécifiée
Accessibilité débutants
74/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.