Permalink
Browse files

Fixed multiple loser drop bug caused by duplicate ids when testing wi…

…th fake data.
  • Loading branch information...
1 parent ed9d5f2 commit 55f14b549bbe798fb19e6e22beeffaa0a0ca51b8 @Dishwasha Dishwasha committed May 20, 2012
Showing with 15 additions and 29 deletions.
  1. +0 −1 Gemfile
  2. +0 −15 Gemfile.lock
  3. +15 −13 app/assets/javascripts/rafflr.js
View
@@ -35,7 +35,6 @@ end
group :development, :test do
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
#gem 'ruby-debug'
- gem 'ruby-debug19', :require => 'ruby-debug'
gem 'rspec-rails'
gem 'jasmine'
gem 'jasmine-headless-webkit'
View
@@ -30,7 +30,6 @@ GEM
i18n (~> 0.6)
multi_json (~> 1.0)
addressable (2.2.7)
- archive-tar-minitar (0.5.2)
arel (3.0.0)
bcrypt-ruby (3.0.1)
builder (3.0.0)
@@ -47,7 +46,6 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.2.0)
- columnize (0.3.6)
date_validator (0.6.3)
activemodel (~> 3.0)
devise (2.0.1)
@@ -86,8 +84,6 @@ GEM
thor (~> 0.14)
json (1.6.5)
kgio (2.7.2)
- linecache19 (0.5.12)
- ruby_core_source (>= 0.1.4)
mail (2.4.1)
i18n (>= 0.4.0)
mime-types (~> 1.16)
@@ -171,17 +167,7 @@ GEM
activesupport (>= 3.0)
railties (>= 3.0)
rspec (~> 2.8.0)
- ruby-debug-base19 (0.11.25)
- columnize (>= 0.3.1)
- linecache19 (>= 0.5.11)
- ruby_core_source (>= 0.1.4)
- ruby-debug19 (0.11.6)
- columnize (>= 0.3.1)
- linecache19 (>= 0.5.11)
- ruby-debug-base19 (>= 0.11.19)
ruby-openid (2.1.8)
- ruby_core_source (0.1.5)
- archive-tar-minitar (>= 0.5.2)
rubyzip (0.9.6.1)
sass (3.1.15)
sass-rails (3.2.4)
@@ -243,7 +229,6 @@ DEPENDENCIES
pg
rails (= 3.2.0)
rspec-rails
- ruby-debug19
sass-rails
slim-rails
uglifier
@@ -31,17 +31,17 @@
});
// Uncomment to add more names to the data
- self.data = self.data.concat([
- {id: 2, name: "Bob Jones"},
- {id: 3, name: "Nancy Reed"},
- {id: 4, name: "Larry David"},
- {id: 5, name: "George Foreman"},
- {id: 6, name: "Barry Lither"},
- {id: 7, name: "Cary Grant"},
- {id: 8, name: "Penelope Cruz"},
- {id: 9, name: "Steven Segal"},
- {id: 10, name: "Rasputin"}
- ]);
+// self.data = self.data.concat([
+// {id: 20000, name: "Bob Jones"},
+// {id: 20001, name: "Nancy Reed"},
+// {id: 20002, name: "Larry David"},
+// {id: 20003, name: "George Foreman"},
+// {id: 20004, name: "Barry Lither"},
+// {id: 20005, name: "Cary Grant"},
+// {id: 20006, name: "Penelope Cruz"},
+// {id: 20007, name: "Steven Segal"},
+// {id: 20008, name: "Rasputin"}
+// ]);
var divElem = d3.select(".page");
@@ -141,13 +141,13 @@
_bootLosers: function() {
var self = this;
var selection = self.svg.selectAll("g");
- // Set bounding box property so we know what the text size is
+ // Set bounding box property so we know what the text size is
self.svg.selectAll("g").each(function(d, i) {
d.bbox = this.getBBox();
});
- self.data.splice(Math.floor(Math.random() * selection[0].length), 1);
+ self.data.splice(Math.floor(Math.random() * self.data.length), 1);
selection.data(self.data, function(d) { return d.id; })
.exit()
.transition()
@@ -175,6 +175,8 @@
var scale = 2;
+ $("button.start").html("Restart");
+
self.data = _.shuffle(self.data);
selection.sort(function(a, b) {
var aIndex = self.data.indexOf(a);

0 comments on commit 55f14b5

Please sign in to comment.