rrschedule 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +11 -8
- data/VERSION +1 -1
- data/lib/rrschedule.rb +8 -14
- data/rrschedule.gemspec +1 -1
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
= rrschedule
|
2
2
|
|
3
|
-
|
3
|
+
rrschedule makes it easier to generate Round-Robin schedules for sport leagues. To generate a schedule, it needs a team list, a season
|
4
4
|
start date, the day(s) of the week where the games are played and some other options.
|
5
5
|
|
6
6
|
It takes into consideration physical constraints such as the number of playing surfaces availables and game times.
|
7
|
-
Each round of the round-robin is splitted into
|
7
|
+
Each round of the round-robin is splitted into multiple gamedays that respect these constraints.
|
8
8
|
|
9
9
|
Say for example that you want to generate a round-robin schedule for your 15-teams volleyball league.
|
10
10
|
If there are only 3 volleyball fields available and that games are played each monday at 6PM and 8PM, this is technically
|
11
|
-
impossible to complete one round in a single day
|
12
|
-
|
11
|
+
impossible to complete one round in a single day. rrschedule will put the remaining games of this round on the next gameday
|
12
|
+
and will start a new round right after.
|
13
13
|
|
14
14
|
|
15
15
|
== Installation
|
16
|
-
gem install rrschedule
|
16
|
+
gem install rrschedule
|
17
17
|
require 'rrschedule.rb'
|
18
18
|
|
19
19
|
== Prepare the schedule
|
@@ -85,7 +85,7 @@ for this round on the next gameday and will start a new round right after.
|
|
85
85
|
puts g.game_date.to_s + " on playing surface " + g.playing_surface.to_s + " at " + g.game_time.to_s
|
86
86
|
end
|
87
87
|
|
88
|
-
=== Iterate
|
88
|
+
=== Iterate through schedule
|
89
89
|
schedule.gamedays.each do |gd,games|
|
90
90
|
puts gd
|
91
91
|
puts "===================="
|
@@ -94,7 +94,10 @@ for this round on the next gameday and will start a new round right after.
|
|
94
94
|
end
|
95
95
|
puts "\n"
|
96
96
|
end
|
97
|
+
|
98
|
+
== Other
|
97
99
|
|
98
|
-
|
100
|
+
Hope this gem will be useful to some people!
|
101
|
+
As you can see, there are no tests yet but they should come quite soon.
|
99
102
|
|
100
|
-
|
103
|
+
You can read my blog here: www.rubyfleebie.com
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/lib/rrschedule.rb
CHANGED
@@ -10,7 +10,14 @@ module RRSchedule
|
|
10
10
|
attr_reader :teams, :rounds
|
11
11
|
|
12
12
|
def initialize(params={})
|
13
|
-
|
13
|
+
self.teams = params[:teams] || [1,2,3,4,5]
|
14
|
+
self.playing_surfaces = params[:playing_surfaces] || ["--"]
|
15
|
+
self.cycles = params[:cycles] || 1
|
16
|
+
self.game_times = params[:game_times] || ["7:00 PM"]
|
17
|
+
self.shuffle_initial_order = params[:shuffle_initial_order] || true
|
18
|
+
self.exclude_dates = params[:exclude_dates] || []
|
19
|
+
self.start_date = params[:start_date] || Time.now.beginning_of_day
|
20
|
+
self.wdays = Array(params[:wdays]).empty? ? [1] : Array(params[:wdays])
|
14
21
|
end
|
15
22
|
|
16
23
|
|
@@ -137,19 +144,6 @@ module RRSchedule
|
|
137
144
|
def games_per_day
|
138
145
|
self.playing_surfaces.size * self.game_times.size
|
139
146
|
end
|
140
|
-
|
141
|
-
def store_params(params)
|
142
|
-
self.teams = params[:teams] if params[:teams].respond_to?(:to_ary)
|
143
|
-
self.playing_surfaces = params[:playing_surfaces] if params[:playing_surfaces].respond_to?(:to_ary)
|
144
|
-
self.cycles = params[:cycles] if params[:cycles].respond_to?(:to_int)
|
145
|
-
self.game_times = params[:game_times] if params[:game_times].respond_to?(:to_ary)
|
146
|
-
self.shuffle_initial_order = params[:shuffle_initial_order]
|
147
|
-
self.exclude_dates = params[:exclude_dates] || []
|
148
|
-
self.start_date = params[:start_date] || Time.now.beginning_of_day
|
149
|
-
self.wdays = Array(params[:wdays]) if params[:wdays].respond_to?(:to_ary) || params[:wdays].respond_to?(:to_int)
|
150
|
-
end
|
151
|
-
|
152
|
-
|
153
147
|
end
|
154
148
|
|
155
149
|
class Game
|
data/rrschedule.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rrschedule
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- flamontagne
|