Remove per-participant word limit from word clouds
Participants can now always submit any number of words. Drops the max_words setting, its form field, the limit checks in VoteService and the remaining/limitReached state; existing max_words values in stored settings are ignored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6cc813f87b
commit
bd17a97487
10 files changed
+26
-87
No files matched your search
@@ -17,11 +17,10 @@ use Cake\Utility\Security;
|
||||
* - voting on the slide must be open
|
||||
* - every participant can answer a slide exactly once, except word clouds:
|
||||
* there words are submitted one by one (each word once per participant,
|
||||
* at most `max_words` words, 0 = unlimited). Submitting a word that already
|
||||
* any number of words). Submitting a word that already
|
||||
* exists in the cloud is an upvote – both are stored as the same row.
|
||||
* `vote=down` stores a downvote (numeric_value = DOWNVOTE) for an existing
|
||||
* word of someone else. Each participant rates a word only once (up or down);
|
||||
* downvotes do not count towards `max_words`.
|
||||
* word of someone else. Each participant rates a word only once (up or down).
|
||||
*/
|
||||
class VoteService
|
||||
{
|
||||
@@ -153,7 +152,7 @@ class VoteService
|
||||
|
||||
/**
|
||||
* Accepts `word` (string) or `words` (list). Words the participant already
|
||||
* submitted are skipped, the rest is cut to the remaining limit.
|
||||
* submitted are skipped.
|
||||
*
|
||||
* @param \App\Model\Entity\Slide $slide Slide
|
||||
* @param string $participantHash Participant hash
|
||||
@@ -193,19 +192,6 @@ class VoteService
|
||||
$words[] = $word;
|
||||
}
|
||||
|
||||
$max = (int)$slide->setting('max_words');
|
||||
if ($max > 0) {
|
||||
$remaining = max(0, $max - count($existing));
|
||||
if ($remaining === 0) {
|
||||
throw new VoteException(__n(
|
||||
'Du hast deinen Begriff bereits abgegeben.',
|
||||
'Du hast bereits alle {0} Begriffe abgegeben.',
|
||||
$max,
|
||||
$max,
|
||||
));
|
||||
}
|
||||
$words = array_slice($words, 0, $remaining);
|
||||
}
|
||||
if ($words === []) {
|
||||
throw new VoteException(match (true) {
|
||||
$duplicate => __('Diesen Begriff hast du schon genannt.'),
|
||||
|
||||
Reference in new issue
Block a user