sciolyff 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/sciolyff +1 -1
- data/lib/sciolyff.rb +20 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bc0709e109b89da26d0c66d2f1f0ef69a9b2ca2f4ac729a74ac156d2bf20f5e
|
4
|
+
data.tar.gz: 1c0cd81c92947527ba549dc4bf53d0c7e6c403b090694976fc601061526c0a66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6b3e37f27e29b78df485db79c6a0ca756d56fee18f42f135aba843f7284016451d32ae1992d73e5532c4477411d39b74bcfff924013db550616d79d7cb78df7
|
7
|
+
data.tar.gz: e5ac57ff0cd5d495903ba47c09f81663b5d6c5860d2994767205cae1da2cc85f3f038483d3f378c3bc2393bcb98c2cb36e6cc5942d81582865111321b2ad34a7
|
data/bin/sciolyff
CHANGED
data/lib/sciolyff.rb
CHANGED
@@ -64,12 +64,17 @@ module SciolyFF
|
|
64
64
|
@penalties_by_team = index_array(rep[:Penalties], [:team])
|
65
65
|
end
|
66
66
|
|
67
|
+
def nonexhibition_teams
|
68
|
+
@teams_by_number.reject { |_, t| t[:exhibition] }
|
69
|
+
end
|
70
|
+
|
67
71
|
def event_points(team_number, event_name)
|
68
72
|
placing = @placings_by_event[event_name][team_number]
|
73
|
+
number_of_teams = number_of_competing_teams(event_name)
|
69
74
|
|
70
|
-
if placing[:disqualified] then
|
71
|
-
elsif placing[:participated] == false then
|
72
|
-
elsif placing[:place].nil? then
|
75
|
+
if placing[:disqualified] then number_of_teams + 2
|
76
|
+
elsif placing[:participated] == false then number_of_teams + 1
|
77
|
+
elsif placing[:place].nil? then number_of_teams
|
73
78
|
else calculate_event_points(placing)
|
74
79
|
end
|
75
80
|
end
|
@@ -93,13 +98,16 @@ module SciolyFF
|
|
93
98
|
@teams_by_number
|
94
99
|
.values
|
95
100
|
.sort do |a, b|
|
101
|
+
next 1 if a[:exhibition] && !b[:exhibition]
|
102
|
+
next -1 if !a[:exhibition] && b[:exhibition]
|
103
|
+
|
96
104
|
cmp = team_points(a[:number]) - team_points(b[:number])
|
97
105
|
cmp.zero? ? break_tie(a[:number], b[:number]) : cmp
|
98
106
|
end
|
99
107
|
end
|
100
108
|
|
101
109
|
def medal_counts(team_number)
|
102
|
-
(1..(
|
110
|
+
(1..(nonexhibition_teams.count + 2)).map do |m|
|
103
111
|
@events_by_name
|
104
112
|
.values
|
105
113
|
.reject { |e| e[:trial] || e[:trialed] }
|
@@ -119,7 +127,15 @@ module SciolyFF
|
|
119
127
|
end
|
120
128
|
end
|
121
129
|
|
130
|
+
def number_of_competing_teams(event_name)
|
131
|
+
return @teams_by_number.count if @events_by_name[event_name][:trial]
|
132
|
+
|
133
|
+
nonexhibition_teams.count
|
134
|
+
end
|
135
|
+
|
122
136
|
def calculate_event_points(placing)
|
137
|
+
return placing[:place] if @events_by_name[placing[:event]][:trial]
|
138
|
+
|
123
139
|
# Points is place minus number of exhibition teams with a better place
|
124
140
|
placing[:place] -
|
125
141
|
@placings_by_event[placing[:event]]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sciolyff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Em Zhan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|