File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -131,4 +131,22 @@ namespace :oneshot do
131131 puts
132132 end
133133 end
134+
135+ desc 'Remove invalid meteor'
136+ task remove_meteor : :environment do
137+ time_result_type = BenchmarkResultType . find_by! ( name : 'Execution time' , unit : 'Seconds' )
138+ ips_result_type = BenchmarkResultType . find_by! ( name : 'Iteration per second' , unit : 'i/s' )
139+
140+ BenchmarkType . where ( category : 'so_meteor_contest' ) . each do |benchmark_type |
141+ unless benchmark_type . script_url . match ( %r[\A https://raw\. githubusercontent\. com/ruby-bench/ruby-bench-suite/master/ruby/benchmark/.+\. rb\z ] )
142+ next
143+ end
144+
145+ original_type = BenchmarkType . where . not ( id : benchmark_type . id ) . find_by ( category : benchmark_type . category )
146+ if original_type . nil? || !original_type . script_url . match ( %r[\A https://raw.githubusercontent.com/ruby-bench/ruby-bench-suite/master/ruby/benchmarks/bm_] )
147+ next
148+ end
149+ original_type . benchmark_runs . where ( benchmark_result_type : time_result_type ) . delete_all
150+ end
151+ end
134152end
You can’t perform that action at this time.
0 commit comments