fantasycalendar / kobold-plus-fight-club

A ground-up rewrite of Kobold Fight Club
MIT License
36 stars 16 forks source link

Fix CSV importer bug #41

Open boktah opened 6 months ago

boktah commented 6 months ago

Change details

The CSV importer currently doesn't work due to a bug. When downloading the template CSV files, and then attempting to import them into KFC, the following error appears: Monster 'Zombie' has the source 'Custom Source', but it is not defined in the sources!

This is because validSources is an array with the success flag at element 0 and the sources array at element 1. By passing results.sources to _validateMonsters() (the same way _validateJsonFile and _validateJson do) we only send the sources array.

Testing

Hosted the site locally with npm run dev and imported the example CSV files, as well as my own custom monsters+sources CSV, and checked that the error didn't show up and the monsters appear in the table correctly.