Store answers atomically and limit word cloud input
- Run the checks and the insert of VoteService::submit() in one transaction with the slide row locked, so double clicks or retries cannot store a vote twice (also covers the Q&A upvote budget and word cloud duplicates). - Limit word cloud terms per request and per participant, and throttle answers per IP and minute (THROTTLE_VOTES_PER_MINUTE, 429 with message). - Treat array values in text fields as empty instead of storing "Array". - Move the throttle helper to AppController for reuse. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8b0e82d806
commit
9c532d164f
11 files changed
+224
-50
No files matched your search
@@ -65,7 +65,8 @@ src/
|
||||
VoteService Validiert + speichert Antworten (alle Abstimmungsregeln hier)
|
||||
ResultsService Aggregiert Ergebnisse je Folientyp (JSON-Struktur im Docblock)
|
||||
PollStateService State-JSON für Presenter und Teilnehmende
|
||||
ThrottleService Rate-Limit pro IP (Cache 'throttle')
|
||||
ThrottleService Rate-Limit pro IP (Cache 'throttle'), in Controllern über `AppController::throttle()`:
|
||||
Anlegen/Recover pro Stunde, Antworten (`vote`) pro Minute (`THROTTLE_VOTES_PER_MINUTE`, 429)
|
||||
YouTubeService YouTube-Links/Timecodes parsen, Watch-/Embed-URLs, Prüfung per oEmbed (Http\Client)
|
||||
QaService Q&A: Phasen wechseln, Fragen nach Upvotes ranken, Fokus beim Besprechen
|
||||
SlideControlService Folien-Aktionen open/close/toggle/stage/question (Presenter und Einbettung gemeinsam)
|
||||
@@ -108,6 +109,10 @@ tests/ PHPUnit; PlenarioTestTrait erzeugt Testdaten, Fixtures
|
||||
- Teilnehmende sind anonym: nur `VoteService::participantHash()` (HMAC, pro Poll) speichern.
|
||||
- Abgestimmt werden darf nur auf der **aktuellen** Folie (`polls.current_slide_id`), bei offener Abstimmung,
|
||||
aktivem Poll und einmal pro Teilnehmer. Diese Logik gehört in `VoteService`, nicht in Controller.
|
||||
Prüfen und Speichern laufen in **einer Transaktion mit gesperrter Folienzeile** (`VoteService::lockSlide()`),
|
||||
sonst entstehen bei Doppelklick/Retry doppelte Stimmen. Neue Regeln, die vorhandene Antworten lesen, gehören in diese Transaktion.
|
||||
Request-Felder nur über `VoteService::stringField()` lesen (Arrays zählen als leer). Wortwolke: höchstens
|
||||
`MAX_WORDS_PER_REQUEST` Begriffe pro Request und `MAX_WORDS` pro Person und Folie.
|
||||
- **Ergebnisse gehören auf die Bühne, nicht aufs Endgerät.** Teilnehmende bekommen `results` nur, wo sie damit
|
||||
interagieren (Wortwolke mit Upvotes, solange offen) und als Auflösung ihrer eigenen Antwort (Quiz nach `finished`,
|
||||
Reihenfolge nach dem Schließen) – dann nur die Lösung **ohne** Zählungen/Verteilung (`PollStateService::participantResults()`
|
||||
|
||||
Reference in new issue
Block a user