@@ -58,6 +58,16 @@ const matrix_a = [
5858 [ "A" , "o" , "xxx" , "o" , "x" , "r" ] ,
5959 [ "B" , "o" , "xxx" , "o" , "x" , "r" ] ,
6060 ]
61+
62+ const BELGRADE_INDOOR_HJ = [ // from here /en-gb/x/2022/SRB/belgradeindoor/event/F3/1/1/
63+ [ "place" , "order" , "bib" , "first_name" , "last_name" , "team" , "category" , "5.01" , "5.16" , "5.31" , "5.46" , "5.61" , "5.71" , "5.81" , "5.85" , "6" , "6.19" , "best" , "note" ] ,
64+ [ "1" , 1 , 148 , "Armand" , "DUPLANTIS" , "SWE" , "M" , "" , "" , "" , "" , "o" , "" , "" , "o" , "o" , "xxo" , 6.19 , "" ] ,
65+ [ "1" , 1 , 149 , "Emanuoil" , "KARALIS" , "GRE" , "M" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , 0 , "" ] ,
66+ [ "1" , 1 , 152 , "Robert" , "RENNER" , "SLO" , "M" , "" , "xo" , "xxo" , "xxx" , "" , "" , "" , "" , "" , "" , 5.31 , "" ] ,
67+ [ "1" , 1 , 153 , "Ivan" , "PARAVAC" , "CRO" , "M" , "o" , "o" , "xxx" , "" , "" , "" , "" , "" , "" , "" , 5.16 , "" ] ,
68+ [ "1" , 1 , 150 , "Bokai" , "HUANG" , "CHN" , "M" , "" , "" , "" , "xxx" , "" , "" , "" , "" , "" , "" , 0 , "" ] ,
69+ [ "1" , 1 , 151 , "Wenwen" , "CHEN" , "CHN" , "M" , "" , "" , "xxx" , "" , "" , "" , "" , "" , "" , "" , 0 , "" ] ,
70+ ] ;
6171
6272function createEmptyCompetition ( matrix ) {
6373 //Creates from an array similar to above; named athletes with bibs
@@ -73,18 +83,18 @@ function createEmptyCompetition(matrix){
7383
7484describe ( 'Given an instance of Athlib.HighJumpCompetition' , function ( ) {
7585 describe ( 'Tests basic creation of athletes with names and bibs' , function ( ) {
76- var c = createEmptyCompetition ( ESAA_2015_HJ ) ;
77- it ( 'last of jumpers should be named Dwyer' , ( ) => {
78- expect ( c . jumpers [ c . jumpers . length - 1 ] . last_name ) . to . be . equal ( 'Dwyer' ) ;
79- } ) ;
80- it ( 'jumpersByBib[85] should be named Maslen' , ( ) => {
81- expect ( c . jumpersByBib [ 85 ] . last_name ) . to . be . equal ( 'Maslen' ) ;
82- } ) ;
86+ var c = createEmptyCompetition ( ESAA_2015_HJ ) ;
87+ it ( 'last of jumpers should be named Dwyer' , ( ) => {
88+ expect ( c . jumpers [ c . jumpers . length - 1 ] . last_name ) . to . be . equal ( 'Dwyer' ) ;
89+ } ) ;
90+ it ( 'jumpersByBib[85] should be named Maslen' , ( ) => {
91+ expect ( c . jumpersByBib [ 85 ] . last_name ) . to . be . equal ( 'Maslen' ) ;
92+ } ) ;
8393 } ) ;
8494 describe ( 'Tests progression' , function ( ) {
85- var c = createEmptyCompetition ( ESAA_2015_HJ ) ;
86- var h1 = 1.81 ;
87- c . setBarHeight ( h1 ) ;
95+ var c = createEmptyCompetition ( ESAA_2015_HJ ) ;
96+ var h1 = 1.81 ;
97+ c . setBarHeight ( h1 ) ;
8898
8999 // round 1
90100 c . cleared ( 85 ) ;
@@ -526,4 +536,27 @@ describe('Given an instance of Athlib.HighJumpCompetition', function(){
526536 check ( "175 place 1, 193 place 1" , 'r' , 'r' , 1 , 1 ) ;
527537 check ( "175 place 1, 193 place 1" , 'x' , 'x' , 1 , 1 ) ;
528538 } ) ;
539+
540+ describe ( 'test result for BELGRADE INDOOR MEETING 2022' , function ( ) {
541+ const c = Athlib . HighJumpCompetition . fromMatrix ( BELGRADE_INDOOR_HJ ) ;
542+ c . state = 'finished' // pretend we simulated a HJ competition
543+ // console.log(c)
544+ c . _rank ( )
545+ var rank_aths = c . rankedJumpers
546+
547+ var emanuoil_karalis = rank_aths . find ( ath => ath . bib === "149" )
548+ var wenwen_chen = rank_aths . find ( ath => ath . bib === "151" )
549+
550+
551+ it ( "test ordering correct" , ( ) => { expect ( rank_aths . map ( r => r . bib ) ) . deep . to . be . equal ( [ "148" , "152" , "153" , "150" , "151" , "149" ] ) } ) ;
552+
553+ it ( "test correct calc rankingKey" , ( ) => { expect ( emanuoil_karalis . rankingKey ) . deep . to . be . equal ( [ 3 , - 0 , 0 , 0 ] ) } )
554+
555+ it ( "test athlete is eliminated" , ( ) => { expect ( wenwen_chen . eliminated ) . to . be . equal ( true ) } )
556+
557+ // athletes with no jump will be set as eliminted once the state is set to 'finished'
558+ it ( "test athlete with no jumps is eliminated" , ( ) => { expect ( emanuoil_karalis . eliminated ) . to . be . equal ( true ) } )
559+
560+
561+ } ) ;
529562} ) ;
0 commit comments