Mercurial > hg > soundsoftware-site
diff app/helpers/projects_helper.rb @ 1194:6676c0284df2 feature_564
Add "mature projects" box. This isn't good enough on its own, it's just a test -- we need this to inform other relationships
author | Chris Cannam <chris.cannam@soundsoftware.ac.uk> |
---|---|
date | Tue, 22 Jan 2013 17:03:50 +0000 |
parents | 3c9ca27c2d3d |
children | 16826c3afbba |
line wrap: on
line diff
--- a/app/helpers/projects_helper.rb Tue Jan 22 16:54:14 2013 +0000 +++ b/app/helpers/projects_helper.rb Tue Jan 22 17:03:50 2013 +0000 @@ -295,4 +295,12 @@ end phash end + + def mature_projects(count) + phash = all_maturity_scores + scores = phash.values.sort + threshold = scores[scores.length / 2] + if threshold == 0 then threshold = 1 end + phash.keys.select { |k| phash[k] > threshold }.sample(count) + end end