↙ added default fallback parsing to ImportRunnerModal

ref #13
This commit is contained in:
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}