A brave warrior enters their name and some personality traits and is returned the name of the glan they belong to. Glans are calculated based upon personality and each has a unique character.
The user feels a sense of accomplishment being grouped with others into a glanourous glan! Hoorah!
![](https://i.imgur.com/ptPwdaX.jpg =300x360)
const getSum = cb => {
databaseConnection.query(
`SELECT glans.glan_name, total.warrior_name FROM glans INNER JOIN (SELECT warrior_name, (warrior_c1 + warrior_c2 + warrior_c3 + 1) AS warrior_total FROM warriors) AS total ON glans.glan_id = total.warrior_total;`
),
![](https://i.imgur.com/vct9VDR.jpg =600x400)
Splitter:
let getGlan = document.getElementById("getGlan");
getGlan.onclick = function() {
domRequest("/getGlan");
};
} else if(endpoint.startsWith("/getGlan")) {
getGlan(req, res);
let getGlan = (req, res) => {
getData.getSum((error, result) => {
if (error) {
console.log("500, Get data error", error);
res.writeHead(500, "Content-Type:text/html");
res.end("<h1>Sorry, there was a problem getting the users<h1>");
} else {
res.writeHead(200, { "Content-Type": "application:json" });
res.end(JSON.stringify(result));
}
});
};
const getSum = cb => {
databaseConnection.query(`SELECT glans.glan_name, total.warrior_name
FROM glans
INNER JOIN (SELECT warrior_name, (warrior_c1 + warrior_c2 + warrior_c3 + 1)
AS warrior_total FROM warriors)
AS total ON glans.glan_id = total.warrior_total;`, (err, res) => {
if (err) return cb(err);
cb(null, res.rows);
});
};