From 8dc6d5952974d3cd69f443e365946e19194f44aa Mon Sep 17 00:00:00 2001 From: albert Date: Tue, 19 Mar 2013 22:58:46 -0700 Subject: [PATCH] fixes #980 --- app/assets/javascripts/related_tag.js | 5 +---- app/models/artist.rb | 2 +- script/fixes/006.rb | 4 ++-- script/fixes/008.rb | 2 +- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/related_tag.js b/app/assets/javascripts/related_tag.js index 6536746fe..96255cc61 100644 --- a/app/assets/javascripts/related_tag.js +++ b/app/assets/javascripts/related_tag.js @@ -207,12 +207,9 @@ var $dest = $("#artist-tags"); $dest.empty(); - if (data.length === 0) { + if (data.length != 1) { $dest.html("No artists found"); return; - } else if (data.length > 2) { - $dest.html("Too many matching artists found"); - return; } $.each(data, function(i, json) { diff --git a/app/models/artist.rb b/app/models/artist.rb index 631180abc..5b9e56b69 100644 --- a/app/models/artist.rb +++ b/app/models/artist.rb @@ -25,7 +25,7 @@ class Artist < ActiveRecord::Base while artists.empty? && url.size > 10 u = url.sub(/\/+$/, "") + "/" u = u.to_escaped_for_sql_like.gsub(/\*/, '%') + '%' - artists += Artist.joins(:urls).where(["artists.is_active = TRUE AND artist_urls.normalized_url LIKE ? ESCAPE E'\\\\'", u]).all(:order => "artists.name") + artists += Artist.joins(:urls).where(["artists.is_active = TRUE AND artist_urls.normalized_url LIKE ? ESCAPE E'\\\\'", u]).all(:order => "artists.name").limit(10) url = File.dirname(url) + "/" break if url =~ /pixiv\.net\/$/ end diff --git a/script/fixes/006.rb b/script/fixes/006.rb index 978fa3467..aee434997 100644 --- a/script/fixes/006.rb +++ b/script/fixes/006.rb @@ -15,7 +15,7 @@ Post.where("created_at > '2013-02-01'").find_each do |post| post.update_column(:tag_count_character, post.tag_count_character) end -PoolVersion.where("post_ids like '% 1 %'").find_each do |pool_version| +PoolVersion.where("post_ids like '% 6 %'").find_each do |pool_version| cleaned_post_ids = pool_version.post_ids.scan(/(\d+) \d+/).join(" ") pool_version.update_column(:post_ids, cleaned_post_ids) -end +end; true diff --git a/script/fixes/008.rb b/script/fixes/008.rb index adee2e895..1421ffc86 100644 --- a/script/fixes/008.rb +++ b/script/fixes/008.rb @@ -6,6 +6,6 @@ ActiveRecord::Base.connection.execute("set statement_timeout = 0") ActiveRecord::Base.connection.execute("update comments set updater_id = creator_id where updater_id <> creator_id") -Tag.find_each do |tag| +Tag.where("id > 519653").find_each do |tag| tag.fix_post_count end