nsfw tags filtered (for now), fix to tag cleanup

This commit is contained in:
Kyle Drake 2014-10-13 18:24:14 -07:00
parent 56f2f5bfb4
commit 26c27cef49
3 changed files with 10 additions and 7 deletions

View file

@ -19,10 +19,10 @@ class Tag < Sequel::Model
end
def self.autocomplete(name, limit=3)
DB["select tags.name,count(*) as c from sites_tags inner join tags on tags.id=sites_tags.tag_id inner join sites on sites.id=sites_tags.site_id where is_deleted='f' and is_banned='f' and is_crashing='f' and site_changed='t' and tags.name != '' and tags.name LIKE ? group by tags.name having count(*) > 1 order by c desc LIMIT ?", name+'%', limit].all
DB["select tags.name,count(*) as c from sites_tags inner join tags on tags.id=sites_tags.tag_id inner join sites on sites.id=sites_tags.site_id where is_deleted='f' and is_banned='f' and is_crashing='f' and site_changed='t' and tags.is_nsfw='f' and tags.name != '' and tags.name LIKE ? group by tags.name having count(*) > 1 order by c desc LIMIT ?", name+'%', limit].all
end
def self.popular_names(limit=10)
DB["select tags.name,count(*) as c from sites_tags inner join tags on tags.id=sites_tags.tag_id where tags.name != '' group by tags.name having count(*) > 1 order by c desc LIMIT ?", limit].all
DB["select tags.name,count(*) as c from sites_tags inner join tags on tags.id=sites_tags.tag_id where tags.name != '' and tags.is_nsfw='f' group by tags.name having count(*) > 1 order by c desc LIMIT ?", limit].all
end
end