rrschedule icon indicating copy to clipboard operation
rrschedule copied to clipboard

balanced_ps => false throws error in get_best_ps

Open ELepolt opened this issue 6 years ago • 0 comments

Hey man. Great gem.

schedule=RRSchedule::Schedule.new(
              :teams => [
                %w(A1 A2 A3 A4 A5 A6 A7 A8),
                %w(B1 B2 B3 B4 B5 B6 B7 B8),
                %w(C1 C2 C3 C4 C5 C6 C7 C8),
                %w(D1 D2 D3 D4 D5 D6 D7 D8),
                %w(E1 E2 E3 E4 E5 E6 E7 E8),                                                                
              ],

              :rules => [
                RRSchedule::Rule.new(
                  :wday => 3,
                  :gt => ["6:00 PM", "6:50 PM"],
                  :ps => ["North Field", "South Field"],
                )
                
              ],
              :cycles => 1,
              :start_date => Date.parse("2010/10/13"),
              :balanced_gt => false,
              :balanced_ps => false
            ).generate

This throws an error on this line: https://github.com/flamontagne/rrschedule/blob/master/lib/rrschedule.rb#L299

Debugging shows that it's only pulling the first letter, so it seems that inside the 'else' it should be @gt_ps_avail[gt].first instead of @gt_ps_avail[gt].first[0]

I know you haven't updated this in quite a while, so I'm not sure if there's an edge case that I'm missing.

I'd be happy to submit a pull request if you'd like. I've got some other ideas that I'd like to play with on this gem also.

ELepolt avatar Mar 21 '18 15:03 ELepolt