From ec12b5b5f2dc731a45c138ef2f1829f162d556b8 Mon Sep 17 00:00:00 2001 From: WillDavies Date: Sun, 11 Mar 2018 23:24:27 -0500 Subject: [PATCH] Release 4.4.1 --- app/build.gradle | 4 +- .../cpjd/roblu/csv/csvSheets/MatchData.java | 2 + .../java/com/cpjd/roblu/sync/qr/QrReader.java | 1 + .../roblu/tba/ManualScheduleImporter.java | 2 +- .../com/cpjd/roblu/ui/teams/TeamsView.java | 2 +- .../ui/teamsSorting/TeamMetricProcessor.java | 58 ++++++++++++++++++- .../com/cpjd/roblu/ui/tutorials/Tutorial.java | 9 ++- .../java/com/cpjd/roblu/utils/Constants.java | 3 +- 8 files changed, 68 insertions(+), 13 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index c870119..bbef91c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -26,8 +26,8 @@ android { applicationId "com.cpjd.roblu" minSdkVersion 19 targetSdkVersion 27 - versionCode 52 - versionName "4.4.0" + versionCode 53 + versionName "4.4.1" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" javaCompileOptions { diff --git a/app/src/main/java/com/cpjd/roblu/csv/csvSheets/MatchData.java b/app/src/main/java/com/cpjd/roblu/csv/csvSheets/MatchData.java index fff23ba..4207ebd 100644 --- a/app/src/main/java/com/cpjd/roblu/csv/csvSheets/MatchData.java +++ b/app/src/main/java/com/cpjd/roblu/csv/csvSheets/MatchData.java @@ -4,6 +4,7 @@ import com.cpjd.roblu.models.REvent; import com.cpjd.roblu.models.RForm; import com.cpjd.roblu.models.RTeam; +import com.cpjd.roblu.models.metrics.RCalculation; import com.cpjd.roblu.models.metrics.RFieldData; import com.cpjd.roblu.models.metrics.RMetric; import com.cpjd.roblu.models.metrics.RStopwatch; @@ -46,6 +47,7 @@ public void generateSheet(XSSFSheet sheet, REvent event, RForm form, RTeam[] tea for(RMetric metric : checkout.getTeam().getTabs().get(0).getMetrics()) { if(shouldWriteMetric(checkout.getTeam(), metric)) { if(metric instanceof RStopwatch) createCell(data, index + 2, ((RStopwatch) metric).getLapsString()); + else if(metric instanceof RCalculation) createCell(data, index + 2, ((RCalculation) metric).getValue(checkout.getTeam().getTabs().get(0).getMetrics())); else if(metric instanceof RFieldData) continue; else createCell(data, index + 2, metric.toString()); } diff --git a/app/src/main/java/com/cpjd/roblu/sync/qr/QrReader.java b/app/src/main/java/com/cpjd/roblu/sync/qr/QrReader.java index 38f5ca6..3a87342 100644 --- a/app/src/main/java/com/cpjd/roblu/sync/qr/QrReader.java +++ b/app/src/main/java/com/cpjd/roblu/sync/qr/QrReader.java @@ -82,6 +82,7 @@ public void run() { new SyncHelper(getApplicationContext(), event, SyncHelper.MODES.QR).mergeCheckout(checkout); + // Flag for upload new IO(getApplicationContext()).savePendingCheckout(checkout); Notify.notifyMerged(getApplicationContext(), event.getID(), checkout); diff --git a/app/src/main/java/com/cpjd/roblu/tba/ManualScheduleImporter.java b/app/src/main/java/com/cpjd/roblu/tba/ManualScheduleImporter.java index 5e57fdf..ae55db7 100644 --- a/app/src/main/java/com/cpjd/roblu/tba/ManualScheduleImporter.java +++ b/app/src/main/java/com/cpjd/roblu/tba/ManualScheduleImporter.java @@ -155,7 +155,7 @@ public void run() { // Expands the match code, NOTE: this doesn't remove the R or B tag private String expandMatchName(String name) { return name.replaceAll("QU", "Quarters ").replaceAll("Q", "Quals ") - .replaceAll("S", "Semis ").replaceAll("M", " Match "); + .replaceAll("S", "Semis ").replaceAll("M", " Match ").replaceAll("F", "Finals "); } } diff --git a/app/src/main/java/com/cpjd/roblu/ui/teams/TeamsView.java b/app/src/main/java/com/cpjd/roblu/ui/teams/TeamsView.java index ac4bc36..63c3741 100644 --- a/app/src/main/java/com/cpjd/roblu/ui/teams/TeamsView.java +++ b/app/src/main/java/com/cpjd/roblu/ui/teams/TeamsView.java @@ -304,7 +304,7 @@ public boolean onQueryTextChange(String newText) { settings.setUpdateLevel(Constants.VERSION); AlertDialog.Builder builder = new AlertDialog.Builder(TeamsView.this) - .setTitle("Changelist for Version 4.4.0") + .setTitle("Changelist for Version 4.4.1") .setMessage(Constants.UPDATE_MESSAGE) .setPositiveButton("Rock on", new DialogInterface.OnClickListener() { @Override diff --git a/app/src/main/java/com/cpjd/roblu/ui/teamsSorting/TeamMetricProcessor.java b/app/src/main/java/com/cpjd/roblu/ui/teamsSorting/TeamMetricProcessor.java index 2ce2ac1..3d22acd 100644 --- a/app/src/main/java/com/cpjd/roblu/ui/teamsSorting/TeamMetricProcessor.java +++ b/app/src/main/java/com/cpjd/roblu/ui/teamsSorting/TeamMetricProcessor.java @@ -3,6 +3,7 @@ import com.cpjd.roblu.models.RTab; import com.cpjd.roblu.models.RTeam; import com.cpjd.roblu.models.metrics.RBoolean; +import com.cpjd.roblu.models.metrics.RCalculation; import com.cpjd.roblu.models.metrics.RCheckbox; import com.cpjd.roblu.models.metrics.RChooser; import com.cpjd.roblu.models.metrics.RCounter; @@ -181,7 +182,9 @@ else if(method == PROCESS_METHOD.MATCHES) { } // RCounter type else if(metric instanceof RCounter) { + double value = ((RCounter) metric).getValue(); + if(i == 2) min = value; // Overview stats will only consider modified items if(metric.isModified()) { @@ -196,9 +199,33 @@ else if(metric instanceof RCounter) { // add raw data rawData.append(friendlyCounter((RCounter)metric)).append(ending(i, team.getTabs())); } + else if(metric instanceof RCalculation) { + try { + double value = Double.parseDouble(((RCalculation) metric).getValue(team.getTabs().get(i).getMetrics())); + + if(i == 2) min = value; + // Overview stats will only consider modified items + if(metric.isModified()) { + + /* + * Progressively calculate the min, max, and average values + */ + if(value < min) min = value; + if(value > max) max = value; + average += value / (double) numModified(team.getTabs(), ID); + relevance = average; + } + // add raw data + rawData.append(friendlyCounter((RCounter)metric)).append(ending(i, team.getTabs())); + } catch(Exception e) { + // eat it + } + + } // RSlider type else if(metric instanceof RSlider) { int value = ((RSlider) metric).getValue(); + if(i == 2) min = value; // Overview stats will only consider modified sliders if(metric.isModified()) { if(value < min) min = value; @@ -212,6 +239,7 @@ else if(metric instanceof RSlider) { // RStopwatch type else if(metric instanceof RStopwatch) { double value = ((RStopwatch) metric).getTime(); + if(i == 2) min = value; // Overview stats will only consider modified stopwatches if(metric.isModified()) { /* @@ -272,7 +300,23 @@ else if(metric instanceof RChooser) { // Field data else if(metric instanceof RFieldData) { // Find the sub metric - if(((RFieldData) metric).getData() != null) rawData.append(((RFieldData) metric).getData().get(inMatchTitle).get(0).toString()).append(ending(i, team.getTabs())); + if(((RFieldData) metric).getData() != null) rawData.append(((RFieldData) metric).getData().get(inMatchTitle).get(team.getTabs().get(i).isRedAlliance() ? 0 : 1).toString()).append(ending(i, team.getTabs())); + // Overview stats will only consider modified textfields + if(metric.isModified()) { + /* + * Progressively calculate the min, max, and average values + */ + try { + double value = Double.parseDouble(((RFieldData) metric).getData().get(inMatchTitle).get(team.getTabs().get(i).isRedAlliance() ? 0 : 1).toString()); + if(i == 2) min = value; + if(value < min) min = value; + if(value > max) max = value; + average += value / (double) numModified(team.getTabs(), ID); + relevance = average; + } catch(Exception e) { + // eat it + } + } } /* @@ -286,13 +330,23 @@ else if(metric instanceof RFieldData) { StringBuilder overview = new StringBuilder(); if(metric instanceof RBoolean) overview.append("Boolean: ").append(metric.getTitle()).append(" is true in ").append(occurrences).append(" / ").append(team.getTabs().size() - 2).append(" matches"); else if(metric instanceof RCounter) overview.append("Counter: ").append(metric.getTitle()).append(" Average: ").append(Utils.round(average, 2)).append(" Min: ").append(min).append(" Max: ").append(max); + else if(metric instanceof RCalculation) overview.append("Calculation: ").append(metric.getTitle()).append(" Average: ").append(Utils.round(average, 2)).append(" Min: ").append(min).append(" Max: ").append(max); else if(metric instanceof RSlider) overview.append("Slider: ").append(metric.getTitle()).append(" Average: ").append(Utils.round(average, 2)).append(" Min: ").append(min).append(" Max: ").append(max); else if(metric instanceof RStopwatch) overview.append("Stopwatch: ").append(metric.getTitle()).append(" Average: ").append(Utils.round(average, 2)).append(" Min: ").append(min).append(" Max: ").append(max); else if(metric instanceof RTextfield) overview.append("Textfield: ").append(metric.getTitle()).append(" Average chars: ").append(Utils.round(average, 2)).append(" Min: ").append(min).append(" Max: ").append(max); else if(metric instanceof RGallery) overview.append("Gallery: ").append(metric.getTitle()).append(" Average images: ").append(Utils.round(average, 2)).append(" Min: ").append(min).append(" Max: ").append(max); else if(metric instanceof RChooser) overview.append("Chooser: ").append(metric.getTitle()); else if(metric instanceof RCheckbox) overview.append("Checkbox: ").append(metric.getTitle()); - else if(metric instanceof RFieldData) overview.append("Field data: ").append(inMatchTitle); + else if(metric instanceof RFieldData) { + overview.append("Field data: ").append(inMatchTitle); + try { + // this will fail if the value isn't a number + Double.parseDouble(((RFieldData) metric).getData().get(inMatchTitle).get(0).toString()); + overview.append("\nAverage: ").append(Utils.round(average, 2)).append(" Min: ").append(min).append(" Max: ").append(max); + } catch(Exception e) { + // eat it + } + } /* * Now append the raw data as processed above diff --git a/app/src/main/java/com/cpjd/roblu/ui/tutorials/Tutorial.java b/app/src/main/java/com/cpjd/roblu/ui/tutorials/Tutorial.java index c0d6da6..26606b4 100644 --- a/app/src/main/java/com/cpjd/roblu/ui/tutorials/Tutorial.java +++ b/app/src/main/java/com/cpjd/roblu/ui/tutorials/Tutorial.java @@ -51,12 +51,11 @@ protected void onCreate(Bundle savedInstanceState) { tutorials = new ArrayList<>(); tutorials.add(new RTutorial("Text based", "View the Roblu text based tutorial", "https://docs.google.com/document/d/1DqpgKPdtfZDUc7Zu3MqdJHL59aB-ht8H1ZwllYlzMuc/edit?usp=sharing")); tutorials.add(new RTutorial("The basics", "Roblu's mission, description of platforms, terms, etc.", "9j6ysvJJyQg")); - tutorials.add(new RTutorial("Events", "Learn how to create, manage, backup, organize, and export events", "KoylfzTBvKM")); + tutorials.add(new RTutorial("Events", "Learn how to create, manage, backup, organize, and export events", "6BLlLxltppk")); tutorials.add(new RTutorial("Forms", "Learn how to create, manage, edit, organize, master form", "LpWvnavebNw")); - tutorials.add(new RTutorial("Scouting", "Learn how to scout with the RTeam model, sort, organize, search", "5ktHjyQq4XY")); - tutorials.add(new RTutorial("Roblu Cloud", "Learn how to use Roblu cloud to sync events between teammates, admin controls", "UqAVql6eps4")); - tutorials.add(new RTutorial("Bluetooth [Coming soon]", "Learn how to use setup Roblu's Bluetooth server for syncing events", "")); - tutorials.add(new RTutorial("MEGA-TUTORIAL [Coming soon]", "Feeling ambitious? Learn about everything in one video.", "")); + tutorials.add(new RTutorial("QR Codes", "Learn how to use QR code syncing", "RF4evYIlU04")); + tutorials.add(new RTutorial("CSV Exporting", "Learn about CSV exporting and defining your own CSV export schemes", "RF4evYIlU04")); + tutorials.add(new RTutorial("How to get Roblu Cloud for free", "Get Roblu Cloud for free", "dQw4w9WgXcQ")); tutorials.add(new RTutorial("Roblu Devlogs", "For those interested in watching the development process", "")); /* diff --git a/app/src/main/java/com/cpjd/roblu/utils/Constants.java b/app/src/main/java/com/cpjd/roblu/utils/Constants.java index 3cf9c91..857edb7 100644 --- a/app/src/main/java/com/cpjd/roblu/utils/Constants.java +++ b/app/src/main/java/com/cpjd/roblu/utils/Constants.java @@ -12,9 +12,8 @@ public abstract class Constants { public static final String SERVICE_ID = "com.cpjd.roblu.service"; - public static final String RESTART_BROADCAST = "com.cpjd.roblu.service.RestartService"; - public static final String UPDATE_MESSAGE = "-Bug fixes"; + public static final String UPDATE_MESSAGE = "-Added field data metric\n-Master form can be backed up\nAdded manual match schedule importer\n-Bug fixes"; public static final int VERSION = 11; // used for updating the changelist