Skip to content

Commit

Permalink
Implemented averages in the team reports.
Browse files Browse the repository at this point in the history
  • Loading branch information
anjaliaravindhan committed Feb 10, 2019
1 parent a2fc8a4 commit ef9e8b2
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 34 deletions.
17 changes: 0 additions & 17 deletions .idea/artifacts/release.xml

This file was deleted.

11 changes: 0 additions & 11 deletions .idea/libraries/TBA_APIv3_Java_Library.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,4 @@ private static Method getCorrectMethod(Class dataObjectClass, String metricName)
}

}

38 changes: 32 additions & 6 deletions src/main/java/org/usfirst/frc/team25/scouting/data/TeamReport.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
package org.usfirst.frc.team25.scouting.data;

import org.usfirst.frc.team25.scouting.data.models.Autonomous;
import org.usfirst.frc.team25.scouting.data.models.PostMatch;
import org.usfirst.frc.team25.scouting.data.models.ScoutEntry;
import org.usfirst.frc.team25.scouting.data.models.TeleOp;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;

import static org.usfirst.frc.team25.scouting.data.Statistics.average;

This comment has been minimized.

Copy link
@spencerng

spencerng Feb 10, 2019

Member

Import the entire Statistics class here, not the individual methods

import static org.usfirst.frc.team25.scouting.data.Statistics.sum;

/**
* Object model containing individual reports of teams in events and methods to process data
* Not used during the 2018 season
Expand All @@ -17,7 +22,7 @@ public class TeamReport {

private final transient ArrayList<ScoutEntry> entries;
private final int teamNum;
private String teamName, frequentRobotCommentStr, allComments;
private String teamName = "", frequentRobotCommentStr, allComments;

This comment has been minimized.

Copy link
@spencerng

spencerng Feb 10, 2019

Member

Don't initialize class variables with a default value; place this in the constructor or use the null check in that one if statement


public TeamReport(int teamNum) {
this.teamNum = teamNum;
Expand All @@ -43,14 +48,38 @@ public String getQuickStatus() {

ArrayList<Object> autoList = SortersFilters.filterDataObject(entries, Autonomous.class);

statusString += "Avg. cargo ship cargo: " + Statistics.round(Statistics.average(autoList, "cargoShipCargo"), 2);
statusString += "\nAvg. cargo ship cargo: " + Statistics.round(average(autoList, "cargoShipCargo"), 2);
statusString += "\nAvg. cargo ship hatches: " + Statistics.round(average(autoList, "cargoShipHatches"), 2);

This comment has been minimized.

Copy link
@spencerng

spencerng Feb 10, 2019

Member

Just a thought for the future - we could place method names in an array and iterate over them instead of repeating lines of code

statusString += "\nAvg. rocket cargo: " + Statistics.round(average(autoList, "rocketCargo"), 2);
statusString += "\nAvg. rocket hatches: " + Statistics.round(average(autoList, "rocketHatches"),2);
statusString += "\nAvg. cargo dropped: " + Statistics.round(average(autoList, "cargoDropped"), 2);
statusString += "\nAvg. hatches dropped: " + Statistics.round(average(autoList, "hatchesDropped"), 2);

statusString += "\n\nTele-Op:\n";

ArrayList<Object> teleList = SortersFilters.filterDataObject(entries, TeleOp.class);

statusString += "\nAvg. cargo ship cargo: " + Statistics.round(average(teleList, "cargoShipCargo"),2);
statusString += "\nAvg. cargo ship hatches: " + Statistics.round(average(teleList, "cargoShipHatches"),2);
statusString += "\nAvg. rocket level 1 cargo: " + Statistics.round(average(teleList, "rocketLevelOneCargo"),2);
statusString += "\nAvg. rocket level 2 cargo: " + Statistics.round(average(teleList, "rocketLevelTwoCargo"),2);
statusString += "\nAvg. rocket level 3 cargo: " + Statistics.round(average(teleList, "rocketLevelThreeCargo"),2);
statusString += "\nAvg. rocket level 1 hatches: " + Statistics.round(average(teleList, "rocketLevelOneHatches"),2);
statusString += "\nAvg. rocket level 2 hatches: " + Statistics.round(average(teleList, "rocketLevelTwoHatches"),2);
statusString += "\nAvg. rocket level 3 hatches: " + Statistics.round(average(teleList, "rocketLevelThreeHatches"),2);
statusString += "\nAvg. cargo dropped: " + Statistics.round(average(teleList, "cargoDropped"),2);
statusString += "\nAvg. hatches dropped: " + Statistics.round(average(teleList, "hatchesDropped"),2);

statusString += "\n\nEndgame:\n";

ArrayList<Object> postList = SortersFilters.filterDataObject(entries,PostMatch.class);

statusString += "\n Avg. total points: ";

statusString += "\n\nOverall:\n";

statusString += "\n Common Quick Comments: " + "\n" + frequentRobotCommentStr;


return statusString;
}
Expand Down Expand Up @@ -81,7 +110,6 @@ 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) {
Expand All @@ -102,7 +130,7 @@ public void findFrequentComments() {
}

for (String comment : frequentRobotComment) {
frequentRobotCommentStr += StringProcessing.removeCommasBreaks(comment) + ';';
frequentRobotCommentStr += StringProcessing.removeCommasBreaks(comment) + " \n";
}

allComments = "";
Expand Down Expand Up @@ -130,6 +158,4 @@ public ArrayList<ScoutEntry> getEntries() {
public int getTeamNum() {
return teamNum;
}


}

1 comment on commit ef9e8b2

@spencerng
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember to stick to the imperative mood in commit messages and incorporate percent success for metrics like climbs and HAB line crossing in the future

Please sign in to comment.