Skip to content

Commit da8e327

Browse files
committed
Final conversion
1 parent c09a10c commit da8e327

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

lib/tasks/temporary/oneshot.rake

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff 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[\Ahttps://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[\Ahttps://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
246264
end

0 commit comments

Comments
 (0)