Skip to content

Commit

Permalink
Fixed several small things.
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle-flynn committed Oct 10, 2019
1 parent 4b1095f commit 3607898
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 14 deletions.
2 changes: 1 addition & 1 deletion ems-core/public/main/Matchmaker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ interface IMatchMakerOptions {
let matchMakerPath = "";
if (os.type() === "Windows_NT") {
if (isProd) {
matchMakerPath = path.join(__dirname, "../match-maker/macOS/MatchMaker");
matchMakerPath = path.join(__dirname, "../match-maker/windows/MatchMaker");
} else {
matchMakerPath = path.join(__dirname, "../../match-maker/windows/MatchMaker.exe");
}
Expand Down
6 changes: 5 additions & 1 deletion ems-core/src/managers/MatchManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,11 @@ class MatchManager {
match.matchDetails.matchKey = match.matchKey;
match.matchDetails.matchDetailKey = match.matchDetailKey;
for (const participant of match.participants) {
if (typeof participant.cardStatus === "undefined" || (participant.cardStatus as any) === "null") {
if (typeof participant.cardStatus === "undefined"
|| (participant.cardStatus as any) === "null"
|| (participant.cardStatus) > 2
|| (isNaN(participant.cardStatus))
|| (participant.cardStatus) < 0) {
participant.cardStatus = 0;
}
}
Expand Down
30 changes: 19 additions & 11 deletions ems-core/src/views/event-manager/views/EventAdvancement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {Dispatch} from "redux";
import {connect} from "react-redux";
import {Card, Tab, TabProps} from "semantic-ui-react";
import {SyntheticEvent} from "react";
import TournamentRound from "@the-orange-alliance/lib-ems/dist/models/ems/TournamentRound";
import {Team, TournamentRound} from "@the-orange-alliance/lib-ems";
import TournamentRoundCard from "../../../components/TournamentRoundCard";
import {CONFIG_STORE} from "../../../AppStore";
import DialogManager from "../../../managers/DialogManager";
Expand All @@ -30,6 +30,7 @@ interface IProps {
playoffsMatches: Match[],
eventConfig?: EventConfiguration,
event?: Event,
teams?: Team[],
toaConfig?: TOAConfig,
navigationDisabled?: boolean,
setNavigationDisabled?: (disabled: boolean) => IDisableNavigation,
Expand Down Expand Up @@ -162,22 +163,28 @@ class EventAdvancementView extends React.Component<IProps, IState> {
}

private onPublishSchedule() {
const {eventConfig, teams, playoffsSchedule} = this.props;
this.props.setNavigationDisabled(true);
const matches: Match[] = this.props.playoffsMatches.filter((m: Match) => m.matchKey.split("-")[3].substring(1, 2) === (this.props.eventConfig.activeTournamentID + ""));
if (this.props.toaConfig.enabled) {
UploadManager.postMatchSchedule(this.props.event.eventKey, matches).then(() => {
console.log(`${matches.length} matches have been posted to TOA.`);
EventCreationManager.createRanks(teams.filter((t: Team) => playoffsSchedule[eventConfig.activeTournamentID].teams.indexOf(t.teamKey) > 0), this.props.event.eventKey).then(() => {
if (this.props.toaConfig.enabled) {
UploadManager.postMatchSchedule(this.props.event.eventKey, matches).then(() => {
console.log(`${matches.length} matches have been posted to TOA.`);
}).catch((error: HttpError) => {
DialogManager.showErrorBox(error);
});
}
EventCreationManager.createPlayoffsSchedule(matches).then(() => {
this.props.setNavigationDisabled(false);
this.props.onComplete();
}).catch((error: HttpError) => {
console.log(error);
this.props.setNavigationDisabled(false);
DialogManager.showErrorBox(error);
});
}
EventCreationManager.createPlayoffsSchedule(matches).then(() => {
}).catch((rankError: HttpError) => {
this.props.setNavigationDisabled(false);
this.props.onComplete();
}).catch((error: HttpError) => {
console.log(error);
this.props.setNavigationDisabled(false);
DialogManager.showErrorBox(error);
DialogManager.showErrorBox(rankError);
});
}

Expand Down Expand Up @@ -227,6 +234,7 @@ function mapStateToProps({configState, internalState}: IApplicationState) {
return {
event: configState.event,
eventConfig: configState.eventConfiguration,
team: internalState.teamList,
toaConfig: configState.toaConfig,
playoffsSchedule: configState.playoffsSchedule,
playoffsMatches: internalState.playoffsMatches
Expand Down
5 changes: 5 additions & 0 deletions ems-core/src/views/match-play/containers/MatchPlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,11 @@ class MatchPlay extends React.Component<IProps, IState> {
this.setState({committingScores: true});
activeMatch.matchDetails = this.props.activeDetails;
activeMatch.participants = this.props.activeParticipants;
for (const participant of activeMatch.participants) {
if ([0, 1 , 2].indexOf(participant.cardStatus) < 0) {
participant.cardStatus = 0;
}
}
MatchManager.commitScores(activeMatch, eventConfig).then(() => {
if (this.props.toaConfig.enabled) {
UploadManager.postMatchResults(event.eventKey, activeMatch).then(() => {
Expand Down
2 changes: 1 addition & 1 deletion ems-home/src/pages/DownloadsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class DownloadsPage extends React.Component {
<ListItemText primary={"Node.js"}/>
</ListItem>
<ListItem button={true} onClick={this.downloadTournamentConfig}>
<ListItemText primary={"Node.js"}/>
<ListItemText primary={"FIRST Global 2019 Tournament Configuration"}/>
</ListItem>
<ListItem button={true} onClick={this.downloadChromeAPK}>
<ListItemText primary={"Google chrome android apk"}/>
Expand Down

0 comments on commit 3607898

Please sign in to comment.