Mercurial > hg > soundsoftware-site
comparison app/models/.svn/text-base/version.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 | af80e5618e9b |
comparison
equal
deleted
inserted
replaced
14:1d32c0a0efbf | 22:40f7cfd4df19 |
---|---|
71 | 71 |
72 # Returns true if the version is completed: due date reached and no open issues | 72 # Returns true if the version is completed: due date reached and no open issues |
73 def completed? | 73 def completed? |
74 effective_date && (effective_date <= Date.today) && (open_issues_count == 0) | 74 effective_date && (effective_date <= Date.today) && (open_issues_count == 0) |
75 end | 75 end |
76 | |
77 def behind_schedule? | |
78 if completed_pourcent == 100 | |
79 return false | |
80 elsif due_date && fixed_issues.present? && fixed_issues.minimum('start_date') # TODO: should use #start_date but that method is wrong... | |
81 start_date = fixed_issues.minimum('start_date') | |
82 done_date = start_date + ((due_date - start_date+1)* completed_pourcent/100).floor | |
83 return done_date <= Date.today | |
84 else | |
85 false # No issues so it's not late | |
86 end | |
87 end | |
76 | 88 |
77 # Returns the completion percentage of this version based on the amount of open/closed issues | 89 # Returns the completion percentage of this version based on the amount of open/closed issues |
78 # and the time spent on the open issues. | 90 # and the time spent on the open issues. |
79 def completed_pourcent | 91 def completed_pourcent |
80 if issues_count == 0 | 92 if issues_count == 0 |
121 end | 133 end |
122 @wiki_page | 134 @wiki_page |
123 end | 135 end |
124 | 136 |
125 def to_s; name end | 137 def to_s; name end |
138 | |
139 def to_s_with_project | |
140 "#{project} - #{name}" | |
141 end | |
126 | 142 |
127 # Versions are sorted by effective_date and "Project Name - Version name" | 143 # Versions are sorted by effective_date and "Project Name - Version name" |
128 # Those with no effective_date are at the end, sorted by "Project Name - Version name" | 144 # Those with no effective_date are at the end, sorted by "Project Name - Version name" |
129 def <=>(version) | 145 def <=>(version) |
130 if self.effective_date | 146 if self.effective_date |