Sha256: 2c684692c7ca80f0c31ed497535f434424fabc07c172abd3eade78e68afa3864

Contents?: true

Size: 614 Bytes

Versions: 1

Compression:

Stored size: 614 Bytes

Contents

route = Route.first
Infinity = (1.0/0)

def los_labels
    ->(label){
      range = label.match(/(?<begin>\-?\d+)?(?<separator>[\-\<])?(?<end>\-?\d+)?/)
      case range[:separator]
      when '<'
        "#{range[:end]}+"
      when '-'
        "#{range[:begin]} to #{range[:end]}"
      else
        label
      end
    }
  end

los_agg = Aggrobot.start(route.passengers) do |attrs|
  hash do
    group_by :length_of_stay, limit_to: 4, sort_by: count, other_group: 'others'
    set advance: :ap, ptype: :pax_type, pct: percent(count, attrs[:count])
    
    each_group do |attrs| 
      attrs
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aggrobot-0.1.0 lib/aggrobot/query_planner/agg.rb