Created
October 21, 2008 01:55
-
-
Save rumblex/18231 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Settings.voting_begin = Time.now.to_s | |
| Competition.setup! | |
| def doit(iterations = 10) | |
| total_time = 0.0 | |
| count = 0 | |
| iterations.times do | |
| entry = Entry.find(:first, :order => 'RAND()') | |
| user = User.find(:first, :order => 'RAND()') | |
| user.can_rate(entry) | |
| ratings = { | |
| 'appearance' => rand(5) + 1, | |
| 'completeness' => rand(5) + 1, | |
| 'innovation' => rand(5) + 1, | |
| 'usefulness' => rand(5) + 1, | |
| } | |
| ts = Time.new | |
| ratings.each do |cat, value| | |
| entry.rate(value.to_i, :category => cat, :user => user) | |
| count += 1 | |
| end | |
| tf = Time.new | |
| total_time += tf.to_f - ts.to_f | |
| end | |
| puts "#{count} Ratings added in #{total_time.to_s}" | |
| end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment