diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/App.js | 78 | ||||
-rw-r--r-- | src/MainPage.js | 55 |
2 files changed, 65 insertions, 68 deletions
@@ -30,50 +30,50 @@ function App() { </div> ); - rawData = rawData.slice(0, 177); + // rawData = rawData.slice(0, 177); let data = rawData; console.log(data.length); const local = DateTime.local().zoneName; const semesterStart = DateTime.fromISO("2021-01-01"); - if (!showAllTime) { - data = rawData.filter((d) => { - let date = DateTime.fromSQL(d.last_updated, { zone: "UTC" }).setZone(local); - return date > semesterStart; - }); - const last = rawData[rawData.length - data.length - 1]; - data = data.map((d) => { - return { - alert_level: d.alert_level, - beds_available: d.beds_available, - isolation_off_campus: d.isolation_off_campus, - isolation_on_campus: d.isolation_on_campus, - last_updated: d.last_updated, - new_staff: d.new_staff, - new_students: d.new_students, - quarantine_off_campus: d.quarantine_off_campus, - quarantine_on_campus: d.quarantine_on_campus, - tests_administered: d.tests_administered - last.tests_administered, - total_staff: d.total_staff - last.total_staff, - total_students: d.total_students - last.total_students, - }; - }); - } + // if (!showAllTime) { + // data = rawData.filter((d) => { + // let date = DateTime.fromSQL(d.last_updated, { zone: "UTC" }).setZone(local); + // return date > semesterStart; + // }); + // const last = rawData[rawData.length - data.length - 1]; + // data = data.map((d) => { + // return { + // alert_level: d.alert_level, + // beds_available: d.beds_available, + // isolation_off_campus: d.isolation_off_campus, + // isolation_on_campus: d.isolation_on_campus, + // last_updated: d.last_updated, + // new_staff: d.new_staff, + // new_students: d.new_students, + // quarantine_off_campus: d.quarantine_off_campus, + // quarantine_on_campus: d.quarantine_on_campus, + // tests_administered: d.tests_administered - last.tests_administered, + // total_staff: d.total_staff - last.total_staff, + // total_students: d.total_students - last.total_students, + // }; + // }); + // } const latest = data[data.length - 1]; const prior = data[data.length - (1 + timeDifference)]; const lastUpdate = DateTime.fromSQL(latest.last_updated, { zone: "UTC" }).setZone(local); const priorUpdate = DateTime.fromSQL(prior.last_updated, { zone: "UTC" }).setZone(local); - let positiveCases = []; - for (let i = 5; i < data.length; i++) { - positiveCases.push({ - date: data[i].last_updated, - value: ( - ((data[i].total_students - data[i - 5].total_students) * 100) / - (data[i].tests_administered - data[i - 5].tests_administered) - ).toFixed(1), - }); - } - positiveCases = positiveCases.filter((o) => o.value > 0 && o.value <= 100); + // let positiveCases = []; + // for (let i = 5; i < data.length; i++) { + // positiveCases.push({ + // date: data[i].last_updated, + // value: ( + // ((data[i].total_students - data[i - 5].total_students) * 100) / + // (data[i].tests_administered - data[i - 5].tests_administered) + // ).toFixed(1), + // }); + // } + // positiveCases = positiveCases.filter((o) => o.value > 0 && o.value <= 100); return ( <BrowserRouter> <div className="App"> @@ -101,7 +101,7 @@ function App() { })}{" "} ({timeDifference == 1 ? "one day ago" : timeDifference == 5 ? "one week ago" : "two weeks ago"}) </h4> - <button + {/* <button onClick={() => setTimeDifference(timeDifference == 1 ? 5 : timeDifference == 5 ? 10 : 1)} className="bg-transparent text-sm hover:bg-orange-400 text-gray-600 hover:text-white py-1 my-1 px-2 border border-orange-300 hover:border-transparent rounded transition ease-in-out duration-300" > @@ -113,7 +113,7 @@ function App() { className="bg-transparent text-sm hover:bg-orange-400 text-gray-600 hover:text-white py-1 my-1 px-2 border border-orange-300 hover:border-transparent rounded transition ease-in-out duration-300" > Show {showAllTime ? "current semester" : "all time"} - </button> + </button> */} <br /> <Switch> <Route exact path="/"> @@ -151,7 +151,7 @@ function App() { })} /> </Route> - <Route path="/quarantineoncampus"> + {/* <Route path="/quarantineoncampus"> <History name="Quarantine On Campus" data={data.map((d) => { @@ -202,7 +202,7 @@ function App() { return { value: d.beds_available, date: d.last_updated }; })} /> - </Route> + </Route> */} </Switch> <br /> <p> diff --git a/src/MainPage.js b/src/MainPage.js index d841a88..a4bb593 100644 --- a/src/MainPage.js +++ b/src/MainPage.js @@ -6,47 +6,44 @@ const MainPage = (props) => { const data = props.data; const latest = data[data.length - 1]; const prior = data[data.length - (1 + props.timeDifference)]; - const priorPrior = data[Math.max(0, data.length - (1 + props.timeDifference * 2))]; + // const priorPrior = data[Math.max(0, data.length - (1 + props.timeDifference * 2))]; - const positiveTestRate = Math.max( - 0, - Math.min( - 100, - ((latest.total_students - prior.total_students) * 100) / - (latest.tests_administered - prior.tests_administered) - ) - ).toFixed(1); - const priorPositiveTestRate = Math.max( - 0, - Math.min( - 100, - ((prior.total_students - priorPrior.total_students) * 100) / - (prior.tests_administered - priorPrior.tests_administered) - ) - ).toFixed(1); + // const positiveTestRate = Math.max( + // 0, + // Math.min( + // 100, + // ((latest.total_students - prior.total_students) * 100) / + // (latest.tests_administered - prior.tests_administered) + // ) + // ).toFixed(1); + // const priorPositiveTestRate = Math.max( + // 0, + // Math.min( + // 100, + // ((prior.total_students - priorPrior.total_students) * 100) / + // (prior.tests_administered - priorPrior.tests_administered) + // ) + // ).toFixed(1); return ( <> - <h4 className="text-2xl"> + {/* <h4 className="text-2xl"> Alert Level: {latest.alert_level.charAt(0).toUpperCase() + latest.alert_level.slice(1)} </h4> <h5 className="text-gray-600 text-sm"> (Prior Alert Level: {prior.alert_level.charAt(0).toUpperCase() + prior.alert_level.slice(1)}) </h5> - <br /> + <br /> */} <h2 className="text-xl"> - This dashboard will not be updating for the summer. RIT is only providing the New Cases statistic on the - official dashboard. The API will continue to ingest data and be available, but modifying this page to - accomodate the new dashboard is not currently worth the effort. All historical data will remain - available on this page, but for any new information, please use{" "} - <a className="text-blue-700" href="https://rit.edu/ready/summer-dashboard"> - the official dashboard. - </a> + This dashboard has been refreshed for the new school year. For historical data, please contact + me at gkg1648 [AT] rit [DOT] edu. More cards and features will be re-added if they are added to + the official dashboard. </h2> <br /> <div id="total"> <h4 className="text-2xl"> - Total Positive Cases Since {props.showAllTime ? "August 19 (First Day of Classes)" : "January 1"} + {/* Total Positive Cases Since {props.showAllTime ? "August 19 (First Day of Classes)" : "January 1"} */} + Total Positive Cases Since August 16 (First Day of Move-In) </h4> <div className="Section"> <Card @@ -81,7 +78,7 @@ const MainPage = (props) => { /> </div> </div> - <br /> + {/* <br /> <div id="quarantine"> <h4 className="text-2xl">Number of Students in Quarantine</h4> <h5 className="text-base"> @@ -160,7 +157,7 @@ const MainPage = (props) => { link="/beds" /> </div> - </div> + </div> */} <GoatCounter /> </> ); |