const database = require('./../database'); class Gender { constructor(name) { this.name = name; } } const MALE = new Gender("male"); const FEMALE = new Gender("female"); async function retrieveBySport(sportID) { const query = `SELECT DISTINCT(gender) FROM scores.divisions WHERE sport_id = $1;`; const table = await database.executeQuery(query, [sportID]); const gendersList = []; if(table.length == 0) { return gendersList; } if(table.length == 2) { gendersList.push(FEMALE); gendersList.push(MALE); return gendersList; } else if(table[0][0] = "F") { gendersList.push(FEMALE); return gendersList; } else if(table[0][0] = "M") { gendersList.push(MALE); return gendersList; } } exports.MALE = MALE; exports.FEMALE = FEMALE; exports.retrieveBySport = retrieveBySport;