Skip to content

Commit

Permalink
Match Uploading Overhaul
Browse files Browse the repository at this point in the history
  • Loading branch information
Techno11 committed Jan 4, 2019
1 parent 6613edf commit ebe824b
Show file tree
Hide file tree
Showing 6 changed files with 528 additions and 466 deletions.
2 changes: 1 addition & 1 deletion src/org/theorangealliance/datasync/DataSyncController.java
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ public void postMatchSchedule() {

@FXML
public void postSelectedMatch() {
this.matchesController.postSelectedMatch();
this.matchesController.postSelectedMatchAskUser();
}

@FXML
Expand Down
44 changes: 44 additions & 0 deletions src/org/theorangealliance/datasync/json/toa/MatchGeneralJSON.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,50 @@
*/
public class MatchGeneralJSON {

public MatchGeneralJSON(String matchKey, String eventKey, int tournamentLevel, String scheduledTime, String matchName, int playNumber, int fieldNumber, String lastCommitTime, int redScore, int blueScore, int redPenalty, int bluePenalty, int redAutoScore, int blueAutoScore, int redTeleScore, int blueTeleScore, int redEndScore, int blueEndScore, String videoUrl) {
this.matchKey = matchKey;
this.eventKey = eventKey;
this.tournamentLevel = tournamentLevel;
this.scheduledTime = scheduledTime;
this.matchName = matchName;
this.playNumber = playNumber;
this.fieldNumber = fieldNumber;
this.lastCommitTime = lastCommitTime;
this.redScore = redScore;
this.blueScore = blueScore;
this.redPenalty = redPenalty;
this.bluePenalty = bluePenalty;
this.redAutoScore = redAutoScore;
this.blueAutoScore = blueAutoScore;
this.redTeleScore = redTeleScore;
this.blueTeleScore = blueTeleScore;
this.redEndScore = redEndScore;
this.blueEndScore = blueEndScore;
this.videoUrl = videoUrl;
}

public MatchGeneralJSON() {
this.matchKey = "";
this.eventKey = "";
this.tournamentLevel = 0;
this.scheduledTime = "";
this.matchName = "";
this.playNumber = 1;
this.fieldNumber = 0;
this.lastCommitTime = "";
this.redScore = 0;
this.blueScore = 0;
this.redPenalty = 0;
this.bluePenalty = 0;
this.redAutoScore = 0;
this.blueAutoScore = 0;
this.redTeleScore = 0;
this.blueTeleScore = 0;
this.redEndScore = 0;
this.blueEndScore = 0;
this.videoUrl = "";
}

@SerializedName("match_key")
private String matchKey;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,56 @@

public class MatchParticipantJSON {

public MatchParticipantJSON() {
this.matchParticipantKey = "";
this.matchKey = "";
this.teamKey = 0;
this.station = 0;
this.stationStatus = 0;
this.refStatus = 0;
}

public MatchParticipantJSON(String matchKey, int station, int teamKey) {
this.matchKey = matchKey;
this.station = station;
this.teamKey = teamKey;
this.matchParticipantKey = this.matchKey + "-" + getStationSuffix();
this.stationStatus = 1;
}

private String getStationSuffix() {
String suffix = "";
switch (station) {
case 11:
suffix = "R1";
break;
case 12:
suffix = "R2";
break;
case 13:
suffix = "R3";
break;
case 21:
suffix = "B1";
break;
case 22:
suffix = "B2";
break;
case 23:
suffix = "B3";
break;
}
return suffix;
}

@SerializedName("match_participant_key")
private String matchParticipantKey;

@SerializedName("match_key")
private String matchKey;

@SerializedName("team_key")
private String teamKey;
private int teamKey;

@SerializedName("station")
private int station;
Expand All @@ -38,11 +80,11 @@ public void setMatchKey(String matchKey) {
this.matchKey = matchKey;
}

public String getTeamKey() {
public int getTeamKey() {
return teamKey;
}

public void setTeamKey(String teamKey) {
public void setTeamKey(int teamKey) {
this.teamKey = teamKey;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.theorangealliance.datasync.models;

import org.theorangealliance.datasync.json.toa.MatchParticipantJSON;

public class MatchGeneralAndMatchParticipant {

public MatchGeneralAndMatchParticipant () {
Expand All @@ -9,7 +11,7 @@ public MatchGeneralAndMatchParticipant () {

private MatchGeneral MatchGeneral;

private MatchParticipant[] MatchParticipants;
private MatchParticipantJSON[] MatchParticipants;

public org.theorangealliance.datasync.models.MatchGeneral getMatchGeneral() {
return MatchGeneral;
Expand All @@ -19,11 +21,11 @@ public void setMatchGeneral(org.theorangealliance.datasync.models.MatchGeneral m
MatchGeneral = matchGeneral;
}

public MatchParticipant[] getMatchParticipants() {
public MatchParticipantJSON[] getMatchParticipants() {
return MatchParticipants;
}

public void setMatchParticipants(MatchParticipant[] matchParticipants) {
public void setMatchParticipants(MatchParticipantJSON[] matchParticipants) {
MatchParticipants = matchParticipants;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

/**
* Created by Kyle Flynn on 11/29/2017.
* @deprecated by Soren Zaiser
* Reason: Just Use the JSON model
*/
public class MatchParticipant {

Expand Down
Loading

0 comments on commit ebe824b

Please sign in to comment.