app/actions/dupe.rb in hydroponics-0.3.0 vs app/actions/dupe.rb in hydroponics-0.3.1

- old
+ new

@@ -6,17 +6,16 @@ first_row = @db[table].first first_row.delete(:id) current_count = @db[table].count - time1 = Time.now if target_count > current_count @db[table].multi_insert([first_row] * (target_count - current_count)) - else - @db[table].filter("id > #{target_count}").delete + elsif current_count > target_count + cutoff_id = @db[table].map(:id)[target_count-1] + @db[table].filter("id > #{cutoff_id}").delete end - time2 = Time.now - (time2 - time1).to_s + 's' + @db[table].count.to_s end end end \ No newline at end of file