private List < Fight > parseEventFights ( Elements trs , Event event ) { SherdogBaseObject sEvent = new SherdogBaseObject ( ) ; sEvent . setName ( event . getName ( ) ) ; sEvent . setSherdogUrl ( event . getSherdogUrl ( ) ) ; List < Fight > fights = new ArrayList <> ( ) ; if ( trs . size ( ) > 0 ) { trs . remove ( 0 ) ; trs . forEach ( tr -> { Fight fight = new Fight ( ) ; fight . setEvent ( sEvent ) ; fight . setDate ( event . getDate ( ) ) ; Elements tds = tr . select ( "td" ) ; fight . setFighter1 ( getFighter ( tds . get ( FIGHTER1_COLUMN ) ) ) ; fight . setFighter2 ( getFighter ( tds . get ( FIGHTER2_COLUMN ) ) ) ; //parsing old fight, we can get the result if ( tds . size ( ) == 7 ) { fight . setResult ( getResult ( tds . get ( FIGHTER1_COLUMN ) ) ) ; fight . setWinMethod ( getMethod ( tds . get ( METHOD_COLUMN ) ) ) ; fight . setWinRound ( getRound ( tds . get ( ROUND_COLUMN ) ) ) ; fight . setWinTime ( getTime ( tds . get ( TIME_COLUMN ) ) ) ; } fights . add ( fight ) ; logger . info ( "Fight added: {}" , fight ) ; } ) ; } return fights ; }
Parse fights of an old event