aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/App.js2
-rw-r--r--src/MainPage.js5
2 files changed, 4 insertions, 3 deletions
diff --git a/src/App.js b/src/App.js
index d8653a5..fbee2c1 100644
--- a/src/App.js
+++ b/src/App.js
@@ -70,7 +70,7 @@ function App() {
<br />
<Switch>
<Route exact path="/">
- <MainPage latest={latest} prior={prior} />{" "}
+ <MainPage data={data} timeDifference={timeDifference} />
</Route>
<Route path="/totalstudents">
<History
diff --git a/src/MainPage.js b/src/MainPage.js
index 7c316c4..7dd0cc9 100644
--- a/src/MainPage.js
+++ b/src/MainPage.js
@@ -3,8 +3,9 @@ import Card from "./Card";
import GoatCounter from "./GoatCounter";
const MainPage = (props) => {
- const latest = props.latest;
- const prior = props.prior;
+ const data = props.data;
+ const latest = data[data.length - 1];
+ const prior = data[data.length - (1 + props.timeDifference)];
return (
<>