@@ -14,6 +14,14 @@ interface IProps {
1414
1515class MatchResultsScreen extends React . Component < IProps > {
1616
17+ private boolCheck ( v : any ) : boolean {
18+ switch ( typeof v ) {
19+ case "boolean" : return v ;
20+ case "string" : return v . toLowerCase ( ) === 'true' ;
21+ default : return v ;
22+ }
23+ }
24+
1725 public render ( ) {
1826 const { event, match} = this . props ;
1927 const details : RapidReactMatchDetails = ( match . matchDetails as RapidReactMatchDetails ) || new RapidReactMatchDetails ( ) ;
@@ -25,7 +33,8 @@ class MatchResultsScreen extends React.Component<IProps> {
2533 const redPen = details . getRedPenalty ( match . blueMinPen ? match . blueMinPen : 0 , match . blueMajPen ? match . blueMajPen : 0 ) ;
2634
2735 const redAutoCargo : number = ( details . redAutoCargoLow * 2 ) + ( details . redAutoCargoHigh * 4 )
28- const redTaxi : number = ( details . redAutoTaxiRobot1 ? 2 : 0 ) + ( details . redAutoTaxiRobot2 ? 2 : 0 ) + ( details . redAutoTaxiRobot3 ? 2 : 0 ) ;
36+
37+ const redTaxi : number = ( this . boolCheck ( details . redAutoTaxiRobot1 ) ? 2 : 0 ) + ( this . boolCheck ( details . redAutoTaxiRobot2 ) ? 2 : 0 ) + ( this . boolCheck ( details . redAutoTaxiRobot3 ) ? 2 : 0 ) ;
2938
3039 const redTeleCargo : number = details . redTeleCargoLow + ( details . redTeleCargoHigh * 2 )
3140
@@ -37,7 +46,7 @@ class MatchResultsScreen extends React.Component<IProps> {
3746 const bluePen = details . getBluePenalty ( match . redMinPen ? match . redMinPen : 0 , match . redMajPen ? match . redMajPen : 0 ) ;
3847
3948 const blueAutoCargo : number = ( details . blueAutoCargoLow * 2 ) + ( details . blueAutoCargoHigh * 4 )
40- const blueTaxi : number = ( details . blueAutoTaxiRobot1 ? 2 : 0 ) + ( details . blueAutoTaxiRobot2 ? 2 : 0 ) + ( details . blueAutoTaxiRobot3 ? 2 : 0 ) ;
49+ const blueTaxi : number = ( this . boolCheck ( details . blueAutoTaxiRobot1 ) ? 2 : 0 ) + ( this . boolCheck ( details . blueAutoTaxiRobot2 ) ? 2 : 0 ) + ( this . boolCheck ( details . blueAutoTaxiRobot3 ) ? 2 : 0 ) ;
4150
4251 const blueTeleCargo : number = details . blueTeleCargoLow + ( details . blueTeleCargoHigh * 2 )
4352
@@ -47,10 +56,10 @@ class MatchResultsScreen extends React.Component<IProps> {
4756 const redWin : boolean = match . redScore > match . blueScore ;
4857 const tie : boolean = match . redScore === match . blueScore ;
4958
50- const redCargoRp = details . redCargoBonus ? 1 : 0 ;
51- const redHangarRp = details . redHangarBonus ? 1 : 0 ;
52- const blueCargoRp = details . blueCargoBonus ? 1 : 0 ;
53- const blueHangarRp = details . blueHangarBonus ? 1 : 0 ;
59+ const redCargoRp = this . boolCheck ( details . redCargoBonus ) ? 1 : 0 ;
60+ const redHangarRp = this . boolCheck ( details . redHangarBonus ) ? 1 : 0 ;
61+ const blueCargoRp = this . boolCheck ( details . blueCargoBonus ) ? 1 : 0 ;
62+ const blueHangarRp = this . boolCheck ( details . blueHangarBonus ) ? 1 : 0 ;
5463 const redRP : number = redCargoRp + redHangarRp + ( tie ? 1 : redWin ? 2 : 0 ) ;
5564 const blueRP : number = blueCargoRp + blueHangarRp + ( tie ? 1 : ! redWin ? 2 : 0 ) ;
5665
@@ -192,7 +201,7 @@ class MatchResultsScreen extends React.Component<IProps> {
192201 return (
193202 < div key = { team . teamKey } className = "ir-result-team-container red-border" >
194203 < div className = "ir-result-team center-items" > { team . teamKey } </ div >
195- < div className = "ir-result-name center-left-items" > { team . teamNameLong } </ div >
204+ < div className = "ir-result-name center-left-items" > { team . teamNameShort } </ div >
196205 < div className = "ir-result-rank center-items" > #{ rank . rank } </ div >
197206 </ div >
198207 ) ;
@@ -210,7 +219,7 @@ class MatchResultsScreen extends React.Component<IProps> {
210219 return (
211220 < div key = { team . teamKey } className = "ir-result-team-container blue-border" >
212221 < span className = "ir-result-team center-items" > { team . teamKey } </ span >
213- < span className = "ir-result-name center-left-items" > { team . teamNameLong } </ span >
222+ < span className = "ir-result-name center-left-items" > { team . teamNameShort } </ span >
214223 < span className = "ir-result-rank center-items" > #{ rank . rank } </ span >
215224 </ div >
216225 ) ;
0 commit comments