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

add spring 2017 to gmu data archive

parent af3d101f
This diff is collapsed.
This diff is collapsed.
node extract2016.js
node extractClasses.js
echo "Copy the json file to the appropriate folder in the app and"
echo "add it's information to config.js"
// Read in excel file
if(typeof require !== 'undefined') XLSX = require('xlsx');
// convert file to workbook
var workbook = XLSX.readFile('GMU2015F.xlsx');
var workbook = XLSX.readFile('GMU2017SP.xlsx');
// get sheet
var worksheet = workbook.Sheets[workbook.SheetNames[0]];
// convert sheet to JSON
var jsonContents = XLSX.utils.sheet_to_json(worksheet)
console.log("\n *START* \n");
var yr = 2015;
var yr = 2017;
var term_classes = [];
// Loop through al of the different objects parsed by the xlsx to json conversion
for (var i=0; i < jsonContents.length; i++) {
......@@ -19,6 +19,7 @@ for (var i=0; i < jsonContents.length; i++) {
// skip to next if there is no crn (really only needed for last row)
if (!c.crn) { continue; }
// use last section if blank (for multi-crn sections)
console.log(c.crn);
if (currentItem['COURSE SECTION']) {
var courseNameSection = currentItem['COURSE SECTION'].split(" ");
} else {
......@@ -84,8 +85,8 @@ for (var i=0; i < jsonContents.length; i++) {
}
var semester = {
school: 'GMU',
semester: 'Fall 2015',
slug: 'GMU2015F',
semester: 'Spring 2017',
slug: 'GMU2017SP',
classes: term_classes
}
var semesterJSON = JSON.stringify(semester);
......@@ -96,13 +97,13 @@ try {
var resultPretty = prettyJSON;
// write a JSON file.
var fs = require('fs');
fs.writeFile('GMU2015F.min.json', result, function (err) {
fs.writeFile('GMU2017SP.min.json', result, function (err) {
if (err) return console.log(err);
console.log('File written to GMU2015F.min.json');
console.log('File written to GMU2017SP.min.json');
});
fs.writeFile('GMU2015F.json', resultPretty, function (err) {
fs.writeFile('GMU2017SP.json', resultPretty, function (err) {
if (err) return console.log(err);
console.log('File written to GMU201F.json');
console.log('File written to GMU2017SP.json');
});
} catch (err) {
// Errors are thrown for bad options, or if the data is empty and no fields are provided.
......
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