Skip to content

Commit c09a10c

Browse files
committed
Remove legacy records
1 parent aab6613 commit c09a10c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

lib/tasks/temporary/oneshot.rake

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,4 +223,24 @@ namespace :oneshot do
223223
puts
224224
end
225225
end
226+
227+
desc 'Remove invalid preview2 2.6.0'
228+
task remove_26: :environment do
229+
time_result_type = BenchmarkResultType.find_by!(name: 'Execution time', unit: 'Seconds')
230+
ips_result_type = BenchmarkResultType.find_by!(name: 'Iteration per second', unit: 'i/s')
231+
232+
BenchmarkType.all.each do |benchmark_type|
233+
unless benchmark_type.script_url.match(%r[\Ahttps://raw\.githubusercontent\.com/ruby-bench/ruby-bench-suite/master/ruby/benchmark/])
234+
next
235+
end
236+
237+
original_type = BenchmarkType.where.not(id: benchmark_type.id).find_by(category: benchmark_type.category)
238+
if original_type.nil? || !original_type.script_url.match(%r[\Ahttps://raw.githubusercontent.com/ruby-bench/ruby-bench-suite/master/ruby/benchmarks/bm_])
239+
next
240+
end
241+
242+
puts "benchmark_type: #{benchmark_type.category}"
243+
benchmark_type.benchmark_runs.where(benchmark_result_type: time_result_type).delete_all
244+
end
245+
end
226246
end

0 commit comments

Comments
 (0)