aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGalen Guyer <galen@galenguyer.com>2020-11-16 19:29:43 -0500
committerGalen Guyer <galen@galenguyer.com>2020-11-16 19:29:43 -0500
commitf1a188d6896d997fba72f52441b21e0280eee7f8 (patch)
treee534272f999e1c78aa2b76ed117eba17da877828
parent156bc7c658ab56f6607189e3f5cba66d00a90802 (diff)
add positive test rate
-rw-r--r--src/MainPage.js20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/MainPage.js b/src/MainPage.js
index f00db6a..354263a 100644
--- a/src/MainPage.js
+++ b/src/MainPage.js
@@ -6,6 +6,16 @@ const MainPage = (props) => {
const data = props.data;
const latest = data[data.length - 1];
const prior = data[data.length - (1 + props.timeDifference)];
+ const priorPrior = data[data.length - (1 + props.timeDifference * 2)];
+
+ const positiveTestRate = (
+ ((latest.total_students - prior.total_students) * 100) /
+ (latest.tests_administered - prior.tests_administered)
+ ).toFixed(1);
+ const priorPositiveTestRate = (
+ ((prior.total_students - priorPrior.total_students) * 100) /
+ (prior.tests_administered - priorPrior.tests_administered)
+ ).toFixed(1);
return (
<>
@@ -96,14 +106,20 @@ const MainPage = (props) => {
</div>
<br />
<div id="tests">
- <h4 className="text-2xl">Number of Tests Administered by Student Health Center</h4>
+ <h4 className="text-2xl">Tests</h4>
<div className="Section">
<Card
- name="Tests to date"
+ name="Tests Administered"
latest={latest.tests_administered}
diff={latest.tests_administered - prior.tests_administered}
link="/tests"
/>
+ <Card
+ name="Positive Test Rate"
+ latest={positiveTestRate + "%"}
+ diff={priorPositiveTestRate + "%"}
+ link="/"
+ />
</div>
</div>
<br />