Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mattias J Duffy
schedules
Commits
a7ff9ff4
Unverified
Commit
a7ff9ff4
authored
Jul 23, 2016
by
Mark Stenglein
Browse files
Add Spring 2016 Semester
parent
243979fb
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
dataScrapers/GMU/archivedJSON/GMU2016SP.json
0 → 100644
View file @
a7ff9ff4
This diff is collapsed.
Click to expand it.
dataScrapers/GMU/archivedJSON/GMU2016SP.min.json
0 → 100644
View file @
a7ff9ff4
This diff is collapsed.
Click to expand it.
dataScrapers/GMU/archivedXLSX/GMU2016SP.xlsx
0 → 100644
View file @
a7ff9ff4
File added
dataScrapers/GMU/classes.sh
View file @
a7ff9ff4
rm
classes2016.json
touch
classes2016.json
node extract2016.js
echo
"Copy the json file to the appropriate folder in the app and"
...
...
dataScrapers/GMU/classes2016.json
0 → 100644
View file @
a7ff9ff4
dataScrapers/GMU/extract2016.js
View file @
a7ff9ff4
// Read in excel file
if
(
typeof
require
!==
'
undefined
'
)
XLSX
=
require
(
'
xlsx
'
);
// convert file to workbook
var
workbook
=
XLSX
.
readFile
(
'
classes
2016
s
.xlsx
'
);
var
workbook
=
XLSX
.
readFile
(
'
GMU
2016
SP
.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
:
'
S
ummer
2016
'
,
slug
:
'
GMU2016S
'
,
semester
:
'
S
pring
2016
'
,
slug
:
'
GMU2016S
P
'
,
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.
...
...
schedules/setup/dataFiles/GMU2016SP.min.json
0 → 100644
View file @
a7ff9ff4
This diff is collapsed.
Click to expand it.
schedules/setup/populateDB.js
View file @
a7ff9ff4
...
...
@@ -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
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment