sciolyff 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d5ec2c0585165bf939d3c1a0d0e06ae9d0637bac8238503812f6ec67f38f6f7f
4
- data.tar.gz: c1b9677e272ea7122764b1eda7cfcbc27845f8689f100ac300b791c9581bf21c
3
+ metadata.gz: 74380d58f61826da4bbad588cc070e9481eacd0a9ef6d616f49dfd5317e0adc5
4
+ data.tar.gz: cfe690c2ae95fac42b83c91579b5ab8eddde9743d56965b1d2286aacb03255e9
5
5
  SHA512:
6
- metadata.gz: 69d6e735996ad66876c88ed4a7f2a4a0bbe018439fcc961ca57fcb41c2bdc677de94ec829a9ca0cf4639486d6897195f11101fd4ba264fcf7f1538326027461e
7
- data.tar.gz: 7ae20bba7f1bac075d0bfe7c8bd2fff30e079c89c405ef472ca003b325b77a689b865a5f38486f5432e11e484e2062c9867dfdb8cd4647cff7684cb61a01e97f
6
+ metadata.gz: 5892e8769e1f9d2b344a942781f0d10f3f9c84588db6d3418f3dc63d6a2454ac1e1bfe7ffb7ed078855f448d47fd1ec31187e1a594820162bf3bb4d57f850188
7
+ data.tar.gz: bd57a2f55c107ed9ffdb181ea4b4f303f03563c607f13a70010294d9c7836c725680a231fe395fc7e365f501379e87e10ab0582c0a9c0cfc1e75f8014cf381a6
data/README.md CHANGED
@@ -31,7 +31,7 @@ official releases, build from source:
31
31
  ```
32
32
  git clone https://github.com/unosmium/sciolyff.git && cd sciolyff
33
33
  gem build sciolyff.gemspec
34
- gem install ./sciolyff-0.11.0.gem
34
+ gem install ./sciolyff-0.12.0.gem
35
35
  ```
36
36
 
37
37
  ## Usage
@@ -89,5 +89,5 @@ A fuller example can be found here in the code for the Unosmium Results website,
89
89
  found
90
90
  [here](https://github.com/unosmium/unosmium.org/blob/master/source/results/template.html.erb).
91
91
  There is also of course the
92
- [documentation](https://www.rubydoc.info/gems/sciolyff/0.11.0), a bit sparse
92
+ [documentation](https://www.rubydoc.info/gems/sciolyff/0.12.0), a bit sparse
93
93
  currently.
@@ -5,7 +5,7 @@ require 'optimist'
5
5
  require 'sciolyff'
6
6
 
7
7
  opts = Optimist.options do
8
- version 'sciolyff 0.11.0'
8
+ version 'sciolyff 0.12.0'
9
9
  banner <<~STRING
10
10
  Checks if a given file is in the Scioly File Format
11
11
 
@@ -44,7 +44,7 @@ module SciolyFF
44
44
  if trial?
45
45
  placings.size
46
46
  elsif tournament.per_event_n?
47
- [competing_teams_count, tournament.maximum_place].min
47
+ [per_event_maximum_place, tournament.maximum_place].min
48
48
  else
49
49
  tournament.maximum_place
50
50
  end
@@ -56,10 +56,18 @@ module SciolyFF
56
56
 
57
57
  private
58
58
 
59
+ def per_event_maximum_place
60
+ return competing_teams_count if tournament.per_event_n == 'participation'
61
+
62
+ placings.map(&:place).compact.max + 1
63
+ end
64
+
59
65
  def competing_teams_count
60
- return placings.count { |p| !p.place.nil? } if trial?
66
+ return placings.count(&:participated?) if trial?
61
67
 
62
- placings.count { |p| !(p.team.exhibition? || p.exempt? || p.place.nil?) }
68
+ placings.count do |p|
69
+ p.participated? && !(p.team.exhibition? || p.exempt?)
70
+ end
63
71
  end
64
72
  end
65
73
  end
@@ -87,8 +87,12 @@ module SciolyFF
87
87
  nonexhibition_teams_count
88
88
  end
89
89
 
90
+ def per_event_n
91
+ @rep[:'per-event n']
92
+ end
93
+
90
94
  def per_event_n?
91
- @rep[:'per-event n'] || false
95
+ @rep.key? :'per-event n'
92
96
  end
93
97
 
94
98
  def n_offset
@@ -28,7 +28,7 @@ module SciolyFF
28
28
  'worst placings dropped': Integer,
29
29
  'exempt placings': Integer,
30
30
  'maximum place': Integer,
31
- 'per-event n': [true, false],
31
+ 'per-event n': %w[place participation],
32
32
  'n offset': Integer
33
33
  }.freeze
34
34
 
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.license = 'MIT'
10
10
  s.name = 'sciolyff'
11
11
  s.summary = 'A file format for Science Olympiad tournament results.'
12
- s.version = '0.11.0'
12
+ s.version = '0.12.0'
13
13
  s.executables << 'sciolyff'
14
14
  s.add_runtime_dependency 'erubi', '~> 1.9'
15
15
  s.add_runtime_dependency 'optimist', '~> 3.0'
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.11.0
4
+ version: 0.12.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: 2020-05-09 00:00:00.000000000 Z
11
+ date: 2020-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: erubi