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", "type": "string",
"default": "" "default": ""
}, },
"team": { "name": {
"type": "string", "type": "string",
"default": "" "default": ""
}, },
@@ -17,36 +17,21 @@
"type": "string", "type": "string",
"default": "" "default": ""
}, },
"team": {
"type": "string",
"default": ""
},
"twitter": { "twitter": {
"type": "string", "type": "string",
"default": "" "default": ""
},
"realName": {
"type": "string",
"default": ""
},
"pronouns": {
"type": "string",
"default": ""
},
"twitch": {
"type": "string",
"default": ""
},
"notes": {
"type": "string",
"default": ""
} }
}, },
"required": [ "required": [
"gamertag", "gamertag",
"team", "name",
"country", "country",
"twitter", "team",
"realName", "twitter"
"pronouns",
"twitch",
"notes"
] ]
}, },
"default": {} "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>) : {}; const candidate = typeof input === 'object' && input !== null ? (input as Record<string, unknown>) : {};
return { return {
gamertag: typeof candidate.gamertag === 'string' ? candidate.gamertag : '', gamertag: typeof candidate.gamertag === 'string' ? candidate.gamertag : '',
name: typeof candidate.name === 'string' ? candidate.name : '',
team: typeof candidate.team === 'string' ? candidate.team : '', team: typeof candidate.team === 'string' ? candidate.team : '',
country: typeof candidate.country === 'string' ? candidate.country : '', country: typeof candidate.country === 'string' ? candidate.country : '',
twitter: typeof candidate.twitter === 'string' ? candidate.twitter : '', 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 = { const emptyPlayer: Player = {
gamertag: '', gamertag: '',
team: '', name: '',
country: '', country: '',
team: '',
twitter: '', twitter: '',
realName: '',
pronouns: '',
twitch: '',
notes: '',
}; };
const form = reactive<Player>({ ...emptyPlayer }); const form = reactive<Player>({ ...emptyPlayer });
@@ -88,7 +85,8 @@ const openCreateDialog = () => {
const openEditDialog = (row: PlayerRow) => { const openEditDialog = (row: PlayerRow) => {
editingId.value = row.id; editingId.value = row.id;
const { id: _id, ...playerData } = row; const { id, ...playerData } = row;
void id;
Object.assign(form, playerData); Object.assign(form, playerData);
isDialogOpen.value = true; isDialogOpen.value = true;
}; };
@@ -132,7 +130,7 @@ const handleImport = async (event: Event) => {
const text = await file.text(); const text = await file.text();
const parsed = JSON.parse(text) as unknown; const parsed = JSON.parse(text) as unknown;
playersStore.setPlayers(parsed as PlayersMap); playersStore.setPlayers(parsed as PlayersMap);
} catch (error) { } catch {
window.alert('No se pudo importar el JSON. Verifica el formato.'); window.alert('No se pudo importar el JSON. Verifica el formato.');
} finally { } finally {
if (target) { if (target) {
@@ -242,8 +240,8 @@ const handleImport = async (event: Event) => {
</div> </div>
<div class="col-12 col-md-6"> <div class="col-12 col-md-6">
<QInput <QInput
v-model="form.team" v-model="form.name"
label="Team" label="Name"
dense dense
outlined outlined
/> />
@@ -268,6 +266,14 @@ const handleImport = async (event: Event) => {
outlined outlined
/> />
</div> </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"> <div class="col-12 col-md-6">
<QInput <QInput
v-model="form.twitter" v-model="form.twitter"
@@ -276,40 +282,6 @@ const handleImport = async (event: Event) => {
outlined outlined
/> />
</div> </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> </div>
</QForm> </QForm>
</QCardSection> </QCardSection>
+2 -5
View File
@@ -9,12 +9,9 @@
export interface Players { export interface Players {
[k: string]: { [k: string]: {
gamertag: string; gamertag: string;
team: string; name: string;
country: string; country: string;
team: string;
twitter: string; twitter: string;
realName: string;
pronouns: string;
twitch: string;
notes: string;
}; };
} }