From f1a188d6896d997fba72f52441b21e0280eee7f8 Mon Sep 17 00:00:00 2001 From: Galen Guyer Date: Mon, 16 Nov 2020 19:29:43 -0500 Subject: add positive test rate --- src/MainPage.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src') 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) => {
-

Number of Tests Administered by Student Health Center

+

Tests

+

-- cgit v1.2.3