fix: map server names to location codes (fr, usa) in the option values
This commit is contained in:
@@ -562,12 +562,17 @@
|
|||||||
if (minAvail <= 0) {
|
if (minAvail <= 0) {
|
||||||
sel.classList.add('no-seats');
|
sel.classList.add('no-seats');
|
||||||
}
|
}
|
||||||
|
const SERVER_CODES = {
|
||||||
|
france: "fr",
|
||||||
|
"united states": "usa",
|
||||||
|
};
|
||||||
|
|
||||||
servers.forEach(function(s) {
|
servers.forEach(function(s) {
|
||||||
const server = s.server || '';
|
const server = s.server || '';
|
||||||
const available = parseInt(s['Seats Available'], 10) || 0;
|
const available = parseInt(s['Seats Available'], 10) || 0;
|
||||||
const label = server.charAt(0).toUpperCase() + server.slice(1);
|
const label = server.charAt(0).toUpperCase() + server.slice(1);
|
||||||
const opt = document.createElement('option');
|
const opt = document.createElement('option');
|
||||||
opt.value = s.code || '';
|
opt.value = SERVER_CODES[server.toLowerCase()] || server.toLowerCase().replace(/\s+/g, '-');
|
||||||
if (available <= 0) {
|
if (available <= 0) {
|
||||||
opt.textContent = label + ' (sold out)';
|
opt.textContent = label + ' (sold out)';
|
||||||
opt.disabled = true;
|
opt.disabled = true;
|
||||||
|
|||||||
+6
-1
@@ -667,12 +667,17 @@ async function initServerLocations() {
|
|||||||
sel.classList.add("no-seats");
|
sel.classList.add("no-seats");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const SERVER_CODES = {
|
||||||
|
france: "fr",
|
||||||
|
"united states": "usa",
|
||||||
|
};
|
||||||
|
|
||||||
servers.forEach(function (s) {
|
servers.forEach(function (s) {
|
||||||
const server = s.server || "";
|
const server = s.server || "";
|
||||||
const available = parseInt(s["Seats Available"], 10) || 0;
|
const available = parseInt(s["Seats Available"], 10) || 0;
|
||||||
const label = server.charAt(0).toUpperCase() + server.slice(1);
|
const label = server.charAt(0).toUpperCase() + server.slice(1);
|
||||||
const opt = document.createElement("option");
|
const opt = document.createElement("option");
|
||||||
opt.value = s.code || "";
|
opt.value = SERVER_CODES[server.toLowerCase()] || server.toLowerCase().replace(/\s+/g, "-");
|
||||||
|
|
||||||
if (available <= 0) {
|
if (available <= 0) {
|
||||||
// No seats — red, disabled, cannot select
|
// No seats — red, disabled, cannot select
|
||||||
|
|||||||
Reference in New Issue
Block a user