[Logilogi-svn] SF.net SVN: logilogi: [327] projects/ogog/trunk
Status: Beta
Brought to you by:
wybow
|
From: <wy...@us...> - 2007-05-28 00:07:23
|
Revision: 327
http://logilogi.svn.sourceforge.net/logilogi/?rev=327&view=rev
Author: wybow
Date: 2007-05-27 17:07:20 -0700 (Sun, 27 May 2007)
Log Message:
-----------
Fixed the 3-tags bug found by Bruno.
Modified Paths:
--------------
projects/ogog/trunk/app/models/tagging.rb
projects/ogog/trunk/db/schema.rb
projects/ogog/trunk/test/fixtures/feeds.yml
projects/ogog/trunk/test/fixtures/posts.yml
projects/ogog/trunk/test/fixtures/taggings.yml
projects/ogog/trunk/test/fixtures/tags.yml
projects/ogog/trunk/test/unit/link_test.rb
projects/ogog/trunk/test/unit/tagging_test.rb
Modified: projects/ogog/trunk/app/models/tagging.rb
===================================================================
--- projects/ogog/trunk/app/models/tagging.rb 2007-05-27 21:15:16 UTC (rev 326)
+++ projects/ogog/trunk/app/models/tagging.rb 2007-05-28 00:07:20 UTC (rev 327)
@@ -67,7 +67,7 @@
# Returns true if there exists any post for the given tags
#
def self.any_posts_for?(existing_tags)
- return Tagging.count_posts_for(existing_tags).size > 0
+ return Tagging.count_posts_for(existing_tags) > 0
end
# Counts the posts for the given tags + options.
Modified: projects/ogog/trunk/db/schema.rb
===================================================================
--- projects/ogog/trunk/db/schema.rb 2007-05-27 21:15:16 UTC (rev 326)
+++ projects/ogog/trunk/db/schema.rb 2007-05-28 00:07:20 UTC (rev 327)
@@ -7,9 +7,9 @@
create_table "feeds", :force => true do |t|
t.column "user_id", :integer
t.column "title", :string, :limit => 300
- t.column "url", :string, :default => "", :null => false
- t.column "tags_string", :string
- t.column "site_url", :string
+ t.column "url", :string, :limit => 300, :default => "", :null => false
+ t.column "tags_string", :string, :limit => 300
+ t.column "site_url", :string, :limit => 300
t.column "status", :integer, :default => 0, :null => false
t.column "harvested_publication_time", :datetime
end
@@ -24,12 +24,12 @@
end
create_table "posts", :force => true do |t|
- t.column "feed_id", :integer, :null => false
- t.column "title", :string, :limit => 1000, :default => "", :null => false
- t.column "snippet", :string, :default => "", :null => false
- t.column "body", :text, :default => "", :null => false
- t.column "url", :string, :default => "", :null => false
- t.column "published_at", :datetime, :null => false
+ t.column "feed_id", :integer, :null => false
+ t.column "title", :string, :limit => 300, :default => "", :null => false
+ t.column "snippet", :string, :limit => 300, :default => "", :null => false
+ t.column "body", :text, :default => "", :null => false
+ t.column "url", :string, :limit => 300, :default => "", :null => false
+ t.column "published_at", :datetime, :null => false
end
create_table "taggings", :force => true do |t|
Modified: projects/ogog/trunk/test/fixtures/feeds.yml
===================================================================
--- projects/ogog/trunk/test/fixtures/feeds.yml 2007-05-27 21:15:16 UTC (rev 326)
+++ projects/ogog/trunk/test/fixtures/feeds.yml 2007-05-28 00:07:20 UTC (rev 327)
@@ -27,3 +27,10 @@
url: 'http://localhost:3000/pub/test/lama/feed/feed.atom'
site_url: 'http://localhost:3000/pub/test/lama/badgedindex.html'
harvested_publication_time: nil
+ufos:
+ id: 5
+ title: 'Whos feed'
+ user_id:
+ url: 'http://www.blogger.org/ufo/feed_me'
+ site_url: 'http://www.blogger.org/ufo'
+ harvested_publication_time: nil
Modified: projects/ogog/trunk/test/fixtures/posts.yml
===================================================================
--- projects/ogog/trunk/test/fixtures/posts.yml 2007-05-27 21:15:16 UTC (rev 326)
+++ projects/ogog/trunk/test/fixtures/posts.yml 2007-05-28 00:07:20 UTC (rev 327)
@@ -42,3 +42,11 @@
body: 'This is Kevins second blog post. Yup. This is Kevins second blog post. Yup. This is Kevins second blog post. Yup. This is Kevins second blog post. Yup. This is Kevins second blog post. Yup. This is Kevins second blog post. Yup. ... ...END SNIPPET END BODY'
url: 'http://www.blogger.org/kevin/so/today'
published_at: <%= (2.days.ago).iso8601 %>
+ufos_blog_post:
+ id: 5
+ feed_id: 5
+ title: 'Unclaimed blog post'
+ snippet: 'This is an unclaimed blog post. Yup.'
+ body: 'This is an unclaimed blog post. Yup.'
+ url: 'http://www.blogger.org/ufo/so/today'
+ published_at: <%= (7.days.ago).iso8601 %>
Modified: projects/ogog/trunk/test/fixtures/taggings.yml
===================================================================
--- projects/ogog/trunk/test/fixtures/taggings.yml 2007-05-27 21:15:16 UTC (rev 326)
+++ projects/ogog/trunk/test/fixtures/taggings.yml 2007-05-28 00:07:20 UTC (rev 327)
@@ -27,45 +27,59 @@
weight: 1.1
score: 3.9
negative_as_of:
+unclaimed_blog_post_overall:
+ id: 5
+ tag_id: 1
+ post_id: 5
+ weight: 0.1
+ score: 0.4
+ negative_as_of:
eduards_blog_post_moontravel:
- id: 5
+ id: 6
tag_id: 2
post_id: 1
weight: 1.0
score: 3.0
negative_as_of:
johns_blog_post_moontravel:
- id: 6
+ id: 7
tag_id: 2
post_id: 2
weight: 1.0
score: 1.0
negative_as_of:
eduards_blog_post_rocks:
- id: 7
+ id: 8
tag_id: 3
post_id: 1
weight: 0.0
score: 0.0
negative_as_of:
johns_blog_post_rocks:
- id: 8
+ id: 9
tag_id: 3
post_id: 2
weight: 1.0
score: 1.0
negative_as_of:
eduards_blog_post_ducks:
- id: 9
+ id: 10
tag_id: 4
post_id: 1
weight: 0.5
score: -1.0
negative_as_of: <%= 1.day.ago.iso8601 %>
kevins_second_blog_post_ducks:
- id: 10
+ id: 11
tag_id: 4
post_id: 4
weight: 1.1
score: -1
negative_as_of: <%= 2.hours.ago.iso8601 %>
+unclaimed_blog_post_birds:
+ id: 12
+ tag_id: 5
+ post_id: 5
+ weight: 1
+ score: 2
+ negative_as_of:
Modified: projects/ogog/trunk/test/fixtures/tags.yml
===================================================================
--- projects/ogog/trunk/test/fixtures/tags.yml 2007-05-27 21:15:16 UTC (rev 326)
+++ projects/ogog/trunk/test/fixtures/tags.yml 2007-05-28 00:07:20 UTC (rev 327)
@@ -11,3 +11,6 @@
ducks:
id: 4
word: 'Ducks'
+birds:
+ id: 5
+ word: 'Birds'
Modified: projects/ogog/trunk/test/unit/link_test.rb
===================================================================
--- projects/ogog/trunk/test/unit/link_test.rb 2007-05-27 21:15:16 UTC (rev 326)
+++ projects/ogog/trunk/test/unit/link_test.rb 2007-05-28 00:07:20 UTC (rev 327)
@@ -42,15 +42,23 @@
moontravel = Tag.find(tags(:moontravel).id)
rocks = Tag.find(tags(:rocks).id)
ducks = Tag.find(tags(:ducks).id)
+ birds = Tag.find(tags(:birds).id)
+ # all existing
l = Link.new_from_s('moontravel/rocks/ducks')
l.resolve
assert_equal [moontravel, rocks, ducks], l.received_tags
+ # unexisting tag
l = Link.new_from_s('moontravel/rocks/planes')
l.resolve
assert_equal [moontravel, rocks], l.received_tags
+ # no post for this combination
+ l = Link.new_from_s('rocks/birds')
+ l.resolve
+ assert_equal [birds], l.received_tags
+
l = Link.new_from_s('baboons/planes')
l.resolve
assert_equal [Tag.overall], l.received_tags
Modified: projects/ogog/trunk/test/unit/tagging_test.rb
===================================================================
--- projects/ogog/trunk/test/unit/tagging_test.rb 2007-05-27 21:15:16 UTC (rev 326)
+++ projects/ogog/trunk/test/unit/tagging_test.rb 2007-05-28 00:07:20 UTC (rev 327)
@@ -64,9 +64,10 @@
moontravel = Tag.find(tags(:moontravel).id)
rocks = Tag.find(tags(:rocks).id)
ducks = Tag.find(tags(:ducks).id)
- assert_equal [overall, moontravel, rocks, ducks], Tagging.top_tags(c.link.received_tags)
+ birds = Tag.find(tags(:birds).id)
+ assert_equal [overall, moontravel, rocks, ducks, birds], Tagging.top_tags(c.link.received_tags)
assert_equal [overall, moontravel], Tagging.top_tags(c.link.received_tags, :limit => 2)
- assert_equal [ducks, moontravel, rocks, overall], Tagging.top_tags(c.link.received_tags, :order => "count ASC, word")
+ assert_equal [birds, ducks, moontravel, rocks, overall], Tagging.top_tags(c.link.received_tags, :order => "count ASC, word")
end
def test_devaluate_weights
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|