Mercurial > hg > soundsoftware-site
comparison app/models/.svn/text-base/time_entry.rb.svn-base @ 22:40f7cfd4df19
* Update to SVN trunk rev 4173
author | Chris Cannam <chris.cannam@soundsoftware.ac.uk> |
---|---|
date | Fri, 24 Sep 2010 14:06:04 +0100 |
parents | 513646585e45 |
children | 94944d00e43c |
comparison
equal
deleted
inserted
replaced
14:1d32c0a0efbf | 22:40f7cfd4df19 |
---|---|
79 def self.visible_by(usr) | 79 def self.visible_by(usr) |
80 with_scope(:find => { :conditions => Project.allowed_to_condition(usr, :view_time_entries) }) do | 80 with_scope(:find => { :conditions => Project.allowed_to_condition(usr, :view_time_entries) }) do |
81 yield | 81 yield |
82 end | 82 end |
83 end | 83 end |
84 | |
85 def self.earilest_date_for_project(project=nil) | |
86 finder_conditions = ARCondition.new(Project.allowed_to_condition(User.current, :view_time_entries)) | |
87 if project | |
88 finder_conditions << ["project_id IN (?)", project.hierarchy.collect(&:id)] | |
89 end | |
90 TimeEntry.minimum(:spent_on, :include => :project, :conditions => finder_conditions.conditions) | |
91 end | |
92 | |
93 def self.latest_date_for_project(project=nil) | |
94 finder_conditions = ARCondition.new(Project.allowed_to_condition(User.current, :view_time_entries)) | |
95 if project | |
96 finder_conditions << ["project_id IN (?)", project.hierarchy.collect(&:id)] | |
97 end | |
98 TimeEntry.maximum(:spent_on, :include => :project, :conditions => finder_conditions.conditions) | |
99 end | |
84 end | 100 end |