Skip to content

Commit 718ef3c

Browse files
author
replabrobin
committed
try and fix ranking key computation; version --> 0.6.10
1 parent 67ff15d commit 718ef3c

7 files changed

Lines changed: 17 additions & 17 deletions

File tree

athlib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def __wma_delay__():
66
from .hungarian_score import score as hungarian_score
77
from .athlon_score import performance as athlon_performance_needed
88

9-
__version__ = u'0.6.9'
9+
__version__ = u'0.6.10'
1010

1111
from .exceptions import RuleViolation
1212

athlib/highjump.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def ranking_key(self) -> Tuple[int, Decimal, int, int]:
9494
failures_at_height = self.attempts_by_height[x].count('x')
9595
failures_before_and_at_height = failures_at_height + sum(_.count('x') for _ in self.attempts_by_height[:x])
9696
return (
97-
(2 if self.eliminated else 1) if x<0 else 0,
97+
(3 if x<0 else 2) if self.eliminated else (1 if x<0 else 0),
9898
- self.highest_cleared,
9999
failures_at_height,
100100
failures_before_and_at_height,

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
# built documents.
6565
#
6666
# The short X.Y version.
67-
version = u'0.6.9'
67+
version = u'0.6.10'
6868
# The full version, including alpha/beta/rc tags.
6969
release = version
7070

js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "athlib",
3-
"version": "0.6.9",
3+
"version": "0.6.10",
44
"description": "Athletics Library",
55
"main": "./index.js",
66
"scripts": {

js/src/highjump.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ function Jumper(kwds) {
9494
}
9595

9696
return [
97-
x < 0 ? (this.eliminated ? 2 : 1) : 0,
97+
this.eliminated ? (x < 0 ? 3 : 2) : (x < 0 ? 1 : 0),
9898
-this.highestCleared,
9999
failuresAtHeight,
100100
failuresBeforeAndAtHeight

js/test/highjump.spec.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ describe('Given an instance of Athlib.HighJumpCompetition', function(){
247247
}
248248
expect(r).to.be.equal(1);
249249
});
250-
it("81 is not allowed to jump again",()=>{
250+
it("B is not allowed to jump again",()=>{
251251
var r=0,e;
252252
try{
253253
c.failed('B');
@@ -268,8 +268,8 @@ describe('Given an instance of Athlib.HighJumpCompetition', function(){
268268
it("c.state == finished",()=>{expect(c.state).to.be.equal('finished')});
269269
it("A.highestCleared == 2.12",()=>{expect(A.highestCleared).to.be.equal(2.12)});
270270
it("B.highestCleared == 2.12",()=>{expect(B.highestCleared).to.be.equal(2.12)});
271-
it("A.rankingKey == [0, -2.12, 1, 2]",()=>{expect(c._compareKeys(A.rankingKey,[0, -2.12, 1, 2])).to.be.equal(0)});
272-
it("B.rankingKey == [0, -2.12, 2, 2]",()=>{expect(c._compareKeys(B.rankingKey,[0, -2.12, 2, 2])).to.be.equal(0)});
271+
it("A.rankingKey == [0, -2.12, 1, 2]",()=>{expect(c._compareKeys(A.rankingKey,[2, -2.12, 1, 2])).to.be.equal(0)});
272+
it("B.rankingKey == [0, -2.12, 2, 2]",()=>{expect(c._compareKeys(B.rankingKey,[2, -2.12, 2, 2])).to.be.equal(0)});
273273
});
274274
describe('Test total failure rank',function(){
275275
// Run through to where the jumpoff began - ninth bar position
@@ -302,7 +302,7 @@ describe('Given an instance of Athlib.HighJumpCompetition', function(){
302302
it("A.highestCleared == 2.08",()=>{expect(A.highestCleared).to.be.equal(2.08)});
303303
it("B.highestCleared == 0",()=>{expect(B.highestCleared).to.be.equal(0)});
304304
it("A.rankingKey == [0, -2.08, 0, 0]",()=>{expect(c._compareKeys(A.rankingKey,[0, -2.08, 0, 0])).to.be.equal(0)});
305-
it("B.rankingKey == [2, -0, 0, 0]",()=>{expect(c._compareKeys(B.rankingKey,[2, -0, 0, 0])).to.be.equal(0)});
305+
it("B.rankingKey == [2, -0, 0, 0]",()=>{expect(c._compareKeys(B.rankingKey,[3, -0, 0, 0])).to.be.equal(0)});
306306
});
307307
describe('Test countback to total failures',function(){
308308
// Run through to where the jumpoff began - ninth bar position
@@ -323,7 +323,7 @@ describe('Given an instance of Athlib.HighJumpCompetition', function(){
323323
}
324324
expect(r).to.be.equal(1);
325325
});
326-
it("81 is not allowed to jump again",()=>{
326+
it("B is not allowed to jump again",()=>{
327327
var r=0,e;
328328
try{
329329
c.failed('B');
@@ -344,8 +344,8 @@ describe('Given an instance of Athlib.HighJumpCompetition', function(){
344344
it("c.state == finished",()=>{expect(c.state).to.be.equal('finished')});
345345
it("A.highestCleared == 2.12",()=>{expect(A.highestCleared).to.be.equal(2.12)});
346346
it("B.highestCleared == 2.12",()=>{expect(B.highestCleared).to.be.equal(2.12)});
347-
it("A.rankingKey == [0, -2.12, 1, 2]",()=>{expect(c._compareKeys(A.rankingKey,[0, -2.12, 1, 2])).to.be.equal(0)});
348-
it("B.rankingKey == [0, -2.12, 1, 3]",()=>{expect(c._compareKeys(B.rankingKey,[0, -2.12, 1, 3])).to.be.equal(0)});
347+
it("A.rankingKey == [0, -2.12, 1, 2]",()=>{expect(c._compareKeys(A.rankingKey,[2, -2.12, 1, 2])).to.be.equal(0)});
348+
it("B.rankingKey == [0, -2.12, 1, 3]",()=>{expect(c._compareKeys(B.rankingKey,[2, -2.12, 1, 3])).to.be.equal(0)});
349349
});
350350
describe('Test won ending',function(){
351351
it("test scheduled-->started-->won-->finished",()=>{

tests/test_highjump.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ def test_countback_to_tie(self):
185185
self.assertEqual(c.state, 'finished')
186186
self.assertEqual(A.highest_cleared, Decimal("2.12"))
187187
self.assertEqual(B.highest_cleared, Decimal("2.12"))
188-
self.assertEqual(A.ranking_key,(0, Decimal('-2.12'), 1, 2))
189-
self.assertEqual(B.ranking_key,(0, Decimal('-2.12'), 2, 2))
188+
self.assertEqual(A.ranking_key,(2, Decimal('-2.12'), 1, 2))
189+
self.assertEqual(B.ranking_key,(2, Decimal('-2.12'), 2, 2))
190190

191191
def test_countback_total_failure_rank(self):
192192
"test_countback_total_failure_rank"
@@ -209,7 +209,7 @@ def test_countback_total_failure_rank(self):
209209
self.assertEqual(A.highest_cleared, Decimal("2.08"))
210210
self.assertEqual(B.highest_cleared, Decimal("0.00"))
211211
self.assertEqual(A.ranking_key,(0, Decimal('-2.08'), 0, 0))
212-
self.assertEqual(B.ranking_key,(2, Decimal('0.00'), 0, 0))
212+
self.assertEqual(B.ranking_key,(3, Decimal('0.00'), 0, 0))
213213

214214
def test_countback_to_total_failures(self):
215215
"test_countback_to_total_failures"
@@ -232,8 +232,8 @@ def test_countback_to_total_failures(self):
232232
self.assertEqual(c.state, 'finished')
233233
self.assertEqual(A.highest_cleared, Decimal("2.12"))
234234
self.assertEqual(B.highest_cleared, Decimal("2.12"))
235-
self.assertEqual(A.ranking_key,(0, Decimal('-2.12'), 1, 2))
236-
self.assertEqual(B.ranking_key,(0, Decimal('-2.12'), 1, 3))
235+
self.assertEqual(A.ranking_key,(2, Decimal('-2.12'), 1, 2))
236+
self.assertEqual(B.ranking_key,(2, Decimal('-2.12'), 1, 3))
237237

238238
def test_won_ending(self):
239239
"check the status changes at a won ending which finishes"

0 commit comments

Comments
 (0)