Class: KeyAcheivementsFilter
- Inherits:
-
Object
- Object
- KeyAcheivementsFilter
- Defined in:
- ext/position_filter.rb
Instance Attribute Summary collapse
-
#filter_config ⇒ Object
Returns the value of attribute filter_config.
Instance Method Summary collapse
Instance Attribute Details
#filter_config ⇒ Object
Returns the value of attribute filter_config.
3 4 5 |
# File 'ext/position_filter.rb', line 3 def filter_config @filter_config end |
Instance Method Details
#filter_achievements(achievements) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'ext/position_filter.rb', line 5 def filter_achievements(achievements) counts = Hash.new developer_not_architect = Array.new filtered = achievements.select() do |a| if !a. || a..empty? filter_config.include_untagged_achievements else a..each() { |t| counts[t] = counts[t] ? counts[t] += 1 : 1 } developer_not_architect << a if (!a..include? filter_config.primary_tag) && (a..include? filter_config.alt_tag) if (a..include? :major) true else ! ((a. & filter_config.).empty?) end end end if !counts[filter_config.primary_tag] filtered = filtered | developer_not_architect end if filtered.size < filter_config.min_achievements needed = filter_config.min_achievements - filtered.size() needed.times() { |i| filtered << achievements[i] if achievements[i] && !filtered.include?(achievements[i]) } elsif filtered.size > filter_config.max_achievements filtered = filtered.select() do |a| if !a. || a..empty? true else !a..include?(:minor) end end end filtered end |