Commit 381f00f5 authored by Theis's avatar Theis
Browse files

Fixed two minor issues in the server.js file

parent 2b19ffb7
Pipeline #105525 passed with stage
in 4 minutes and 23 seconds
......@@ -20,9 +20,9 @@ var corsOptions = {
origin: "http://localhost:8081"
};
// var corsOptions = {
// origin: "https://air-app.azurewebsites.net"
// };
/*var corsOptions = {
origin: "https://air-app.azurewebsites.net"
};*/
const log = bunyan.createLogger({ name: "AIR_UI_Backend: " });
const predictionURL_training = 'https://air-fastapi.azurewebsites.net/predict_training';
......@@ -128,7 +128,7 @@ app.post("/home/:ssn", async (req, res) => {
//Format and Sort Assistive Aids Data from Database
var assistiveAidsWithCorrectDateFormat = changeLendDateFormat(citizenData.Assistive_Aids);
var sortedAssistiveAids = sortAssistiveAidsByDate(assistiveAidsWithCorrectDateFormat);
//Remove invalid assistive aids iso's
var sortedAndCleanedAssistiveAids = removeInvalidAssistiveAidsFromList(sortedAssistiveAids);
......@@ -185,7 +185,7 @@ function rearrangeDateFormat(date) {
function sortAssistiveAidsByDate(assistiveAids){
if(assistiveAids.length == 1) {
return sortedAssistiveAids;
return assistiveAids;
} else {
var sortedAssistiveAids = assistiveAids.sort((a, b) => new Date(b.lend_date) - new Date(a.lend_date));
sortedAssistiveAids.reverse();
......@@ -195,8 +195,9 @@ function sortAssistiveAidsByDate(assistiveAids){
function removeInvalidAssistiveAidsFromList(assistiveAids) {
for( var i = 0; i < assistiveAids.length; i++) {
if ( assistiveAids[i].iso === '999999') {
if ( assistiveAids[i].iso === '999999' || assistiveAids[i].iso === '220681') {
assistiveAids.splice(i, 1);
i--;
}
}
return assistiveAids;
......@@ -206,6 +207,7 @@ function removeAlarmFromAssistiveAidsList(assistiveAids) {
for( var i = 0; i < assistiveAids.length; i++) {
if ( assistiveAids[i].iso === '222718') {
assistiveAids.splice(i, 1);
i--;
}
}
return assistiveAids;
......@@ -242,9 +244,9 @@ function dateDifferenceInDays(assistiveAidLendDate) {
return Math.round(((differenceInTime))/(oneDayInMilliseconds) - 1);
}
// http.createServer(app).listen(80);
// https.createServer(app).listen(443);
// log.info(`Server is listening on port ${80} and ${443}.`);
//http.createServer(app).listen(80);
//https.createServer(app).listen(443);
//log.info(`Server is listening on port ${80} and ${443}.`);
const PORT = process.env.PORT || 8080;
app.listen(PORT, () => {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment