-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update React Native to add 2019 views
0d581d7d Add 2019 Event Insights (#14) 1401d7c Add 2019 match breakdown (#10) 2445721 fix bucket path d4dcc09 add missing function bcd046f fix deploy script 20bb731 travis fixes 0af7ec6 set up travis for prod (#9) 7bf22b9 Travis auto build/deploy setup (now with documentation!) (#7) git-subtree-dir: subtrees/the-blue-alliance-react git-subtree-split: 0d581d7d78c3f677cb021bdd4a9326b2b36c3f1d
- Loading branch information
Showing
11 changed files
with
493 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
language: node_js | ||
|
||
branches: | ||
only: | ||
- master | ||
|
||
before_install: | ||
- nvm install 9 | ||
|
||
install: | ||
- travis_retry npm install | ||
- travis_retry npm install -g react-native-cli | ||
|
||
before_deploy: | ||
- openssl aes-256-cbc -K $encrypted_e4ef44d57242_key -iv $encrypted_e4ef44d57242_iv -in ops/deploy_keys.tar.enc -out ops/deploy_keys.tar -d | ||
- ./ops/manage_deploy_keys.sh -x | ||
|
||
stages: | ||
- test | ||
- name: deploy | ||
if: (type = push) AND (branch = master) | ||
|
||
jobs: | ||
include: | ||
- script: npm test | ||
- stage: deploy | ||
script: skip | ||
deploy: | ||
skip_cleanup: true | ||
provider: script | ||
script: ./ops/travis-deploy.sh | ||
on: | ||
branch: master | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
subtrees/the-blue-alliance-react/app/views/EventInsights2019.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
'use strict'; | ||
|
||
import React from 'react'; | ||
import { | ||
Text, | ||
View | ||
} from 'react-native'; | ||
import TableSectionHeader from '../componets/TableSectionHeader'; | ||
import InsightRow from '../componets/InsightRow'; | ||
import { round } from '../helpers/number'; | ||
import { | ||
scoreFor, | ||
percentageFor, | ||
bonusStat, | ||
highScoreString, | ||
} from '../helpers/insights'; | ||
|
||
export default class EventInsights2019 extends React.Component { | ||
render() { | ||
return ( | ||
<View> | ||
{/* Match Stats */} | ||
<TableSectionHeader>Match Stats</TableSectionHeader> | ||
|
||
<InsightRow title='High Score' | ||
qual={highScoreString(this.props.qual, 'high_score')} | ||
playoff={highScoreString(this.props.playoff, 'high_score')}/> | ||
|
||
<InsightRow title='Average Match Score' | ||
qual={scoreFor(this.props.qual, 'average_score')} | ||
playoff={scoreFor(this.props.playoff, 'average_score')}/> | ||
|
||
<InsightRow title='Average Winning Score' | ||
qual={scoreFor(this.props.qual, 'average_win_score')} | ||
playoff={scoreFor(this.props.playoff, 'average_win_score')}/> | ||
|
||
<InsightRow title='Average Win Margin' | ||
qual={scoreFor(this.props.qual, 'average_win_margin')} | ||
playoff={scoreFor(this.props.playoff, 'average_win_margin')}/> | ||
|
||
<InsightRow title='Average Sandstorm Bonus Points' | ||
qual={scoreFor(this.props.qual, 'average_sandstorm_bonus_auto')} | ||
playoff={scoreFor(this.props.playoff, 'average_sandstorm_bonus_auto')}/> | ||
|
||
<InsightRow title='Average Hatch Panel Points' | ||
qual={scoreFor(this.props.qual, 'average_hatch_panel_points')} | ||
playoff={scoreFor(this.props.playoff, 'average_hatch_panel_points')}/> | ||
|
||
<InsightRow title='Average Cargo Points' | ||
qual={scoreFor(this.props.qual, 'average_cargo_points')} | ||
playoff={scoreFor(this.props.playoff, 'average_cargo_points')}/> | ||
|
||
<InsightRow title='Average HAB Climb Points' | ||
qual={percentageFor(this.props.qual, 'average_hab_climb_teleop')} | ||
playoff={percentageFor(this.props.playoff, 'average_hab_climb_teleop')}/> | ||
|
||
<InsightRow title='Average Foul Points' | ||
qual={scoreFor(this.props.qual, 'average_foul_score')} | ||
playoff={scoreFor(this.props.playoff, 'average_foul_score')}/> | ||
|
||
<InsightRow title='Average Score' | ||
qual={scoreFor(this.props.qual, 'average_score')} | ||
playoff={scoreFor(this.props.playoff, 'average_score')}/> | ||
|
||
{/* Match Stats */} | ||
<TableSectionHeader>Bonus Stats (# successful / # opportunities)</TableSectionHeader> | ||
|
||
<InsightRow title='Cross HAB Line' | ||
qual={bonusStat(this.props.qual, 'cross_hab_line_count')} | ||
playoff={bonusStat(this.props.playoff, 'cross_hab_line_count')}/> | ||
|
||
<InsightRow title='Cross HAB Line in Sandstorm' | ||
qual={bonusStat(this.props.qual, 'cross_hab_line_sandstorm_count')} | ||
playoff={bonusStat(this.props.playoff, 'cross_hab_line_sandstorm_count')}/> | ||
|
||
<InsightRow title='Complete 1 Rocket' | ||
qual={bonusStat(this.props.qual, 'complete_1_rocket_count')} | ||
playoff={bonusStat(this.props.playoff, 'complete_1_rocket_count')}/> | ||
|
||
<InsightRow title='Complete 2 Rockets' | ||
qual={bonusStat(this.props.qual, 'complete_2_rockets_count')} | ||
playoff={bonusStat(this.props.playoff, 'complete_2_rockets_count')}/> | ||
|
||
<InsightRow title='Complete Rocket RP' | ||
qual={bonusStat(this.props.qual, 'rocket_rp_achieved')} | ||
playoff={bonusStat(this.props.playoff, 'rocket_rp_achieved')}/> | ||
|
||
<InsightRow title='Level 1 HAB Climb' | ||
qual={bonusStat(this.props.qual, 'level1_climb_count')} | ||
playoff={bonusStat(this.props.playoff, 'level1_climb_count')}/> | ||
|
||
<InsightRow title='Level 2 HAB Climb' | ||
qual={bonusStat(this.props.qual, 'level2_climb_count')} | ||
playoff={bonusStat(this.props.playoff, 'level2_climb_count')}/> | ||
|
||
<InsightRow title='Level 3 HAB Climb' | ||
qual={bonusStat(this.props.qual, 'level3_climb_count')} | ||
playoff={bonusStat(this.props.playoff, 'level3_climb_count')}/> | ||
|
||
<InsightRow title='"HAB Docking RP' | ||
qual={bonusStat(this.props.qual, 'climb_rp_achieved')} | ||
playoff={bonusStat(this.props.playoff, 'climb_rp_achieved')}/> | ||
|
||
<InsightRow title='"Unicorn Matches" (Win + Complete Rocket + HAB Docking)' | ||
qual={bonusStat(this.props.qual, 'unicorn_matches')} | ||
playoff={bonusStat(this.props.playoff, 'unicorn_matches')}/> | ||
|
||
</View> | ||
); | ||
} | ||
} |
169 changes: 169 additions & 0 deletions
169
subtrees/the-blue-alliance-react/app/views/MatchBreakdown2019.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
import React from 'react'; | ||
import ReactNative from 'react-native'; | ||
import { | ||
Text, | ||
View | ||
} from 'react-native'; | ||
import BreakdownRow from '../componets/BreakdownRow'; | ||
import breakdown from '../styles/breakdown'; | ||
import images from '../config/images'; | ||
|
||
// Override our Image and Text to have specific sizes | ||
const Image = ({ style, ...props }) => <ReactNative.Image style={[breakdown.imageSize, style]} {...props} />; | ||
|
||
export default class MatchBreakdown2019 extends React.Component { | ||
|
||
checkImage() { | ||
return ( | ||
<Image source={images.check} /> | ||
); | ||
} | ||
|
||
xImage() { | ||
return ( | ||
<Image source={images.clear} /> | ||
); | ||
} | ||
|
||
getSandstormBonusFor(breakdown, robotNumber) { | ||
if (breakdown["habLineRobot" + robotNumber] == "CrossedHabLineInSandstorm") { | ||
let result = breakdown["preMatchLevelRobot" + robotNumber] | ||
if (result.includes("HabLevel")) { | ||
return `Level ${result.substr(-1)}` | ||
} | ||
} | ||
return "--" | ||
} | ||
|
||
getHABClimbFor(breakdown, robotNumber) { | ||
let result = breakdown["endgameRobot" + robotNumber] | ||
if (result.includes("HabLevel")) { | ||
return `Level ${result.substr(-1)}` | ||
} | ||
return "--" | ||
} | ||
|
||
getCargoShipDataFor(breakdown) { | ||
var panelCount = 0 | ||
var cargoCount = 0 | ||
|
||
for (let i = 1; i <= 8; i++) { | ||
if (breakdown["bay" + i].includes("Panel")) { | ||
panelCount++ | ||
} | ||
if (breakdown["bay" + i].includes("Cargo")) { | ||
panelCount++ | ||
} | ||
} | ||
return `${panelCount} / ${cargoCount}` | ||
} | ||
|
||
getRocketShipDataFor(breakdown, rocketLocation) { | ||
var locations = [ | ||
"topLeftRocket", | ||
"topRightRocket", | ||
"midLeftRocket", | ||
"midRightRocket", | ||
"lowLeftRocket", | ||
"lowRightRocket" | ||
] | ||
var panelCount = 0 | ||
var cargoCount = 0 | ||
locations.forEach(location => { | ||
if (breakdown[location + rocketLocation].includes("Panel")) { | ||
panelCount++ | ||
} | ||
if (breakdown[location + rocketLocation].includes("Cargo")) { | ||
cargoCount++ | ||
} | ||
}); | ||
return `${panelCount} / ${cargoCount}` | ||
} | ||
|
||
|
||
render() { | ||
return ( | ||
<View style={breakdown.container}> | ||
|
||
<BreakdownRow data={["Teams", this.props.redTeams, this.props.blueTeams]} vertical={true} subtotal={true} /> | ||
|
||
<BreakdownRow data={["Robot 1 Sandstorm Bonus", | ||
this.getSandstormBonusFor(this.props.redBreakdown, 1), | ||
this.getSandstormBonusFor(this.props.blueBreakdown, 1)]} /> | ||
|
||
<BreakdownRow data={["Robot 2 Sandstorm Bonus", | ||
this.getSandstormBonusFor(this.props.redBreakdown, 2), | ||
this.getSandstormBonusFor(this.props.blueBreakdown, 2)]} /> | ||
|
||
<BreakdownRow data={["Robot 3 Sandstorm Bonus", | ||
this.getSandstormBonusFor(this.props.redBreakdown, 3), | ||
this.getSandstormBonusFor(this.props.blueBreakdown, 3)]} /> | ||
|
||
<BreakdownRow data={["Total Sandstorm Bonus", | ||
this.props.redBreakdown.sandStormBonusPoints, | ||
this.props.blueBreakdown.sandStormBonusPoints]} total={true} /> | ||
|
||
<BreakdownRow data={["Cargo Ship: # Hatch Panels / # Cargo", | ||
this.getCargoShipDataFor(this.props.redBreakdown), | ||
this.getCargoShipDataFor(this.props.blueBreakdown)]} /> | ||
|
||
<BreakdownRow data={["Rocket 1: # Hatch Panels / # Cargo", | ||
this.getRocketShipDataFor(this.props.redBreakdown, "Near"), | ||
this.getRocketShipDataFor(this.props.blueBreakdown, "Near")]} /> | ||
|
||
<BreakdownRow data={["Rocket 2: # Hatch Panels / # Cargo", | ||
this.getRocketShipDataFor(this.props.redBreakdown, "Far"), | ||
this.getRocketShipDataFor(this.props.blueBreakdown, "Far")]} /> | ||
|
||
<BreakdownRow data={["Total Points: Hatch Panels / Cargo", | ||
`${this.props.redBreakdown.hatchPanelPoints} / ${this.props.redBreakdown.cargoPoints}`, | ||
`${this.props.blueBreakdown.hatchPanelPoints} / ${this.props.blueBreakdown.cargoPoints}`]} subtotal={true} /> | ||
|
||
<BreakdownRow data={["Robot 1 HAB Climb", | ||
this.getHABClimbFor(this.props.redBreakdown, 1), | ||
this.getHABClimbFor(this.props.blueBreakdown, 1)]} /> | ||
|
||
<BreakdownRow data={["Robot 2 HAB Climb", | ||
this.getHABClimbFor(this.props.redBreakdown, 2), | ||
this.getHABClimbFor(this.props.blueBreakdown, 2)]} /> | ||
|
||
<BreakdownRow data={["Robot 3 HAB Climb", | ||
this.getHABClimbFor(this.props.redBreakdown, 3), | ||
this.getHABClimbFor(this.props.blueBreakdown, 3)]} /> | ||
|
||
<BreakdownRow data={["HAB Climb Points", | ||
this.props.redBreakdown.habClimbPoints, | ||
this.props.blueBreakdown.habClimbPoints]} subtotal={true} /> | ||
|
||
<BreakdownRow data={["Total Teleop", | ||
this.props.redBreakdown.teleopPoints, | ||
this.props.blueBreakdown.teleopPoints]} total={true} /> | ||
|
||
<BreakdownRow data={["Complete Rocket", | ||
this.props.redBreakdown.completeRocketRankingPoint ? this.checkImage() : this.xImage(), | ||
this.props.blueBreakdown.completeRocketRankingPoint ? this.checkImage() : this.xImage()]} /> | ||
|
||
<BreakdownRow data={["HAB Docking", | ||
this.props.redBreakdown.habDockingRankingPoint ? this.checkImage() : this.xImage(), | ||
this.props.blueBreakdown.habDockingRankingPoint ? this.checkImage() : this.xImage()]} /> | ||
|
||
<BreakdownRow data={["Fouls", | ||
["+", this.props.redBreakdown.foulPoints], | ||
["+", this.props.blueBreakdown.foulPoints]]} /> | ||
|
||
<BreakdownRow data={["Adjustments", | ||
this.props.redBreakdown.adjustPoints, | ||
this.props.blueBreakdown.adjustPoints]} /> | ||
|
||
<BreakdownRow data={["Total Score", | ||
this.props.redBreakdown.totalPoints, | ||
this.props.blueBreakdown.totalPoints]} total={true} /> | ||
|
||
{this.props.compLevel == "qm" ? <BreakdownRow data={["Ranking Points", | ||
["+", this.props.redBreakdown.rp, " RP"], | ||
["+", this.props.blueBreakdown.rp, " RP"]]} /> : null} | ||
|
||
</View> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Binary file not shown.
Oops, something went wrong.