Skip to content

Commit

Permalink
Update standings warning
Browse files Browse the repository at this point in the history
  • Loading branch information
slmnio committed Jan 27, 2022
1 parent eaa2e42 commit 78b4d5b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions website/src/components/broadcast/Standings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
</div>
</div>
</div>
<div class="warnings mt-2" v-if="standings && standings.warnings.length">
<div class="warning bg-warning text-dark p-1 px-2" v-for="warn in standings.warnings" v-bind:key="warn">{{ warn }}</div>
<div class="warnings flex-center flex-column mt-2 mx-2" v-if="standings && standings.warnings.length">
<div class="warning bg-warning text-dark p-1 px-2 mb-1" v-for="warn in standings.warnings" v-bind:key="warn">{{ warn }}</div>
</div>
</div>
</template>
Expand Down Expand Up @@ -288,4 +288,7 @@ export default {
font-weight: bold;
font-size: 18px;
}
.warning {
max-width: calc(100vw - 2em);
}
</style>
7 changes: 5 additions & 2 deletions website/src/utils/scenarios.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ function getSortMethod(stringMethod) {
export function sortTeamsIntoStandings(teams, settings = {}) {
const log = false;
if (log) console.log("[standings]", "starting sort", teams, settings);
const warnings = [];
let warnings = [];

if (settings.sort) {
// Custom sort
Expand All @@ -344,7 +344,7 @@ export function sortTeamsIntoStandings(teams, settings = {}) {
const _method = getSortMethod(mode);
if (!_method) {
console.warn(`No sorting method for ${mode}`);
warnings.push(`Warning: theses standings needs to be sorted by "${mode}" but it has not been implemented on the site. The real standings may be different, or need to be manually calculated. The sorting order is: ${settings.sort.join(", ")}`);
warnings.push(mode);
continue;
}
const { prep, method, max } = _method;
Expand All @@ -358,6 +358,9 @@ export function sortTeamsIntoStandings(teams, settings = {}) {
}
if (log) console.log("[standings]", `[${mode}]`, standings);
}

if (warnings?.length) warnings = [`Warning: theses standings needs to be sorted by ${warnings.map(e => `[${e}]`).join(", ")} but it has not been implemented on the site. It has been sorted with the available sorting methods, but may need to be manually sorted to be fully accurate.`, `The sorting order for these standings are: ${settings.sort.join(", ")}.`];

return { standings, warnings };
}

Expand Down

0 comments on commit 78b4d5b

Please sign in to comment.