Skip to content

Commit d4e0d19

Browse files
committed
Try to remove meteor
1 parent 3996a95 commit d4e0d19

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
@@ -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[\Ahttps://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[\Ahttps://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
134152
end

0 commit comments

Comments
 (0)