Compare commits

..

1 Commits

Author SHA1 Message Date
Matthew Huntington ebd7f419a9 pwd change
2 years ago

@ -1,6 +1,6 @@
const WIDTH = 800;
const HEIGHT = 600;
const parseTime = d3.timeParse("%Y-%m-%dT%H:%M:%S.%L%Z");
const parseTime = d3.timeParse("%B %e, %Y");
let instances;
let xScale, yScale;
@ -111,9 +111,10 @@ const renderPoints = () => {
}
const setupGraph = ()=>{
d3.select('#container')
.attr('width', WIDTH)
.attr('height', HEIGHT);
d3.select('svg');
d3.select('svg')
.style('width', WIDTH)
.style('height', HEIGHT);
xScale = d3.scaleTime();
xScale.range([0,WIDTH]);

@ -3,9 +3,7 @@ const pg = require('pg');
const brokenInstances = [8302, 8294];
const client = new pg.Client({
database:"outcomes_tracker",
user:"matt",
password:"matt"
database:"outcomes_tracker"
})
const delay = (ms) => {
@ -52,10 +50,9 @@ const scrapeInstance = async (link, page) => {
const graduationHTML = await graduationElem.getProperty('innerHTML');
const instanceHeaderText = await graduationHTML.jsonValue()
const graduationDate = instanceHeaderText.split(' - ')[1].trim();
const startDate = instanceHeaderText.split(' - ')[0].trim().split(':')[1].trim();
console.log({ instanceID, course, startDate, graduationDate, totalStudents, dropped, graduates, seeking, outcomes90Numeric, outcomes90Percent });
const res = await client.query(`INSERT INTO instances (instance_id, course, start_date, graduation_date, total_students, dropped, graduates, seekers, ninety_day_outcomes) VALUES (${instanceID}, '${course}', '${startDate}', '${graduationDate}', ${totalStudents}, ${dropped}, ${graduates}, ${seeking}, ${outcomes90Numeric})`);
console.log({ instanceID, course, graduationDate, totalStudents, dropped, graduates, seeking, outcomes90Numeric, outcomes90Percent });
const res = await client.query(`INSERT INTO instances (instance_id, course, graduation_date, total_students, dropped, graduates, seekers, ninety_day_outcomes) VALUES (${instanceID}, '${course}', '${graduationDate}', ${totalStudents}, ${dropped}, ${graduates}, ${seeking}, ${outcomes90Numeric})`);
} else {
await page.screenshot({ path: 'outcomes.png' })
}
@ -79,7 +76,7 @@ const scrapeInstance = async (link, page) => {
await delay(500) //wtf
await page.type('input[type="text"]', 'matt.huntington@generalassemb.ly');
await page.type('input[type="password"]', 'Hunt!ngt0n!4');
await page.type('input[type="password"]', 'Hunt!ngt0n!2');
await page.click('input[type="submit"]');
console.log('entered okta creds');
@ -127,5 +124,4 @@ const scrapeInstance = async (link, page) => {
console.log('done');
//await page.screenshot({ path: 'outcomes.png' })
await browser.close();
await client.end();
})();

@ -2,9 +2,7 @@ const express = require('express');
const app = express();
const pg = require('pg');
const client = new pg.Client({
database:"outcomes_tracker",
user:'matt',
password:'matt'
database:"outcomes_tracker"
})
app.use(express.static('public'))
@ -15,6 +13,6 @@ app.get('/instances', async (req, res)=>{
})
client.connect();
app.listen(3003, ()=>{
app.listen(3000, ()=>{
console.log('listening');
})

Loading…
Cancel
Save