rrschedule 0.2.8 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/rrschedule.rb +8 -9
- metadata +3 -5
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            0.2. | 
| 1 | 
            +
            0.2.9
         | 
    
        data/lib/rrschedule.rb
    CHANGED
    
    | @@ -219,9 +219,9 @@ module RRSchedule | |
| 219 219 | 
             
                  @gt_ps_avail = {}
         | 
| 220 220 | 
             
                  @cur_rule.gt.each do |gt|
         | 
| 221 221 | 
             
                    @gt_ps_avail[gt] = @cur_rule.ps.clone
         | 
| 222 | 
            -
                  end | 
| 222 | 
            +
                  end
         | 
| 223 223 | 
             
                end
         | 
| 224 | 
            -
             | 
| 224 | 
            +
             | 
| 225 225 | 
             
                def dispatch_game(game)
         | 
| 226 226 | 
             
                  if @cur_rule.nil?
         | 
| 227 227 | 
             
                    @cur_rule = @rules.select{|r| r.wday >= self.start_date.wday}.first || @rules.first
         | 
| @@ -238,11 +238,9 @@ module RRSchedule | |
| 238 238 | 
             
                  @stats[game.team_b][:gt][@cur_gt] += 1
         | 
| 239 239 | 
             
                  @stats[game.team_b][:ps][@cur_ps] += 1
         | 
| 240 240 |  | 
| 241 | 
            -
                  @gt_ps_avail[@cur_gt].delete(@cur_ps) #this playing surface has now been taken and is not available
         | 
| 242 | 
            -
                  
         | 
| 243 241 | 
             
                  @cur_date ||= next_game_date(self.start_date,@cur_rule.wday)
         | 
| 244 242 | 
             
                  @schedule ||= []
         | 
| 245 | 
            -
             | 
| 243 | 
            +
             | 
| 246 244 | 
             
                  #if one of the team has already plays at this gamedate, we change rule
         | 
| 247 245 | 
             
                  if @schedule.size>0
         | 
| 248 246 | 
             
                    games_this_date = @schedule.select{|v| v[:gamedate] == @cur_date}
         | 
| @@ -251,17 +249,18 @@ module RRSchedule | |
| 251 249 | 
             
                      @cur_rule = @rules[@cur_rule_index]
         | 
| 252 250 | 
             
                      reset_resource_availability
         | 
| 253 251 | 
             
                      @cur_gt = get_best_gt(game)
         | 
| 254 | 
            -
                      @cur_ps = get_best_ps(game,@cur_gt) | 
| 255 | 
            -
                      @cur_date = next_game_date(@cur_date+=1,@cur_rule.wday) | 
| 252 | 
            +
                      @cur_ps = get_best_ps(game,@cur_gt)
         | 
| 253 | 
            +
                      @cur_date = next_game_date(@cur_date+=1,@cur_rule.wday)
         | 
| 256 254 | 
             
                    end
         | 
| 257 | 
            -
                  end | 
| 255 | 
            +
                  end
         | 
| 258 256 |  | 
| 259 257 | 
             
                  @schedule << {:team_a => game.team_a, :team_b => game.team_b, :gamedate => @cur_date, :ps => @cur_ps, :gt => @cur_gt}
         | 
| 258 | 
            +
                  @gt_ps_avail[@cur_gt].delete(@cur_ps) #this playing surface has now been taken and is not available
         | 
| 260 259 |  | 
| 261 260 | 
             
                  x = @gt_ps_avail.reject{|k,v| v.empty?}
         | 
| 262 261 |  | 
| 263 262 | 
             
                  #no resources left, change rule
         | 
| 264 | 
            -
                  if x.empty? | 
| 263 | 
            +
                  if x.empty?
         | 
| 265 264 | 
             
                    if @cur_rule_index < @rules.size-1
         | 
| 266 265 | 
             
                      last_rule=@cur_rule
         | 
| 267 266 | 
             
                      @cur_rule_index += 1
         | 
    
        metadata
    CHANGED
    
    | @@ -2,7 +2,7 @@ | |
| 2 2 | 
             
            name: rrschedule
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 4 | 
             
              prerelease: 
         | 
| 5 | 
            -
              version: 0.2. | 
| 5 | 
            +
              version: 0.2.9
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors: 
         | 
| 8 8 | 
             
            - flamontagne
         | 
| @@ -10,8 +10,7 @@ autorequire: | |
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 12 |  | 
| 13 | 
            -
            date: 2011-09- | 
| 14 | 
            -
            default_executable: 
         | 
| 13 | 
            +
            date: 2011-09-27 00:00:00 Z
         | 
| 15 14 | 
             
            dependencies: 
         | 
| 16 15 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 17 16 | 
             
              name: thoughtbot-shoulda
         | 
| @@ -44,7 +43,6 @@ files: | |
| 44 43 | 
             
            - test/helper.rb
         | 
| 45 44 | 
             
            - test/test_rrschedule.rb
         | 
| 46 45 | 
             
            - test_schedule.rb
         | 
| 47 | 
            -
            has_rdoc: true
         | 
| 48 46 | 
             
            homepage: http://flamontagne.github.com/rrschedule
         | 
| 49 47 | 
             
            licenses: []
         | 
| 50 48 |  | 
| @@ -68,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 68 66 | 
             
            requirements: []
         | 
| 69 67 |  | 
| 70 68 | 
             
            rubyforge_project: 
         | 
| 71 | 
            -
            rubygems_version: 1. | 
| 69 | 
            +
            rubygems_version: 1.8.7
         | 
| 72 70 | 
             
            signing_key: 
         | 
| 73 71 | 
             
            specification_version: 3
         | 
| 74 72 | 
             
            summary: Round-Robin schedule generator
         |