Mercurial > hg > soundsoftware-site
comparison app/helpers/projects_helper.rb @ 1507:9f37f7e39d3c cannam
Fixes to the prior commit
author | Chris Cannam <chris.cannam@soundsoftware.ac.uk> |
---|---|
date | Fri, 21 Mar 2014 13:37:39 +0000 |
parents | fb773fcf9af8 |
children | afce8026aaeb |
comparison
equal
deleted
inserted
replaced
1506:fb773fcf9af8 | 1507:9f37f7e39d3c |
---|---|
311 phash = top_level_maturity_scores | 311 phash = top_level_maturity_scores |
312 scores = phash.values.sort | 312 scores = phash.values.sort |
313 threshold = scores[scores.length / 2] | 313 threshold = scores[scores.length / 2] |
314 if threshold == 0 then threshold = 1 end | 314 if threshold == 0 then threshold = 1 end |
315 mhash = Hash.new | 315 mhash = Hash.new |
316 phash.keys.select do |k| | 316 phash.keys.shuffle.select do |k| |
317 if phash[k] < threshold or k.description == "" then | 317 if phash[k] < threshold or k.description == "" then |
318 false | 318 false |
319 else | 319 else |
320 u = k.users_by_role | 320 u = k.users_by_role |
321 mgrs = [] | 321 mgrs = [] |
322 u.keys.each do |r| | 322 u.keys.each do |r| |
323 if r.allowed_to?(:edit_project) | 323 if r.allowed_to?(:edit_project) |
324 mgrs << u[r] | 324 u[r].each { |m| mgrs << m } |
325 end | 325 end |
326 end | 326 end |
327 novel = (mhash.keys & mgrs).empty? | 327 novel = (mhash.keys & mgrs).empty? |
328 mgrs.each { |m| mhash[m] = 1 } | 328 mgrs.each { |m| mhash[m] = 1 } |
329 novel and not mgrs.empty? | 329 novel and not mgrs.empty? |