Mercurial > hg > soundsoftware-site
comparison app/models/.svn/text-base/time_entry.rb.svn-base @ 23:ca82a3468d27 cannam
* Merge SVN update from default
author | Chris Cannam <chris.cannam@soundsoftware.ac.uk> |
---|---|
date | Fri, 24 Sep 2010 14:17:42 +0100 |
parents | 40f7cfd4df19 |
children | 94944d00e43c |
comparison
equal
deleted
inserted
replaced
21:d0cd1f6335a5 | 23:ca82a3468d27 |
---|---|
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 |