-
diff --git a/client/src/DbContext.js b/client/src/DbContext.js
index d6d8dcb..f21fc10 100644
--- a/client/src/DbContext.js
+++ b/client/src/DbContext.js
@@ -15,13 +15,14 @@ export function useRemoteDb() {
export function DbProvider({ children }) {
const [localdb, setLocaldb] = useState(new PouchDB('kcmt2021'));
//used in development server
- const [remotedb, setRemotedb] = useState(new PouchDB('http://192.168.7.190:5984/kcmt2021', {
+ const [remotedb, setRemotedb] = useState(new PouchDB('http://192.168.1.5:5984/kcmt2021', {
skip_setup: true,
auth: {
username: '2021',
password: 'Ridgebotics'
}
}));
+ console.log(remotedb);
// const [remotedb, setRemotedb] = useState(new PouchDB(window.location.protocol + "//" + window.location.hostname + ":5984/kcmt2021", {skip_setup: true}))
//Login to the Remote Database
diff --git a/client/src/Pages/DashboardPage/DashboardPage.js b/client/src/Pages/DashboardPage/DashboardPage.js
index a6d10c6..589f996 100644
--- a/client/src/Pages/DashboardPage/DashboardPage.js
+++ b/client/src/Pages/DashboardPage/DashboardPage.js
@@ -4,30 +4,72 @@ import { Bar } from 'react-chartjs-2'
const DashboardPage = () => {
const localdb = useLocalDb();
- let team_data = {};
+ let processed_data = {};
localdb.allDocs({
include_docs: true
}).then((result) => {
console.log(result);
- result.rows.forEach((doc) => {
+ result.rows.forEach((dbentry) => {
+ let doc = dbentry.doc;
console.log(doc);
+ if (typeof(processed_data[doc.team_name]) === 'undefined'){
+ processed_data[doc.team_name] = {
+ team_name: doc.team_name,
+ alliance: doc.alliance,
+ games_played: 0,
+ num_climbs: 0,
+ climb_average: 0,
+ num_disables: 0,
+ disables_average: 0,
+ num_flips: 0,
+ flips_average: 0,
+ fouls: 0,
+ fouls_average: 0,
+ fouls_tech: 0,
+ fouls_tech_average: 0,
+ inner_port: 0,
+ inner_port_average: 0,
+ lower_port: 0,
+ lower_port_average: 0,
+ outer_port: 0,
+ outer_port_average: 0
+ }
+ }
+ let team_data = processed_data[doc.team_name];
+ console.log(team_data);
+ let new_team_data = {
+ ...team_data,
+ games_played: team_data.games_played + 1,
+ num_climbs: team_data.num_climbs + (doc.climb == true ? 1 : 0),
+ num_disables: team_data.num_disables + (doc.disabled == true ? 1 : 0),
+ num_flips: team_data.num_flips + (doc.flipped_over == true ? 1 : 0),
+ fouls: team_data.fouls + parseInt(doc.fouls),
+ fouls_tech: team_data.fouls_tech + parseInt(doc.fouls_tech),
+ inner_port: team_data.inner_port + parseInt(doc.inner_port),
+ outer_port: team_data.outer_port + parseInt(doc.outer_port),
+ lower_port: team_data.lower_port + parseInt(doc.lower_port)
+ }
+ console.log(new_team_data);
});
}).catch((err) => {
console.log("Error Fetching Docs from Database!");
console.log(err);
})
+ let datasets = [{
+ data: []
+ }];
//https://react-charts.js.org/examples/column
return (
-
+ /> */}
)
}
diff --git a/client/src/Pages/InputPage.js b/client/src/Pages/InputPage.js
index 4507b00..d89f8dd 100644
--- a/client/src/Pages/InputPage.js
+++ b/client/src/Pages/InputPage.js
@@ -195,34 +195,6 @@ const InputPage = () => {
)}
-
)
}
diff --git a/client/src/Pages/LoginPage.js b/client/src/Pages/LoginPage.js
deleted file mode 100644
index cdda632..0000000
--- a/client/src/Pages/LoginPage.js
+++ /dev/null
@@ -1,37 +0,0 @@
-import React from 'react';
-import { useRemoteDb } from '../DbContext';
-
-const LoginPage = () => {
- const remotedb = useRemoteDb();
- return (
- //
-
-
-
- )
-}
-
-export default LoginPage
\ No newline at end of file
diff --git a/client/src/components/Navigation/PagesList.js b/client/src/components/Navigation/PagesList.js
index db6ca81..bd6ea7e 100644
--- a/client/src/components/Navigation/PagesList.js
+++ b/client/src/components/Navigation/PagesList.js
@@ -6,7 +6,6 @@ const PagesList = props => {
)
}
diff --git a/server/data/_dbs.couch b/server/data/_dbs.couch
index 7d4b21c..8c7c0a1 100644
Binary files a/server/data/_dbs.couch and b/server/data/_dbs.couch differ
diff --git a/server/data/shards/00000000-7fffffff/kcmt2021.1632518243.couch b/server/data/shards/00000000-7fffffff/kcmt2021.1632518243.couch
deleted file mode 100644
index 43b2f24..0000000
Binary files a/server/data/shards/00000000-7fffffff/kcmt2021.1632518243.couch and /dev/null differ
diff --git a/server/data/shards/00000000-7fffffff/kcmt2021.1632538542.couch b/server/data/shards/00000000-7fffffff/kcmt2021.1632538542.couch
new file mode 100644
index 0000000..fcaf4c5
Binary files /dev/null and b/server/data/shards/00000000-7fffffff/kcmt2021.1632538542.couch differ
diff --git a/server/data/shards/80000000-ffffffff/kcmt2021.1632518243.couch b/server/data/shards/80000000-ffffffff/kcmt2021.1632518243.couch
deleted file mode 100644
index 39d2f06..0000000
Binary files a/server/data/shards/80000000-ffffffff/kcmt2021.1632518243.couch and /dev/null differ
diff --git a/server/data/shards/80000000-ffffffff/kcmt2021.1632538542.couch b/server/data/shards/80000000-ffffffff/kcmt2021.1632538542.couch
new file mode 100644
index 0000000..76603d1
Binary files /dev/null and b/server/data/shards/80000000-ffffffff/kcmt2021.1632538542.couch differ