Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include side choices in seasons. #159

Merged
merged 1 commit into from
Sep 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/components/NewMatchForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ export default {
veto_first: "team1",
spectators: [],
side_type: "standard",
map_sides: [[]]
map_sides: []
},
selectedTeams: [],
newDialog: false,
Expand Down Expand Up @@ -441,6 +441,10 @@ export default {
seasonCvars.spectators.length < 1
? null
: seasonCvars.spectators.trim().split(" ");
this.newMatchData.map_sides =
seasonCvars.map_sides.length < 1
? []
: seasonCvars.map_sides.trim().split(" ");
//Delete all used get prepare custom CVARs.
delete seasonCvars.min_players_to_ready;
delete seasonCvars.min_spectators_to_ready;
Expand All @@ -450,6 +454,7 @@ export default {
delete seasonCvars.map_pool;
delete seasonCvars.side_type;
delete seasonCvars.spectators;
delete seasonCvars.map_sides;
// Now set Match CVARs. These will be converted back on submit.
let tmpCvarArr = [];
for (var obj in seasonCvars)
Expand Down
60 changes: 55 additions & 5 deletions src/components/SeasonsTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,49 @@
</v-col>
</v-radio-group>
</v-row>
<v-row class="justify-center" v-if="seasonDefaults.skip_veto">
<v-col
lg="3"
md="12"
sm="12"
v-for="(entity, index) in seasonDefaults.maps_to_win"
:key="index"
>
<v-col class="text-left text-h6">
{{
$t("CreateMatch.MapSides", {
map:
seasonDefaults.map_pool[index] == null
? entity
: seasonDefaults.map_pool[index]
})
}}
</v-col>
<v-radio-group
row
v-model="seasonDefaults.map_sides[index]"
>
<v-col lg="12" sm="12" align-self="center">
<v-radio
:label="$t('CreateMatch.MapSidesTeam1CT')"
:value="'team1_ct'"
/>
</v-col>
<v-col lg="12" sm="12" align-self="center">
<v-radio
:label="$t('CreateMatch.MapSidesTeam2CT')"
:value="'team1_t'"
/>
</v-col>
<v-col lg="12" sm="12" align-self="center">
<v-radio
:label="$t('CreateMatch.MapSidesKnife')"
:value="'knife'"
/>
</v-col>
</v-radio-group>
</v-col>
</v-row>
<v-row class="pt-6">
<v-col cols="12">
<v-combobox
Expand Down Expand Up @@ -435,7 +478,8 @@ export default {
skip_veto: false,
map_pool: [],
spectators: [],
side_type: "standard"
side_type: "standard",
map_sides: []
},
datemenu: false,
formTitle: this.$t("Seasons.NewFormTitle"),
Expand Down Expand Up @@ -482,7 +526,8 @@ export default {
skip_veto: false,
map_pool: [],
spectators: [],
side_type: "standard"
side_type: "standard",
map_sides: []
};
this.$refs.newSeasonForm.resetValidation();
});
Expand Down Expand Up @@ -579,6 +624,8 @@ export default {
newCvar.spectators =
newCvar.spectators != "" ? newCvar.spectators.join(" ") : "";
newCvar.map_pool = newCvar.map_pool.join(" ");
newCvar.map_sides =
newCvar.map_sides != "" ? newCvar.map_sides.join(" ") : "";
}
if (this.newSeason.id == null) {
let serverObj = [
Expand Down Expand Up @@ -637,7 +684,8 @@ export default {
skip_veto: false,
map_pool: [],
spectators: [],
side_type: "standard"
side_type: "standard",
map_sides: []
};
this.$refs.newSeasonForm.resetValidation();
});
Expand All @@ -655,7 +703,6 @@ export default {
// If our cvars are empty, make an empty object instead to allow future saving.
if (typeof seasonCvars == "string") seasonCvars = {};
else {
console.log(seasonCvars);
for (let obj in seasonCvars) {
if (
obj !== "min_players_to_ready" &&
Expand All @@ -666,7 +713,8 @@ export default {
obj !== "skip_veto" &&
obj !== "map_pool" &&
obj !== "spectators" &&
obj !== "side_type"
obj !== "side_type" &&
obj !== "map_sides"
)
tmpArr.push(obj + " " + seasonCvars[obj]);
else if (
Expand All @@ -679,6 +727,8 @@ export default {
else if (obj === "skip_veto") {
seasonCvars[obj] = seasonCvars[obj] == 0 ? false : true;
this.seasonDefaults[obj] = seasonCvars[obj];
} else if (obj === "map_sides") {
this.seasonDefaults[obj] = seasonCvars[obj].split(" ");
} else this.seasonDefaults[obj] = seasonCvars[obj];
}
}
Expand Down