basketball 0.0.16 → 0.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/basketball/app/room_repository.rb +12 -5
- data/lib/basketball/draft/event.rb +3 -3
- data/lib/basketball/draft/pick.rb +1 -3
- data/lib/basketball/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f2c7326c8bfa26bcedb1ccbedec191db4681bed0831d5f37bb7691782a12ae4
|
4
|
+
data.tar.gz: c22558bd6733383f7926ee33506b86eb9bb8f4fa0807d8eb246d8a8b2912041b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f04c5f0691974ae8750d3e66eaf2be925b792b771201ee727313e3f678ca7712f2f5e22878486a682cf17c0a31cac3f38428e5a1eae7337a5b0b7929596cbc22
|
7
|
+
data.tar.gz: 1b6a61df353c5c4ec77935cd4a406839be050eed15ccd5f3f6c79aca701b2ed5ad09cb66efb4fda4f098e2e3fd75c76596170ed8359c2f5b6abbdc4b7ac8c194
|
@@ -66,6 +66,7 @@ module Basketball
|
|
66
66
|
|
67
67
|
def serialize_pick(event)
|
68
68
|
{
|
69
|
+
id: event.id || event.pick,
|
69
70
|
type: PICK_EVENT,
|
70
71
|
front_office: event.front_office.id,
|
71
72
|
pick: event.pick,
|
@@ -78,6 +79,7 @@ module Basketball
|
|
78
79
|
|
79
80
|
def serialize_skip(event)
|
80
81
|
{
|
82
|
+
id: event.id || event.pick,
|
81
83
|
type: SKIP_EVENT,
|
82
84
|
front_office: event.front_office.id,
|
83
85
|
pick: event.pick,
|
@@ -141,11 +143,16 @@ module Basketball
|
|
141
143
|
front_office_id = hash[:front_office]
|
142
144
|
front_office = front_offices.find { |fo| fo.id == front_office_id }
|
143
145
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
146
|
+
event =
|
147
|
+
case hash[:type]
|
148
|
+
when PICK_EVENT
|
149
|
+
deserialize_pick(hash, players:, front_office:)
|
150
|
+
when SKIP_EVENT
|
151
|
+
deserialize_skip(hash, front_office:)
|
152
|
+
end
|
153
|
+
|
154
|
+
event.tap do |e|
|
155
|
+
e.send('id=', hash[:id])
|
149
156
|
end
|
150
157
|
end
|
151
158
|
end
|
@@ -3,8 +3,8 @@
|
|
3
3
|
module Basketball
|
4
4
|
module Draft
|
5
5
|
# Describes what all Room events have to have to be considered an "event".
|
6
|
-
class Event <
|
7
|
-
|
6
|
+
class Event < Entity
|
7
|
+
attr_reader :pick, :round, :round_pick, :front_office
|
8
8
|
|
9
9
|
def initialize(front_office:, pick:, round:, round_pick:)
|
10
10
|
super()
|
@@ -18,7 +18,7 @@ module Basketball
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def to_s
|
21
|
-
"[##{pick} R:#{round} P:#{round_pick}
|
21
|
+
"[#{id}] ##{pick} R:#{round} P:#{round_pick} - #{front_office}"
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -4,7 +4,7 @@ module Basketball
|
|
4
4
|
module Draft
|
5
5
|
# Room event where a player is selected.
|
6
6
|
class Pick < Event
|
7
|
-
|
7
|
+
attr_reader :player, :auto
|
8
8
|
|
9
9
|
def initialize(front_office:, player:, pick:, round:, round_pick:, auto: false)
|
10
10
|
super(front_office:, pick:, round:, round_pick:)
|
@@ -13,8 +13,6 @@ module Basketball
|
|
13
13
|
|
14
14
|
@player = player
|
15
15
|
@auto = auto
|
16
|
-
|
17
|
-
freeze
|
18
16
|
end
|
19
17
|
|
20
18
|
def to_s
|
data/lib/basketball/version.rb
CHANGED