Skip to content
Snippets Groups Projects
Commit 2a27ec96 authored by Søren Madsen's avatar Søren Madsen
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
/node_modules
# Created by .ignore support plugin (hsz.mobi)
console.time("Process");
var request = require("request");
var mongo = require("mongodb").MongoClient;
var ObjectID = require("mongodb").ObjectID;
var mongoUrl = "mongodb://localhost:3001/meteor";
var params = ["ects", "period", "year", "season", "courseLevel", "faculty", "courseLanguage", "department", "location", "programme", "courseType"];
var lang = ["da", "en"];
lang.forEach(function (lang) {
params.forEach(function (param) {
var url = "http://eddia1p1.adm.au.dk:7001/EDDI/webservices/CourseCatalogService2.cfc?method=getValueList&list=" + param + "&lang=" + lang;
request({
url: url,
json: true
}, function (e, res, json) {
var obj = {};
var arr = [];
json.listItems.forEach(function (item) {
arr.push({id: item.id, name: item[json.listName]});
});
obj["name"] = json.listName;
obj["lang"] = lang;
obj["list"] = arr;
//console.log(obj);
mongo.connect(mongoUrl, function (err, db) {
db.collection("filters").insert(obj, function (err, docs) {
//console.log(docs);
db.close();
});
});
});
});
});
console.timeEnd("Process");
{
"listName": "location",
"listItemCount": 4,
"listItems": [
{
"id": 1,
"location": "Aarhus"
},
{
"id": 2,
"location": "København"
},
{
"id": 3,
"location": "Herning"
},
{
"id": 4,
"location": "Roskilde"
}
]
}
\ No newline at end of file
{
"name": "public",
"version": "1.0.0",
"description": "Get value lists from EDDI",
"main": "getvaluefromEDDI.js",
"dependencies": {
"fs-extra": "^0.24.0"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "AU",
"license": "ISC"
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment