aboutsummaryrefslogtreecommitdiff
path: root/poll.rb
diff options
context:
space:
mode:
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 }