Unverified Commit a7ff9ff4 authored by Mark Stenglein's avatar Mark Stenglein
Browse files

Add Spring 2016 Semester

parent 243979fb
This diff is collapsed.
This diff is collapsed.
rm classes2016.json
touch classes2016.json
node extract2016.js
echo "Copy the json file to the appropriate folder in the app and"
......
// Read in excel file
if(typeof require !== 'undefined') XLSX = require('xlsx');
// convert file to workbook
var workbook = XLSX.readFile('classes2016s.xlsx');
var workbook = XLSX.readFile('GMU2016SP.xlsx');
// get sheet
var worksheet = workbook.Sheets[workbook.SheetNames[0]];
// convert sheet to JSON
......@@ -84,19 +84,25 @@ for (var i=0; i < jsonContents.length; i++) {
}
var semester = {
school: 'GMU',
semester: 'Summer 2016',
slug: 'GMU2016S',
semester: 'Spring 2016',
slug: 'GMU2016SP',
classes: term_classes
}
var semesterJSON = JSON.stringify(semester);
var prettyJSON = JSON.stringify(semester, null, 4);
try {
var result = semesterJSON;
var resultPretty = prettyJSON;
// write a JSON file.
var fs = require('fs');
fs.writeFile('classes2016s.json', result, function (err) {
fs.writeFile('GMU2016SP.min.json', result, function (err) {
if (err) return console.log(err);
console.log('File written to classes2016s.json');
console.log('File written to GMU2016SP.min.json');
});
fs.writeFile('GMU2016SP.json', resultPretty, function (err) {
if (err) return console.log(err);
console.log('File written to GMU2016SP.min.json');
});
} catch (err) {
// Errors are thrown for bad options, or if the data is empty and no fields are provided.
......
This diff is collapsed.
......@@ -8,7 +8,8 @@ var fs = require("fs");
//////
var datafiles = [
'GMU2016F.min.json',
'GMU2016S.min.json'
'GMU2016S.min.json',
'GMU2016SP.min.json'
]
var populateDB = function() {
......@@ -23,6 +24,7 @@ var populateDB = function() {
if (err) { console.error('Database Error!', err) }
else {
var findItems = Semester.find();
findItems.select('-_id');
findItems.select('-classes');
findItems.exec(function(err, users) {
......
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