Skip to content

Commit

Permalink
Fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
spencerng committed Feb 17, 2019
2 parents 9a2d116 + ebd2a97 commit 6857a8b
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 51 deletions.
Binary file modified libs/TBA-APIv3-Java-Library.jar
Binary file not shown.
8 changes: 8 additions & 0 deletions local.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Sun Feb 03 12:30:55 EST 2019
sdk.dir=C\:\\Users\\Anjal\\AppData\\Local\\Android\\Sdk
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public static void downloadTeamEvents(File outputFolder, int year, int teamNum)

}

public static boolean downloadEventMatchData(String eventCode, File outputDirectory) throws IOException {
public static boolean downloadQualificationMatchData(String eventCode, File outputDirectory) throws IOException {
ArrayList<Match> matches =
SortersFilters.sortByMatchNum(SortersFilters.filterQualification(new ArrayList<>(Arrays.asList(TBA.eventRequest.getMatches(eventCode)))));

Expand Down
109 changes: 64 additions & 45 deletions src/main/java/org/usfirst/frc/team25/scouting/data/EventReport.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.thebluealliance.api.v3.models.Match;
import com.thebluealliance.api.v3.models.MatchScoreBreakdown2018Alliance;
import com.thebluealliance.api.v3.models.MatchScoreBreakdown2019Allliance;
import org.usfirst.frc.team25.scouting.data.models.*;

import java.io.File;
Expand Down Expand Up @@ -53,10 +53,10 @@ public EventReport(ArrayList<ScoutEntry> entries, String event, File directory)
}
}

public void fixInaccuraciesTBA() {
public boolean fixInaccuraciesTBA() {

try {
BlueAlliance.downloadEventMatchData(event, directory);
BlueAlliance.downloadQualificationMatchData(event, directory);
} catch (IOException e) {
e.printStackTrace();
}
Expand All @@ -75,12 +75,14 @@ public void fixInaccuraciesTBA() {
entry.getPreMatch().getScoutName() + ": ";
String inaccuracies = "";
Match match = matchData.get(entry.getPreMatch().getMatchNum() - 1);
MatchScoreBreakdown2018Alliance sb;
MatchScoreBreakdown2019Allliance sb;
boolean correctTeamRed = entry.getPreMatch().getScoutPos().contains("Red") && match.getRedAlliance()
.getTeamKeys()[Integer.parseInt(entry.getPreMatch().getScoutPos().split(" ")[1]) - 1].equals("frc" + entry.getPreMatch().getTeamNum());
.getTeamKeys()[Integer.parseInt(entry.getPreMatch().getScoutPos().split(" ")[1]) - 1]
.equals("frc" + entry.getPreMatch().getTeamNum());
boolean correctTeamBlue =
entry.getPreMatch().getScoutPos().contains("Blue") && match.getBlueAlliance()
.getTeamKeys()[Integer.parseInt(entry.getPreMatch().getScoutPos().split(" ")[1]) - 1].equals("frc" + entry.getPreMatch().getTeamNum());
.getTeamKeys()[Integer.parseInt(entry.getPreMatch().getScoutPos().split(" ")[1])
- 1].equals("frc" + entry.getPreMatch().getTeamNum());
if (correctTeamBlue || correctTeamRed) {

if (entry.getPreMatch().getScoutPos().contains("Red")) {
Expand All @@ -90,63 +92,64 @@ public void fixInaccuraciesTBA() {
}


boolean actualAutoRun = false;
boolean actualClimb = false;
boolean actualLevitate = false;
boolean actualPark = false;
boolean partnersClimb = false;
boolean actualCrossHabLine = false;
int actualEndHabLevel = 0, actualStartHabLevel = 0;



if (entry.getPreMatch().getScoutPos().contains("1")) {
actualAutoRun = sb.getAutoRobot1().equals("AutoRun");
actualClimb = sb.getEndgameRobot1().equals("Climbing");
actualLevitate = sb.getEndgameRobot1().equals("Levitate");
actualPark = sb.getEndgameRobot1().equals("Parking");
partnersClimb = sb.getEndgameRobot2().equals("Climbing") && sb.getEndgameRobot3().equals(
"Climbing");
actualCrossHabLine = sb.getHabLineRobot1().equals("CrossedHabLineInSandstorm");
for (int i = 1; i <= 3; i++) {
if (sb.getEndgameRobot1().contains(Integer.toString(i))) {
actualEndHabLevel = i;
}
if (sb.getPreMatchLevelRobot1().contains(Integer.toString(i))) {
actualStartHabLevel = i;
}
}
} else if (entry.getPreMatch().getScoutPos().contains("2")) {
actualAutoRun = sb.getAutoRobot2().equals("AutoRun");
actualClimb = sb.getEndgameRobot2().equals("Climbing");
actualLevitate = sb.getEndgameRobot2().equals("Levitate");
actualPark = sb.getEndgameRobot2().equals("Parking");
partnersClimb = sb.getEndgameRobot1().equals("Climbing") && sb.getEndgameRobot3().equals(
"Climbing");
actualCrossHabLine = sb.getHabLineRobot2().equals("CrossedHabLineInSandstorm");
for (int i = 1; i <= 3; i++) {
if (sb.getEndgameRobot2().contains(Integer.toString(i))) {
actualEndHabLevel = i;
}
if (sb.getPreMatchLevelRobot2().contains(Integer.toString(i))) {
actualStartHabLevel = i;
}
}
} else if (entry.getPreMatch().getScoutPos().contains("3")) {
actualAutoRun = sb.getAutoRobot3().equals("AutoRun");
actualClimb = sb.getEndgameRobot3().equals("Climbing");
actualLevitate = sb.getEndgameRobot3().equals("Levitate");
actualPark = sb.getEndgameRobot3().equals("Parking");
partnersClimb = sb.getEndgameRobot2().equals("Climbing") && sb.getEndgameRobot1().equals(
"Climbing");
}

if (actualAutoRun != entry.getAutonomous().isCrossHabLine()) {
inaccuracies += "auto run, ";
entry.getAutonomous().setCrossHabLine(actualAutoRun);
actualCrossHabLine = sb.getHabLineRobot3().equals("CrossedHabLineInSandstorm");
for (int i = 0; i <= 3; i++) {
if (sb.getEndgameRobot3().contains(Integer.toString(i))) {
actualEndHabLevel = i;
}
if (sb.getPreMatchLevelRobot3().contains(Integer.toString(i))) {
actualStartHabLevel = i;
}
}
}


if (actualLevitate && partnersClimb && !entry.getPostMatch().robotQuickCommentSelections.get(
"Climb/park unneeded (levitate used and others climbed)")) {
entry.getPostMatch().robotQuickCommentSelections.put("Climb/park unneeded (levitate used " +
"and others climbed)", true);
inaccuracies += "climb/park unneeded, ";
if (actualCrossHabLine != entry.getAutonomous().isCrossHabLine()) {
inaccuracies += "auto cross hab line, ";
entry.getAutonomous().setCrossHabLine(actualCrossHabLine);
}


if (!inaccuracies.isEmpty()) {
inaccuracyList += prefix + inaccuracies + "\n";
}
}


} catch (ArrayIndexOutOfBoundsException e) {

}

}
FileManager.outputFile(directory.getAbsolutePath() + "/Inaccuracies - " + event, "txt",
inaccuracyList);
} catch (Exception e) {
e.printStackTrace();
}

return false;
}

public boolean isTeamPlaying(int teamNum) {
Expand Down Expand Up @@ -213,7 +216,8 @@ public boolean generateRawSpreadsheet(File outputDirectory) {

for (Method m : dataObject.getClass().getMethods()) {

if (m.getName().substring(shiftIndex).toLowerCase().equals(metric.getName().toLowerCase()) && m.getParameterTypes().length == 0) {
if (m.getName().substring(shiftIndex).toLowerCase().equals(metric.getName().toLowerCase()) &&
m.getParameterTypes().length == 0) {
try {
metricValue = m.invoke(dataObject);

Expand Down Expand Up @@ -279,7 +283,6 @@ private String generateSpreadsheetHeader() {
}



/**
* Serializes the ArrayList of all ScoutEntrys into a JSON file
*
Expand Down Expand Up @@ -352,4 +355,20 @@ public AllianceReport getAllianceReport(int teamOne, int teamTwo, int teamThree)
return new AllianceReport(teamReports.get(teamOne), teamReports.get(teamTwo), teamReports.get(teamThree));
}

public ScoutEntry[] findPartnerEntries(int teamNum, int matchNum) {
ScoutEntry partnerTeams[] = new ScoutEntry[2];
int numberFound = 0;
for (int i = 0; i < scoutEntries.size(); i++) {
if (scoutEntries.get(i).getPreMatch().getMatchNum() == matchNum && scoutEntries.get(i).getPreMatch()
.getScoutPos().contains("red")) {
partnerTeams[numberFound] = scoutEntries.get(i);
numberFound++;
if (numberFound == 2) {
return partnerTeams;
}
}
}
return partnerTeams;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,13 @@ public void autoGetTeamName(File dataLocation) {
public void findFrequentComments() {

HashMap<String, Integer> commentFrequencies = new HashMap<>();
for (String key : entries.get(0).getPostMatch().getRobotQuickCommentSelections().keySet()) {
commentFrequencies.put(key, 0);
for (ScoutEntry entry : entries) {
if (entry.getPostMatch().getRobotQuickCommentSelections().get(key)) {
commentFrequencies.put(key, 1 + commentFrequencies.get(key));
if (entries.size() > 0) {
for (String key : entries.get(0).getPostMatch().getRobotQuickCommentSelections().keySet()) {
commentFrequencies.put(key, 0);
for (ScoutEntry entry : entries) {
if (entry.getPostMatch().getRobotQuickCommentSelections().get(key)) {
commentFrequencies.put(key, 1 + commentFrequencies.get(key));
}
}
}
}
Expand Down

0 comments on commit 6857a8b

Please sign in to comment.