From 6f8fde72a1140b35fddce5657e49201e065c35f8 Mon Sep 17 00:00:00 2001 From: Matt Huntington Date: Wed, 20 Sep 2023 22:38:11 -0400 Subject: [PATCH] compute outcomes %. api filters by grads and course --- public/app.js | 4 ++-- server.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/app.js b/public/app.js index b071d2b..1afd5e7 100644 --- a/public/app.js +++ b/public/app.js @@ -19,7 +19,7 @@ const renderPoints = () => { d3.selectAll('circle') .attr('cy', (datum, index) => { - return yScale(datum.ninety_day_outcomes); + return yScale(datum.ninety_day_outcomes/datum.graduates*100); }); d3.selectAll('circle') @@ -50,7 +50,7 @@ const setupGraph = ()=>{ yScale = d3.scaleLinear(); yScale.range([HEIGHT, 0]); const yDomain = d3.extent(instances, (datum, index) => { - return datum.ninety_day_outcomes; + return datum.ninety_day_outcomes/datum.graduates*100; }) yScale.domain(yDomain); } diff --git a/server.js b/server.js index 2daf50e..129343f 100644 --- a/server.js +++ b/server.js @@ -8,7 +8,7 @@ const client = new pg.Client({ app.use(express.static('public')) app.get('/instances', async (req, res)=>{ - const instances = await client.query("SELECT * FROM instances WHERE course = 'ONL-SEIR-21215'"); + const instances = await client.query("SELECT * FROM instances WHERE course = 'ONL-SEIR-21215' AND graduates > 0"); res.json(instances.rows); })