File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -243,4 +243,22 @@ namespace :oneshot do
243243 benchmark_type . benchmark_runs . where ( benchmark_result_type : time_result_type ) . delete_all
244244 end
245245 end
246+
247+ desc 'Remove duplicates'
248+ task final : :environment do
249+ BenchmarkType . all . each do |benchmark_type |
250+ unless benchmark_type . script_url . match ( %r[\A https://raw\. githubusercontent\. com/ruby-bench/ruby-bench-suite/master/ruby/benchmark/] )
251+ next
252+ end
253+
254+ original_type = BenchmarkType . where . not ( id : benchmark_type . id ) . find_by ( category : benchmark_type . category )
255+ if original_type . nil? || !original_type . script_url . match ( %r[\A https://raw.githubusercontent.com/ruby-bench/ruby-bench-suite/master/ruby/benchmarks/bm_] )
256+ next
257+ end
258+
259+ puts "benchmark_type: #{ benchmark_type . category } "
260+ BenchmarkRun . where ( benchmark_type : original_type ) . update_all ( benchmark_type_id : benchmark_type . id )
261+ BenchmarkType . where ( id : original_type . id ) . delete_all
262+ end
263+ end
246264end
You can’t perform that action at this time.
0 commit comments