↙ added default fallback parsing to ImportRunnerModal

ref #13
This commit is contained in:
Philipp Dormann 2021-01-20 17:56:32 +01:00
parent 6b91b22713
commit ecad1ea839
3 changed files with 13 additions and 11 deletions

View File

@ -58,15 +58,13 @@
}).showToast(); }).showToast();
recent_processed = false; recent_processed = false;
const mapped = json_output.map(function (runner) { const mapped = json_output.map(function (runner) {
let team = runner[`${$_("csv_import__team")}`];
if (runner["Klasse"]) {
team = runner["Klasse"];
}
return { return {
firstname: runner[`${$_("csv_import__firstname")}`], firstname: runner[`${$_("csv_import__firstname")}`],
middlename: runner[`${$_("csv_import__middlename")}`], middlename: runner[`${$_("csv_import__middlename")}`],
lastname: runner[`${$_("csv_import__lastname")}`], lastname: runner[`${$_("csv_import__lastname")}`],
team: team, team:
runner[`${$_("csv_import__team")}`] ||
runner[`${$_("csv_import__class")}`],
}; };
}); });
console.log(mapped); console.log(mapped);
@ -183,16 +181,16 @@
.includes(searchvalue)} .includes(searchvalue)}
<tr> <tr>
<td class="px-6 py-4 whitespace-nowrap"> <td class="px-6 py-4 whitespace-nowrap">
{runner['Vorname']} {runner[`${$_('csv_import__firstname')}`]}
</td> </td>
<td class="px-6 py-4 whitespace-nowrap"> <td class="px-6 py-4 whitespace-nowrap">
{runner['Zweitname'] || ''} {runner[`${$_('csv_import__middlename')}`] || ''}
</td> </td>
<td class="px-6 py-4 whitespace-nowrap"> <td class="px-6 py-4 whitespace-nowrap">
{runner['Nachname']} {runner[`${$_('csv_import__lastname')}`]}
</td> </td>
<td class="px-6 py-4 whitespace-nowrap"> <td class="px-6 py-4 whitespace-nowrap">
{runner['Team'] ||runner['Klasse'] || '---'} {runner[`${$_('csv_import__team')}`] || runner[`${$_('csv_import__class')}`] || '---'}
</td> </td>
</tr> </tr>
{/if} {/if}
@ -203,7 +201,7 @@
on:click={importAction} on:click={importAction}
type="button" type="button"
class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm"> class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm">
Läufer importieren {$_('import-runners')}
</button> </button>
<button <button
on:click={() => { on:click={() => {
@ -211,7 +209,7 @@
}} }}
type="button" type="button"
class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:ml-3 sm:w-auto sm:text-sm"> class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:ml-3 sm:w-auto sm:text-sm">
Abbrechen {$_('cancel')}
</button> </button>
</div> </div>
{/if} {/if}

View File

@ -4,6 +4,7 @@
"about": "Über", "about": "Über",
"application_name": "Lauf für Kaya! \n- Admin", "application_name": "Lauf für Kaya! \n- Admin",
"by": "von", "by": "von",
"cancel": "Abbrechen",
"cannot-reset-your-password-directly": "Schade. \nWir können das Passwort leider nicht direkt zurücksetzen.\nBitte sende uns eine Mail in der du deine Identität bestätigst.", "cannot-reset-your-password-directly": "Schade. \nWir können das Passwort leider nicht direkt zurücksetzen.\nBitte sende uns eine Mail in der du deine Identität bestätigst.",
"credits": "", "credits": "",
"csv_import__firstname": "Vorname", "csv_import__firstname": "Vorname",
@ -29,6 +30,7 @@
"goback": "Zur Startseite", "goback": "Zur Startseite",
"hallo": "hallo", "hallo": "hallo",
"icon-image-credits": "Wir möchten uns außerdem für die verwendeten Icons und Bilder bedanken bei:", "icon-image-credits": "Wir möchten uns außerdem für die verwendeten Icons und Bilder bedanken bei:",
"import-runners": "Läufer importieren",
"invalid-mail-reset": "Das ist keine gültige E-Mail", "invalid-mail-reset": "Das ist keine gültige E-Mail",
"lfk-is-os": "Das \"Lauf für Kaya!\" Frontend ist (wie alle anderen Projekte für den \"LfK!\" auch) ein OpenSource Projekt.", "lfk-is-os": "Das \"Lauf für Kaya!\" Frontend ist (wie alle anderen Projekte für den \"LfK!\" auch) ein OpenSource Projekt.",
"log_in": "Anmelden", "log_in": "Anmelden",

View File

@ -22,6 +22,7 @@
"create-organization": "Create Organization", "create-organization": "Create Organization",
"create-user": "Create User", "create-user": "Create User",
"credits": "Credits", "credits": "Credits",
"csv_import__class": "Klasse",
"csv_import__firstname": "First Name", "csv_import__firstname": "First Name",
"csv_import__lastname": "Nachname", "csv_import__lastname": "Nachname",
"csv_import__middlename": "Middlename", "csv_import__middlename": "Middlename",
@ -83,6 +84,7 @@
"groups": "Groups", "groups": "Groups",
"hallo": "hello", "hallo": "hello",
"icon-image-credits": "We also want to thank these projects for illustrations and icons:", "icon-image-credits": "We also want to thank these projects for illustrations and icons:",
"import-runners": "Import runners",
"installed-version": "Installed version", "installed-version": "Installed version",
"invalid-mail-reset": "the provided email is invalid", "invalid-mail-reset": "the provided email is invalid",
"last-name": "Last name", "last-name": "Last name",