0
0
Fork 0

Allow there to be multiple columns in the question CSV, but only grab the first column.

This commit is contained in:
Oliver-Akins 2021-01-03 00:07:24 -07:00
parent 01ea91e856
commit 125b941f55

View file

@ -70,8 +70,12 @@ export class Game {
*/ */
// parse the questions from the CSV // parse the questions from the CSV
let questions = readFileSync(conf.game.cards.questions, `utf-8`).replace(/\r/g, ``); let data = readFileSync(conf.game.cards.questions, `utf-8`).replace(/\r/g, ``);
this._questions = new Deck(questions.split(`\n`).slice(1)) let questions: question_deck[] = [];
for (var line of data.split(`\n`).slice(1)) {
questions.push(line.split(`,`)[0]);
};
this._questions = new Deck(questions);
// Parse the object deck from CSV // Parse the object deck from CSV
let objectsCSV = readFileSync(conf.game.cards.objects, `utf-8`).replace(/\r/g, ``); let objectsCSV = readFileSync(conf.game.cards.objects, `utf-8`).replace(/\r/g, ``);