OSDN Git Service

t#30138:create original pictures status
[pettanr/pettanr.git] / app / models / original_picture.rb
index cfe8540..33de4f2 100644 (file)
@@ -56,6 +56,22 @@ class OriginalPicture < ActiveRecord::Base
     {:src => self.url, :width => tw, :height => th}
   end
   
+  def unpublished?
+    self.pictures.empty?
+  end
+  
+  def stopped?
+    self.pictures.any? and self.resource_picture == nil
+  end
+  
+  def unlicensed?
+    self.pictures.any? and self.resource_picture and self.updated_at > self.pictures.first.head.updated_at
+  end
+  
+  def published?
+    self.pictures.any? and self.resource_picture and self.updated_at < self.pictures.first.head.updated_at
+  end
+  
   def self.default_page_size
     25
   end