Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Game modularity #42

Merged
merged 2 commits into from
May 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 6 additions & 57 deletions html/events/velocity-vortex/regional.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,32 +118,9 @@
<div class="greencircle"></div><span class="key">= End Game Period</span>

<table class="table table-striped table-bordered" id="inputTable2">
<thead>
<tr>
<th>#</th>
<th>Alliance</th>
<th>Team Number</th>
<th>Team Name</th>
<th>Rank</th>
<th>OPR*</th>
<th>Result R-B</th>
<th>Score</th>
<th class="red">Parking</th>
<th class="red">Center Particles</th>
<th class="red">Corner Particles</th>
<th class="red">Cap Ball</th>
<th class="red">Beacons</th>
<th class="blue">Center Particles</th>
<th class="blue">Corner Particles</th>
<th class="green">Beacons</th>
<th class="green">Cap Ball</th>
</tr>
</thead>
<tbody>
<?php
MatchHistoryTable('Y201702255');
?>
</tbody>
<?php
MatchHistoryTable('Y201702255');
?>
</table>
</div>
<div style="padding-top: 10px;" id="average-scores" class="tab-pane fade table-responsive">
Expand All @@ -152,37 +129,9 @@
<div class="greencircle"></div><span class="key">= End Game Period</span>

<table class="table table-striped table-bordered" id="inputTable3">
<thead>
<tr>
<th>Team Number</th>
<th>Team Name</th>
<th>Average Score</th>
<th class="red">Average Auto</th>
<th class="blue">Average Driver</th>
<th class="green">Average End</th>
<th class="red">No Parking</th>
<th class="red">Partially Center</th>
<th class="red">Partially Corner</th>
<th class="red">Fully Center</th>
<th class="red">Fully Corner</th>
<th class="red">Center Particles</th>
<th class="red">Corner Particles</th>
<th class="red">Cap Ball</th>
<th class="red">Beacons</th>
<th class="blue">Center Particles</th>
<th class="blue">Corner Particles</th>
<th class="green">Beacons</th>
<th class="green">Cap Floor</th>
<th class="green">Cap Raised</th>
<th class="green">Cap Above Center</th>
<th class="green">Cap In Center</th>
</tr>
</thead>
<tbody>
<?php
AverageScoresTable('Y201702255');
?>
</tbody>
<?php
AverageScoresTable('Y201702255');
?>
</table>
</div>
</div>
Expand Down
18 changes: 9 additions & 9 deletions html/input-data.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,27 +133,27 @@ <h3><img style="max-width:50px" src="/images/centervortex.png"><img style="max-w
<div class="btn-group btn-group-justified" data-toggle="buttons">
<div class="btn-group" role="group">
<label class="btn btn-default redtext redbutton">
<input type="radio" name="autoRobotParking" id="option1" autocomplete="off" value="Did Not Park" required>No<br>Parking
<input type="radio" name="autoRobotParking" id="option1" autocomplete="off" value="NoParking" required>No<br>Parking
</label>
</div>
<div class="btn-group" role="group">
<label class="btn btn-default redtext redbutton">
<input type="radio" name="autoRobotParking" id="option1" autocomplete="off" value="Partially On Center Vortex">Partially<br>Center
<input type="radio" name="autoRobotParking" id="option1" autocomplete="off" value="PartiallyCenter">Partially<br>Center
</label>
</div>
<div class="btn-group" role="group">
<label class="btn btn-default redtext redbutton">
<input type="radio" name="autoRobotParking" id="option1" autocomplete="off" value="Partially On Corner Vortex">Partially<br>Corner
<input type="radio" name="autoRobotParking" id="option1" autocomplete="off" value="PartiallyCorner">Partially<br>Corner
</label>
</div>
<div class="btn-group" role="group">
<label class="btn btn-default redtext redbutton">
<input type="radio" name="autoRobotParking" id="option1" autocomplete="off" value="Fully On Center Vortex">Fully<br> Center
<input type="radio" name="autoRobotParking" id="option1" autocomplete="off" value="FullyCenter">Fully<br> Center
</label>
</div>
<div class="btn-group" role="group">
<label class="btn btn-default redtext redbutton">
<input type="radio" name="autoRobotParking" id="option1" autocomplete="off" value="Fully On Corner Vortex">Fully<br> Corner
<input type="radio" name="autoRobotParking" id="option1" autocomplete="off" value="FullyCorner">Fully<br> Corner
</label>
</div>
</div>
Expand Down Expand Up @@ -310,22 +310,22 @@ <h3><img style="max-width:50px" src="/images/capballs.png">
<div class="btn-group btn-group-justified" data-toggle="buttons">
<div class="btn-group" role="group">
<label class="btn btn-default greentext greenbutton">
<input type="radio" name="endCapBall" id="option1" autocomplete="off" value="On The Ground" required>On The <br>Ground
<input type="radio" name="endCapBall" id="option1" autocomplete="off" value="CapBallOnFloor" required>On The <br>Ground
</label>
</div>
<div class="btn-group" role="group">
<label class="btn btn-default greentext greenbutton">
<input type="radio" name="endCapBall" id="option1" autocomplete="off" value="Raised Off The Floor">Raised Off <br>The Floor
<input type="radio" name="endCapBall" id="option1" autocomplete="off" value="CapBallRaised">Raised Off <br>The Floor
</label>
</div>
<div class="btn-group" role="group">
<label class="btn btn-default greentext greenbutton">
<input type="radio" name="endCapBall" id="option1" autocomplete="off" value="Raised Above Vortex">Raised <br>Above Vortex
<input type="radio" name="endCapBall" id="option1" autocomplete="off" value="CapBallAboveCenter">Raised <br>Above Vortex
</label>
</div>
<div class="btn-group" role="group">
<label class="btn btn-default greentext greenbutton">
<input type="radio" name="endCapBall" id="option1" autocomplete="off" value="Scored In Center Vortex">Scored In <br>Center Vortex
<input type="radio" name="endCapBall" id="option1" autocomplete="off" value="CapBallInCenter">Scored In <br>Center Vortex
</label>
</div>
</div>
Expand Down
18 changes: 9 additions & 9 deletions html/input-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ function AllOfIt(){

"GameInformation" => array(
"AUTO" => array(
"RobotParking" => InputTranslator($_POST['autoRobotParking']),
"ParticlesCenter" => intval($_POST['autoParticlesCenter']),
"ParticlesCorner" => intval($_POST['autoParticlesCorner']),
"CapBall" => InputTranslator($_POST['autoCapBall']),
"ClaimedBeacons" => intval($_POST['autoClaimedBeacons'])
"Parking" => $_POST['autoRobotParking'],
"CenterParticles" => intval($_POST['autoParticlesCenter']),
"CornerParticles" => intval($_POST['autoParticlesCorner']),
"CapBall" => $_POST['autoCapBall'],
"Beacons" => intval($_POST['autoClaimedBeacons'])
),
"DRIVER" => array(
"ParticlesCenter" => intval($_POST['driverParticlesCenter']),
"ParticlesCorner" => intval($_POST['driverParticlesCorner'])
"CenterParticles" => intval($_POST['driverParticlesCenter']),
"CornerParticles" => intval($_POST['driverParticlesCorner'])
),
"END" => array(
"AllianceClaimedBeacons" => intval($_POST['endAllianceClaimedBeacons']),
"CapBall" => InputTranslator($_POST['endCapBall'])
"Beacons" => intval($_POST['endAllianceClaimedBeacons']),
"CapBall" => $_POST['endCapBall']
)
)
);
Expand Down
126 changes: 99 additions & 27 deletions html/potato.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
<?php
function GameObjectives($season){
$manager = new MongoDB\Driver\Manager();
$query = new MongoDB\Driver\Query(['MetaData.MetaData' => 'GameObjectives', 'SeasonInfo.Season' => $season]);
$cursor = $manager->executeQuery('TheOrangeAlliance.GameObjectives', $query);
$cursor->setTypeMap(['root' => 'array', 'document' => 'array', 'array' => 'array']);
foreach($cursor as $document){
return $document;
}
return null;
}
function PutItInATH($stuffToPutIn, $class = ''){
if($class != ''){
echo "<th class=" . $class . ">" . $stuffToPutIn . "</th>";
}else{
echo "<th>" . $stuffToPutIn . "</th>";
}
}
function PutItInATD($stuffToPutIn, $class = ''){
$HIGHLIGHTLIST = array(
8097,
Expand Down Expand Up @@ -110,6 +127,7 @@ function RankingsTable($datePlace){
//PutItInATD(MakeTheFloatHaveAPercent(round($rank['AverageAccuracy'],4)));
echo '</tr>';
}
break;
}
}
function MatchHistoryTable($datePlace){
Expand All @@ -118,31 +136,59 @@ function MatchHistoryTable($datePlace){
$cursor = $manager->executeQuery('TheOrangeAlliance.'.$datePlace, $query);
$cursor->setTypeMap(['root' => 'array', 'document' => 'array', 'array' => 'array']);
foreach($cursor as $document){
$gameObjectives = GameObjectives($document['MetaData']['Season']);
$gameFields = $gameObjectives['DisplayOrder']['Fields'];
echo '<thead>';
echo '<tr>';
PutItInATH('#');
PutItInATH('Alliance');
PutItInATH('Team Number');
PutItInATH('Team Name');
PutItInATH('Rank');
PutItInATH('OPR*');
PutItInATH('Result R-B');
PutItInATH('Score');
$gamePeriodHighlights = ['AUTO' => 'red', 'DRIVER' => 'blue', 'END' => 'green'];
$gamePeriods = array('AUTO', 'DRIVER', 'END');
foreach ($gamePeriods as $gamePeriod) {
$fields = $gameFields[$gamePeriod];
foreach ($fields as $field) {
PutItInATH($gameObjectives['DisplayNames']['Fields'][$gamePeriod][$field], $gamePeriodHighlights[$gamePeriod]);
}
}
echo '</tr>';
echo '</thead>';
echo '<tbody>';
foreach($document['MatchHistory'] as $matchNumber){
foreach($matchNumber as $alliance){
foreach($alliance as $teamNumber){
echo '<tr>';
PutItInATD($teamNumber['MatchNumber']);
PutItInATD($teamNumber['Alliance'] ,AllianceColor($teamNumber['Alliance']));
PutItInATD($teamNumber['Alliance'], AllianceColor($teamNumber['Alliance']));
PutItInATD($teamNumber['TeamNumber']);
PutItInATD($teamNumber['TeamName']);
PutItInATD($teamNumber['TeamRank']);
PutItInATD(RoundValue($teamNumber['OPR']));
PutItInATD(ResultsRB($teamNumber['ResultRed'],$teamNumber['ResultBlue']), ResultsRBClass($teamNumber['ResultRed'],$teamNumber['ResultBlue']));
PutItInATD($teamNumber['Score']);
PutItInATD($teamNumber['AUTO']['Parking']);
PutItInATD($teamNumber['AUTO']['CenterParticles']);
PutItInATD($teamNumber['AUTO']['CornerParticles']);
PutItInATD($teamNumber['AUTO']['CapBall']);
PutItInATD($teamNumber['AUTO']['Beacons']);
PutItInATD($teamNumber['DRIVER']['CenterParticles']);
PutItInATD($teamNumber['DRIVER']['CornerParticles']);
PutItInATD($teamNumber['END']['Beacons']);
PutItInATD($teamNumber['END']['CapBall']);
foreach ($gamePeriods as $gamePeriod) {
$fields = $gameFields[$gamePeriod];
foreach($fields as $field) {
$fieldType = $gameObjectives['Scoring'][$gamePeriod][$field]['Type'];
if($fieldType == 'String' || $fieldType == 'YesNo'){
$value = $teamNumber[$gamePeriod][$field];
PutItInATD($gameObjectives['DisplayNames']['Options'][$gamePeriod][$field][$value]);
}else if($fieldType == 'Number'){
PutItInATD($teamNumber[$gamePeriod][$field]);
}
}
}
echo '</tr>';
}
}
}
echo '</tbody>';
break;
}
}
function AverageScoresTable($datePlace){
Expand All @@ -151,6 +197,34 @@ function AverageScoresTable($datePlace){
$cursor = $manager->executeQuery('TheOrangeAlliance.'.$datePlace, $query);
$cursor->setTypeMap(['root' => 'array', 'document' => 'array', 'array' => 'array']);
foreach($cursor as $document){
$gameObjectives = GameObjectives($document['MetaData']['Season']);
$gameFields = $gameObjectives['DisplayOrder']['Fields'];
echo '<thead>';
echo '<tr>';
PutItInATH('Team Number');
PutItInATH('Team Name');
PutItInATH('Average Score');
$gamePeriodHighlights = ['AUTO' => 'red', 'DRIVER' => 'blue', 'END' => 'green'];
PutItInATH('Average Auto', $gamePeriodHighlights['AUTO']);
PutItInATH('Average Driver', $gamePeriodHighlights['DRIVER']);
PutItInATH('Average End', $gamePeriodHighlights['END']);
$gamePeriods = array('AUTO', 'DRIVER', 'END');
foreach ($gamePeriods as $gamePeriod) {
$fields = $gameFields[$gamePeriod];
foreach ($fields as $field) {
$fieldType = $gameObjectives['Scoring'][$gamePeriod][$field]['Type'];
if($fieldType == 'String'){
foreach ($gameObjectives['DisplayOrder']['Options'][$gamePeriod][$field] as $option) {
PutItInATH($gameObjectives['DisplayNames']['Options'][$gamePeriod][$field][$option], $gamePeriodHighlights[$gamePeriod]);
}
}else if($fieldType == 'Number' || $fieldType == 'YesNo'){
PutItInATH($gameObjectives['DisplayNames']['Fields'][$gamePeriod][$field], $gamePeriodHighlights[$gamePeriod]);
}
}
}
echo '</tr>';
echo '</thead>';
echo '<tbody>';
foreach($document['AverageScores'] as $teamNumber){
echo '<tr>';
PutItInATD($teamNumber['TeamNumber']);
Expand All @@ -160,25 +234,23 @@ function AverageScoresTable($datePlace){
PutItInATD($teamNumber['AverageScores']['AverageAuto']);
PutItInATD($teamNumber['AverageScores']['AverageDriver']);
PutItInATD($teamNumber['AverageScores']['AverageEnd']);
PutItInATD($teamNumber['AUTO']['Parking']['NoParking']);
PutItInATD($teamNumber['AUTO']['Parking']['PartiallyCenter']);
PutItInATD($teamNumber['AUTO']['Parking']['PartiallyCorner']);
PutItInATD($teamNumber['AUTO']['Parking']['FullyCenter']);
PutItInATD($teamNumber['AUTO']['Parking']['FullyCorner']);
PutItInATD($teamNumber['AUTO']['CenterParticles']);
PutItInATD($teamNumber['AUTO']['CornerParticles']);
PutItInATD($teamNumber['AUTO']['CapBall']);
PutItInATD($teamNumber['AUTO']['Beacons']);
PutItInATD($teamNumber['DRIVER']['CenterParticles']);
PutItInATD($teamNumber['DRIVER']['CornerParticles']);
PutItInATD($teamNumber['END']['Beacons']);
PutItInATD($teamNumber['END']['CapBall']['CapBallOnFloor']);
PutItInATD($teamNumber['END']['CapBall']['CapBallRaised']);
PutItInATD($teamNumber['END']['CapBall']['CapBallAboveCenter']);
PutItInATD($teamNumber['END']['CapBall']['CapBallInCenter']);
foreach ($gamePeriods as $gamePeriod) {
$fields = $gameFields[$gamePeriod];
foreach ($fields as $field) {
$fieldType = $gameObjectives['Scoring'][$gamePeriod][$field]['Type'];
if($fieldType == 'String'){
foreach ($gameObjectives['DisplayOrder']['Options'][$gamePeriod][$field] as $option) {
PutItInATD($teamNumber[$gamePeriod][$field][$option]);
}
}else if($fieldType == 'Number' || $fieldType == 'YesNo'){
PutItInATD($teamNumber[$gamePeriod][$field]);
}
}
}
echo '</tr>';

}
echo '</tbody>';
break;
}
}
?>
Loading