Skip to content

Commit

Permalink
Minor dashboard and logic updates
Browse files Browse the repository at this point in the history
  • Loading branch information
slmnio committed Dec 30, 2022
1 parent 741a50c commit 9e8c6bb
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 11 deletions.
5 changes: 3 additions & 2 deletions server/src/actions/resolve-entire-bracket.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,15 @@ module.exports = {
team._position = connection.position;
correctTeams[parseInt(connection.position) - 1] = team;
});
console.log("correct teams", correctTeams);
console.log("correct teams", correctTeams.map(t => t?.code || t));

correctTeams = correctTeams.filter(c => c);

if (correctTeams.length === 0) {
// no updates
} else if (correctTeams.length === 1) {
let placeholderRight = correctTeams[0]._position === 1; // (not 2)
let placeholderRight = parseInt(correctTeams[0]._position) === 1; // (not 2)
console.log(matchNum, correctTeams[0]._position, placeholderRight);

let response = await this.helpers.updateRecord("Matches", match, {
"Teams": [correctTeams[0].id],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
{{ imp.special.toUpperCase() }}
</div>
</div>
<div v-if="imp.otherMatch" class="other-match">
advances to <router-link :to="url(linkToDetailedMatch ? 'detailed' : 'match', imp.otherMatch)">
<span v-if="imp.otherMatch.round">{{ imp.otherMatch.round }}</span> <span v-if="imp.otherMatch.match_number">(M{{ imp.otherMatch.match_number }})</span>
</router-link>
</div>
<div v-if="imp.facingTeam" class="other-team flex-center flex-column">
<router-link v-if="imp.facingTeam" :to="url('team', imp.facingTeam)" class="box" :style="facingTeamTheme"></router-link>
<div class="box-text">faces <router-link :to="url('team', imp.facingTeam)">{{ imp.facingTeam.name }}</router-link></div>
Expand All @@ -25,11 +30,6 @@
Faces {{ imp.feederMatch.feederTake.toLowerCase() }} of <router-link :to="url(linkToDetailedMatch ? 'detailed' : 'match', imp.feederMatch)">{{ imp.feederMatch.name }}</router-link>
</div>
</div>
<div v-if="imp.otherMatch" class="other-match">
in <router-link :to="url(linkToDetailedMatch ? 'detailed' : 'match', imp.otherMatch)">
<span v-if="imp.otherMatch.round">{{ imp.otherMatch.round }}</span> <span v-if="imp.otherMatch.match_number">(M{{ imp.otherMatch.match_number }})</span>
</router-link>
</div>
</div>
<!-- <div class="bracket-implication-match">-->
<!-- <b>{{ relation }}</b>-->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<template>
<tr class="schedule-editor-match">
<td>{{ match.name }}</td>
<td>
<router-link :to="url('detailed', match)">{{ match.name }}</router-link>
</td>
<td>{{ prettyDate }}</td>
<td>
<div class="btn-group">
Expand All @@ -20,7 +22,7 @@
</template>

<script>
import { formatTime } from "@/utils/content-utils";
import { formatTime, url } from "@/utils/content-utils";
import { BFormCheckbox } from "bootstrap-vue";
import { setMatchOverlayState, updateBroadcastData } from "@/utils/dashboard";
Expand All @@ -37,6 +39,7 @@ export default {
}
},
methods: {
url,
async setLiveMatch(state) {
await updateBroadcastData(this.$root.auth, {
match: state ? this.match.id : null
Expand Down
14 changes: 12 additions & 2 deletions website/src/utils/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ export async function managePred(auth, client, predictionAction) {
}
return await authenticatedRequest(auth, "actions/manage-prediction", {
client: client.id || client,
predictionAction//,
// autoLockAfter: 60
predictionAction,
autoLockAfter: 300
});
}

Expand Down Expand Up @@ -134,3 +134,13 @@ export async function setMatchOverlayState(auth, matchID, overlayType, state) {
state
});
}

export async function resolveEntireBracket(auth, bracketID) {
if (!auth?.user) {
notyf.error("Not authenticated");
return { error: true, errorMessage: "Not authenticated" };
}
return await authenticatedRequest(auth, "actions/resolve-entire-bracket", {
bracketID
});
}

0 comments on commit 9e8c6bb

Please sign in to comment.