OSDN Git Service

recommend 人気ranking表示が正しくないことを修正
authorcho <cho@06daa6dd-5c14-464e-8a85-0d68c524be32>
Fri, 25 Dec 2009 07:41:27 +0000 (07:41 +0000)
committercho <cho@06daa6dd-5c14-464e-8a85-0d68c524be32>
Fri, 25 Dec 2009 07:41:27 +0000 (07:41 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/elecoma/trunk@11 06daa6dd-5c14-464e-8a85-0d68c524be32

app/models/recommend.rb

index f7d56c0..28b16e7 100644 (file)
@@ -24,11 +24,11 @@ class Recommend < ActiveRecord::Base
   end
 
   def self.ranking_get(limit = nil)
-    unless Recommend.find(:first, :conditions => ["created_at > ?",Time.zone.local_to_utc(Time.now - (60 * 60))])
+    unless Recommend.find(:first, :conditions => ["created_at > ? and product_id is null and request_type is null",Time.zone.local_to_utc(Time.now - (60 * 60))])
       self.ranking_network_get
     end
 
-    RecommendXml.find(:all,:limit => limit)
+    RecommendXml.find(:all,:conditions => ["product_id is null and request_type is null"],:limit => limit)
   end
 
   def self.recommend_network_get(product_id, type)
@@ -39,8 +39,8 @@ class Recommend < ActiveRecord::Base
 
   def self.ranking_network_get
     url = RANKING_URL
-    return  unless self.network_get(url, nil, nil, nil)
-    Recommend.create
+    return  unless self.network_get(url, ["product_id is null and request_type is null"], nil, nil)
+    Recommend.create(:product_id => nil, :request_type=>nil)
   end
 
   def self.network_get(url, delete_conditions, product_id, type)