Show stage item input options correctly (#971)

This commit is contained in:
Erik Vroon
2024-10-28 08:23:11 +01:00
committed by GitHub
parent d420e94fcb
commit f8d6d77704
2 changed files with 22 additions and 22 deletions

View File

@@ -80,7 +80,6 @@ def determine_ranking_for_stage_item(
if not round_.is_draft
for match in round_.matches
if isinstance(match, MatchWithDetailsDefinitive)
if match.stage_item_input1_score != 0 or match.stage_item_input2_score != 0
]
for match in matches:
for team_index, stage_item_input in enumerate(match.stage_item_inputs):

View File

@@ -155,31 +155,31 @@ export function getAvailableInputs(
stageItemMap: any
) {
const getComboBoxOptionForStageItemInput = (option: StageItemInputOption) => {
if (option.winner_from_stage_item_id == null) {
if (option.team_id == null) return null;
const team = teamsMap[option.team_id];
if (team == null) return null;
assert(option.team_id === team.id);
if (option.winner_from_stage_item_id != null) {
assert(option.winner_position != null);
const stageItem = stageItemMap[option.winner_from_stage_item_id];
if (stageItem == null) return null;
return {
value: `${option.team_id}`,
label: team.name,
team_id: team.id,
winner_from_stage_item_id: null,
winner_position: null,
value: `${option.winner_from_stage_item_id}_${option.winner_position}`,
label: `${formatStageItemInput(option.winner_position, stageItem.name)}`,
team_id: null,
winner_from_stage_item_id: option.winner_from_stage_item_id,
winner_position: option.winner_position,
already_taken: option.already_taken,
};
}
assert(option.winner_position != null);
const stageItem = stageItemMap[option.winner_from_stage_item_id];
if (stageItem == null) return null;
if (option.team_id == null) return null;
const team = teamsMap[option.team_id];
if (team == null) return null;
assert(option.team_id === team.id);
return {
value: `${option.winner_from_stage_item_id}_${option.winner_position}`,
label: `${formatStageItemInput(option.winner_position, stageItem.name)}`,
team_id: null,
winner_from_stage_item_id: option.winner_from_stage_item_id,
winner_position: option.winner_position,
value: `${option.team_id}`,
label: team.name,
team_id: team.id,
winner_from_stage_item_id: null,
winner_position: null,
already_taken: option.already_taken,
};
};
@@ -249,10 +249,11 @@ function StageItemRow({
.sort((i1, i2) => (i1.slot > i2.slot ? 1 : -1))
.map((input, i) => {
let currentOptionValue = null;
if (input.winner_from_stage_item_id != null) {
currentOptionValue = `${input.winner_from_stage_item_id}_${input.winner_position}`;
} else
if (input.team_id != null) {
currentOptionValue = `${input.team_id}`;
} else if (input.winner_from_stage_item_id != null) {
currentOptionValue = `${input.winner_from_stage_item_id}_${input.winner_position}`;
}
return (