reverse logic of age
This commit is contained in:
1
Gemfile
1
Gemfile
@@ -6,6 +6,7 @@ group :test do
|
||||
gem "mocha", :require => "mocha/setup"
|
||||
gem "ffaker", :git => "http://github.com/EmmanuelOga/ffaker.git"
|
||||
gem "simplecov", :require => false
|
||||
gem "testrbl"
|
||||
end
|
||||
|
||||
group :assets do
|
||||
|
||||
@@ -178,6 +178,7 @@ GEM
|
||||
rack (~> 1.0)
|
||||
tilt (~> 1.1, != 1.3.0)
|
||||
term-ansicolor (1.1.4)
|
||||
testrbl (0.2.0)
|
||||
therubyracer (0.11.4)
|
||||
libv8 (~> 3.11.8.12)
|
||||
ref
|
||||
@@ -235,6 +236,7 @@ DEPENDENCIES
|
||||
simple_form
|
||||
simplecov
|
||||
term-ansicolor
|
||||
testrbl
|
||||
therubyracer
|
||||
uglifier (>= 1.0.3)
|
||||
unicorn
|
||||
|
||||
@@ -120,7 +120,7 @@ class PostQueryBuilder
|
||||
relation = add_range_relation(q[:fav_count], "posts.fav_count", relation)
|
||||
relation = add_range_relation(q[:filesize], "posts.file_size", relation)
|
||||
relation = add_range_relation(q[:date], "posts.created_at", relation)
|
||||
relation = add_range_relation(q[:age], "extract(epoch from (CURRENT_TIMESTAMP - posts.created_at))", relation)
|
||||
relation = add_range_relation(q[:age], "extract(epoch from (posts.created_at - CURRENT_TIMESTAMP))", relation)
|
||||
relation = add_range_relation(q[:general_tag_count], "posts.tag_count_general", relation)
|
||||
relation = add_range_relation(q[:artist_tag_count], "posts.tag_count_artist", relation)
|
||||
relation = add_range_relation(q[:copyright_tag_count], "posts.tag_count_copyright", relation)
|
||||
|
||||
@@ -839,6 +839,12 @@ class PostTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
context "Searching:" do
|
||||
should "return posts for the age:<1m tag" do
|
||||
post1 = FactoryGirl.create(:post, :tag_string => "aaa")
|
||||
count = Post.tag_match("age:<1m").count
|
||||
assert_equal(1, count)
|
||||
end
|
||||
|
||||
should "return posts for the ' tag" do
|
||||
post1 = FactoryGirl.create(:post, :tag_string => "'")
|
||||
post2 = FactoryGirl.create(:post, :tag_string => "aaa bbb")
|
||||
|
||||
Reference in New Issue
Block a user