Remove legacy realName fallback from player normalization (#31)

This commit is contained in:
Pandipipas
2026-02-10 12:42:47 +01:00
committed by GitHub
parent 547f9ab95f
commit 48b098ac0a
4 changed files with 26 additions and 75 deletions
+8 -23
View File
@@ -9,7 +9,7 @@
"type": "string",
"default": ""
},
"team": {
"name": {
"type": "string",
"default": ""
},
@@ -17,36 +17,21 @@
"type": "string",
"default": ""
},
"team": {
"type": "string",
"default": ""
},
"twitter": {
"type": "string",
"default": ""
},
"realName": {
"type": "string",
"default": ""
},
"pronouns": {
"type": "string",
"default": ""
},
"twitch": {
"type": "string",
"default": ""
},
"notes": {
"type": "string",
"default": ""
}
},
"required": [
"gamertag",
"team",
"name",
"country",
"twitter",
"realName",
"pronouns",
"twitch",
"notes"
"team",
"twitter"
]
},
"default": {}
+1 -4
View File
@@ -12,13 +12,10 @@ const normalizePlayer = (input: unknown): Player => {
const candidate = typeof input === 'object' && input !== null ? (input as Record<string, unknown>) : {};
return {
gamertag: typeof candidate.gamertag === 'string' ? candidate.gamertag : '',
name: typeof candidate.name === 'string' ? candidate.name : '',
team: typeof candidate.team === 'string' ? candidate.team : '',
country: typeof candidate.country === 'string' ? candidate.country : '',
twitter: typeof candidate.twitter === 'string' ? candidate.twitter : '',
realName: typeof candidate.realName === 'string' ? candidate.realName : '',
pronouns: typeof candidate.pronouns === 'string' ? candidate.pronouns : '',
twitch: typeof candidate.twitch === 'string' ? candidate.twitch : '',
notes: typeof candidate.notes === 'string' ? candidate.notes : '',
};
};
+15 -43
View File
@@ -25,13 +25,10 @@ const fileInput = ref<HTMLInputElement | null>(null);
const emptyPlayer: Player = {
gamertag: '',
team: '',
name: '',
country: '',
team: '',
twitter: '',
realName: '',
pronouns: '',
twitch: '',
notes: '',
};
const form = reactive<Player>({ ...emptyPlayer });
@@ -88,7 +85,8 @@ const openCreateDialog = () => {
const openEditDialog = (row: PlayerRow) => {
editingId.value = row.id;
const { id: _id, ...playerData } = row;
const { id, ...playerData } = row;
void id;
Object.assign(form, playerData);
isDialogOpen.value = true;
};
@@ -132,7 +130,7 @@ const handleImport = async (event: Event) => {
const text = await file.text();
const parsed = JSON.parse(text) as unknown;
playersStore.setPlayers(parsed as PlayersMap);
} catch (error) {
} catch {
window.alert('No se pudo importar el JSON. Verifica el formato.');
} finally {
if (target) {
@@ -242,8 +240,8 @@ const handleImport = async (event: Event) => {
</div>
<div class="col-12 col-md-6">
<QInput
v-model="form.team"
label="Team"
v-model="form.name"
label="Name"
dense
outlined
/>
@@ -268,6 +266,14 @@ const handleImport = async (event: Event) => {
outlined
/>
</div>
<div class="col-12 col-md-6">
<QInput
v-model="form.team"
label="Team"
dense
outlined
/>
</div>
<div class="col-12 col-md-6">
<QInput
v-model="form.twitter"
@@ -276,40 +282,6 @@ const handleImport = async (event: Event) => {
outlined
/>
</div>
<div class="col-12 col-md-6">
<QInput
v-model="form.realName"
label="Nombre real"
dense
outlined
/>
</div>
<div class="col-12 col-md-6">
<QInput
v-model="form.pronouns"
label="Pronombres"
dense
outlined
/>
</div>
<div class="col-12 col-md-6">
<QInput
v-model="form.twitch"
label="Twitch"
dense
outlined
/>
</div>
<div class="col-12">
<QInput
v-model="form.notes"
type="textarea"
label="Notas"
dense
outlined
autogrow
/>
</div>
</div>
</QForm>
</QCardSection>
+2 -5
View File
@@ -9,12 +9,9 @@
export interface Players {
[k: string]: {
gamertag: string;
team: string;
name: string;
country: string;
team: string;
twitter: string;
realName: string;
pronouns: string;
twitch: string;
notes: string;
};
}