aboutsummaryrefslogtreecommitdiff
path: root/poll.rb
diff options
context:
space:
mode:
authorBenjamin Kellermann <Benjamin.Kellermann@gmx.de>2008-12-22 23:27:28 +0100
committerBenjamin Kellermann <Benjamin.Kellermann@gmx.de>2008-12-22 23:27:28 +0100
commit7454ff48164046d37da97146e44fb01c9b666154 (patch)
treec670d7d1a40cbd358500b2fe41aeb39eb600a617 /poll.rb
parente72e04f993de52178c148ebc9ee80d55c8b4aaff (diff)
count Anonymous participants
Diffstat (limited to 'poll.rb')
-rw-r--r--poll.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/poll.rb b/poll.rb
index 97aabe8..d706804 100644
--- a/poll.rb
+++ b/poll.rb
@@ -174,7 +174,8 @@ END
def add_participant(name, agreed)
htmlname = CGI.escapeHTML(name.strip)
if htmlname == ""
- htmlname = "Anonymous ##{rand(1000)}"
+ maximum = @data.keys.collect{|e| e.scan(/^Anonymous #(\d*)/).flatten[0]}.compact.collect{|i| i.to_i}.max
+ htmlname = "Anonymous ##{maximum + 1}"
name = htmlname
end
@data[htmlname] = {"timestamp" => Time.now }