↙ 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();
recent_processed = false;
const mapped = json_output.map(function (runner) {
let team = runner[`${$_("csv_import__team")}`];
if (runner["Klasse"]) {
team = runner["Klasse"];
}
return {
firstname: runner[`${$_("csv_import__firstname")}`],
middlename: runner[`${$_("csv_import__middlename")}`],
lastname: runner[`${$_("csv_import__lastname")}`],
team: team,
team:
runner[`${$_("csv_import__team")}`] ||
runner[`${$_("csv_import__class")}`],
};
});
console.log(mapped);
@ -183,16 +181,16 @@
.includes(searchvalue)}
<tr>
<td class="px-6 py-4 whitespace-nowrap">
{runner['Vorname']}
{runner[`${$_('csv_import__firstname')}`]}
</td>
<td class="px-6 py-4 whitespace-nowrap">
{runner['Zweitname'] || ''}
{runner[`${$_('csv_import__middlename')}`] || ''}
</td>
<td class="px-6 py-4 whitespace-nowrap">
{runner['Nachname']}
{runner[`${$_('csv_import__lastname')}`]}
</td>
<td class="px-6 py-4 whitespace-nowrap">
{runner['Team'] ||runner['Klasse'] || '---'}
{runner[`${$_('csv_import__team')}`] || runner[`${$_('csv_import__class')}`] || '---'}
</td>
</tr>
{/if}
@ -203,7 +201,7 @@
on:click={importAction}
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">
Läufer importieren
{$_('import-runners')}
</button>
<button
on:click={() => {
@ -211,7 +209,7 @@
}}
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">
Abbrechen
{$_('cancel')}
</button>
</div>
{/if}

View File

@ -4,6 +4,7 @@
"about": "Über",
"application_name": "Lauf für Kaya! \n- Admin",
"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.",
"credits": "",
"csv_import__firstname": "Vorname",
@ -29,6 +30,7 @@
"goback": "Zur Startseite",
"hallo": "hallo",
"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",
"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",

View File

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