From a8414f823e2faa3a653cb341654d3eca546616af Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Sat, 3 Dec 2022 11:36:31 -0700 Subject: [PATCH 001/188] Add user class skeleton --- src/User.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 src/User.js diff --git a/src/User.js b/src/User.js new file mode 100644 index 0000000000..3dcf6346dd --- /dev/null +++ b/src/User.js @@ -0,0 +1,7 @@ +class User { + constructor(userData) { + + } +} + +export default User; \ No newline at end of file From cd4d448adcc6ca7cc279624b5cb59e630fb52181 Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Sat, 3 Dec 2022 11:37:18 -0700 Subject: [PATCH 002/188] Add User test pseudocode --- test/User-test.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 test/User-test.js diff --git a/test/User-test.js b/test/User-test.js new file mode 100644 index 0000000000..09cbfa06f3 --- /dev/null +++ b/test/User-test.js @@ -0,0 +1,5 @@ +// Should be a function +// Should represent a single player +// Should have a parameter to take in a userData object +//Each user should have id, name, address, email, stride length, daily step goal, friends hydration/sleep? +// Should have method to return users first name \ No newline at end of file From 16d19d79b5aeb2eacf5c6c002d3fc6fdf1bd181b Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sat, 3 Dec 2022 11:48:45 -0700 Subject: [PATCH 003/188] Add UserRepo pseudocode --- src/UserRepository.js | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/UserRepository.js b/src/UserRepository.js index 049cf4c197..be15c9fa0f 100644 --- a/src/UserRepository.js +++ b/src/UserRepository.js @@ -1,5 +1,34 @@ class UserRepository { + constructor(data) { + } } -export default UserRepository; \ No newline at end of file +export default UserRepository; + +// new UserRepository(data); +// A UserRepository holds onto all of the User objects +// It should have a parameter to take in user data + +//parameters: +//data + +//properties: +//this.data or this.userData -> something like that + + + + +// It should have methods to determine: + +// Given a user’s ID, what is their user data? + //go through the users + //return the corresponding user object when its found + //now we have access to their info + + +// The average step goal amongst all users + //go through each user + //possibly use reduce method? + //get total daily step goal number + //divide by user count \ No newline at end of file From 671a0bbd84f45a860c390cd2995538b3756013ad Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sat, 3 Dec 2022 11:49:23 -0700 Subject: [PATCH 004/188] Add UserRepo test pseudocode --- test/UserRepository-test.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/UserRepository-test.js b/test/UserRepository-test.js index 5ae11729ad..9b71ef14b7 100644 --- a/test/UserRepository-test.js +++ b/test/UserRepository-test.js @@ -5,4 +5,11 @@ describe('User Repository', () => { it('should be a function', function () { expect(UserRepository).to.be.a('function'); }); -}); \ No newline at end of file +}); + + +//test the data being passed in -> test this.data + +//test the output of the get user data method, make sure the id argument works + +//test the output of the average step goals -> make sure the math is solid \ No newline at end of file From 77498bb03f9edc54d39e16b364d47ac0786c71c1 Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Sat, 3 Dec 2022 13:36:50 -0700 Subject: [PATCH 005/188] Create basic HTML skeleton --- dist/index.html | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/dist/index.html b/dist/index.html index 444322806c..dbdd82c702 100644 --- a/dist/index.html +++ b/dist/index.html @@ -5,8 +5,23 @@ Fitlit -

Activity Tracker

- turing logo +
+

Activity Tracker

+ turing logo +
+
+
+
Hi
+
Bonjour
+
Hola
+
Annyeong
+
Konnichiwa
+
Da jia hao
+
Dobre dien
+
Ciao
+
Shalom
+
+
From ea1d77b9ecc66b6232bb6cbc7895ddae1103f718 Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Sat, 3 Dec 2022 13:37:08 -0700 Subject: [PATCH 006/188] Comment out alert message --- dist/bundle.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/bundle.js b/dist/bundle.js index 75e39b096b..c5d375c3e5 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -1,6 +1,6 @@ /******/ (() => { // webpackBootstrap var __webpack_exports__ = {}; - alert('hello') + // alert('hello') /******/ })() ; \ No newline at end of file From 7c0bc4744f85b3e3025b3387427288b94c69e5c6 Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sat, 3 Dec 2022 13:45:53 -0700 Subject: [PATCH 007/188] is a function test --- test/User-test.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/User-test.js b/test/User-test.js index 09cbfa06f3..75453f09b8 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -1,3 +1,18 @@ +import { expect } from 'chai'; +import User from '../src/User'; +import UserRepository from '../src/UserRepository'; + + + +describe('User', () => { + it('should be a function', function () { + expect(User).to.be.a('function'); + }); + + + }); + + // Should be a function // Should represent a single player // Should have a parameter to take in a userData object From fb33de55e29e444a316fbba485d8e80b5646db8b Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sat, 3 Dec 2022 13:46:41 -0700 Subject: [PATCH 008/188] instantiate a user test --- test/User-test.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/User-test.js b/test/User-test.js index 75453f09b8..80b5e584f1 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -8,8 +8,13 @@ describe('User', () => { it('should be a function', function () { expect(User).to.be.a('function'); }); + it('should instantiate a new User', function () { + var user = new User() - + expect(User).to.be.a('function'); + }) + + }); From f9be920437385ea321c38617bb9c61d3636a2dcc Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sat, 3 Dec 2022 13:47:19 -0700 Subject: [PATCH 009/188] userdata parameter test --- test/User-test.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/User-test.js b/test/User-test.js index 80b5e584f1..efebb61446 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -13,7 +13,14 @@ describe('User', () => { expect(User).to.be.a('function'); }) - + it('should have a Userdata parameter', function () { + var user = new User(userData); + + expect(userData).to.equal({}); + }) + + + }); From c2614fa24f8b99ff89d0478a9795136be91525f1 Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sat, 3 Dec 2022 13:51:17 -0700 Subject: [PATCH 010/188] userdata id test --- test/User-test.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/test/User-test.js b/test/User-test.js index efebb61446..3acbf83829 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -8,19 +8,27 @@ describe('User', () => { it('should be a function', function () { expect(User).to.be.a('function'); }); + it('should instantiate a new User', function () { - var user = new User() + let user = new User() expect(User).to.be.a('function'); }) + it('should have a Userdata parameter', function () { - var user = new User(userData); + let user = new User(userData); expect(userData).to.equal({}); }) + it('should have an id', function () { + let user = new User(userData); + + expect(user.id).to.equal(userData[id]); + }) + - + }); From c189d6971db3b13e0c2108c00f50e76ea04428c0 Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Sat, 3 Dec 2022 13:51:19 -0700 Subject: [PATCH 011/188] Change id numbers to match index positions --- dist/index.html | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/dist/index.html b/dist/index.html index dbdd82c702..d88917ed40 100644 --- a/dist/index.html +++ b/dist/index.html @@ -11,15 +11,15 @@

Activity Tracker

-
Hi
-
Bonjour
-
Hola
-
Annyeong
-
Konnichiwa
-
Da jia hao
-
Dobre dien
-
Ciao
-
Shalom
+
Hi
+
Bonjour
+
Hola
+
Annyeong
+
Konnichiwa
+
Da jia hao
+
Dobre dien
+
Ciao
+
Shalom
From 3a08f2301aa8706d992ed9779159a29fc48f4f89 Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sat, 3 Dec 2022 13:52:40 -0700 Subject: [PATCH 012/188] add userdata name test --- test/User-test.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/User-test.js b/test/User-test.js index 3acbf83829..ffd436779c 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -27,6 +27,11 @@ describe('User', () => { expect(user.id).to.equal(userData[id]); }) + it('should have an id', function () { + let user = new User(userData); + + expect(user.name).to.equal(userData[name]); + }) From dbfc32bf4c7a8ae81c06a6842bcd11e101f94a5a Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sat, 3 Dec 2022 13:53:23 -0700 Subject: [PATCH 013/188] add user address test --- test/User-test.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/User-test.js b/test/User-test.js index ffd436779c..23d6d53654 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -27,12 +27,17 @@ describe('User', () => { expect(user.id).to.equal(userData[id]); }) - it('should have an id', function () { + it('should have an name', function () { let user = new User(userData); expect(user.name).to.equal(userData[name]); }) + it('should have an address', function () { + let user = new User(userData); + + expect(user.address).to.equal(userData[address]); + }) }); From 5724ad209e4e6c7d40a1efe6b81bb1e7204b4665 Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sat, 3 Dec 2022 13:54:08 -0700 Subject: [PATCH 014/188] add user email test --- test/User-test.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/User-test.js b/test/User-test.js index 23d6d53654..e7936467c7 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -39,7 +39,13 @@ describe('User', () => { expect(user.address).to.equal(userData[address]); }) - + it('should have an email', function () { + let user = new User(userData); + + expect(user.email).to.equal(userData[email]); + }) + + }); From 389245f9c4ffa0b81e2b4436002ac083365f1575 Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sat, 3 Dec 2022 13:54:56 -0700 Subject: [PATCH 015/188] add user stridelength test --- test/User-test.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/User-test.js b/test/User-test.js index e7936467c7..c0fe7029f3 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -45,6 +45,11 @@ describe('User', () => { expect(user.email).to.equal(userData[email]); }) + it('should have a strideLength', function () { + let user = new User(userData); + + expect(user.strideLength).to.equal(userData[strideLength]); + }) }); From a54fb50c9b8e1c93b61a681bb0fe0d4ad0523e46 Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sat, 3 Dec 2022 13:55:37 -0700 Subject: [PATCH 016/188] add user step goal test --- test/User-test.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/User-test.js b/test/User-test.js index c0fe7029f3..c48aee8556 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -51,6 +51,11 @@ describe('User', () => { expect(user.strideLength).to.equal(userData[strideLength]); }) + it('should have a step goal', function () { + let user = new User(userData); + + expect(user.dailyStepGoal).to.equal(userData[dailyStepGoal]); + }) }); From c7df35b5bef8aec4f669f4881018226805cb1df9 Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sat, 3 Dec 2022 13:56:18 -0700 Subject: [PATCH 017/188] add user friends test --- test/User-test.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/User-test.js b/test/User-test.js index c48aee8556..e47564c90f 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -56,6 +56,12 @@ describe('User', () => { expect(user.dailyStepGoal).to.equal(userData[dailyStepGoal]); }) + + it('should have friends', function () { + let user = new User(userData); + + expect(user.friends).to.equal(userData[friends]); + }) }); From 0983f01d09fdb614e57c6630bd46c3a406dee4af Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sat, 3 Dec 2022 14:06:30 -0700 Subject: [PATCH 018/188] update testing parameter names --- test/User-test.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/test/User-test.js b/test/User-test.js index e47564c90f..e4ed06e1f7 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -1,6 +1,7 @@ import { expect } from 'chai'; import User from '../src/User'; -import UserRepository from '../src/UserRepository'; +// import UserRepository from '../src/UserRepository'; +import users from '../src/data/users'; @@ -24,44 +25,45 @@ describe('User', () => { it('should have an id', function () { let user = new User(userData); - expect(user.id).to.equal(userData[id]); + expect(user.id).to.equal(user.id); }) it('should have an name', function () { let user = new User(userData); - expect(user.name).to.equal(userData[name]); + expect(user.name).to.equal(user.name); }) it('should have an address', function () { let user = new User(userData); - expect(user.address).to.equal(userData[address]); + expect(user.address).to.equal(user.address); }) it('should have an email', function () { let user = new User(userData); - expect(user.email).to.equal(userData[email]); + expect(user.email).to.equal(user.email); }) it('should have a strideLength', function () { let user = new User(userData); - expect(user.strideLength).to.equal(userData[strideLength]); + expect(user.strideLength).to.equal(user.strideLength); }) it('should have a step goal', function () { let user = new User(userData); - expect(user.dailyStepGoal).to.equal(userData[dailyStepGoal]); + expect(user.dailyStepGoal).to.equal(user.dailyStepGoal); }) it('should have friends', function () { let user = new User(userData); - expect(user.friends).to.equal(userData[friends]); + expect(user.friends).to.equal(user.friends); }) + }); From f0dbdd5eb085a96052536d15d6b4d3b2c2765beb Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sat, 3 Dec 2022 14:11:20 -0700 Subject: [PATCH 019/188] update some syntax --- test/User-test.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/test/User-test.js b/test/User-test.js index e4ed06e1f7..9ffb574cc6 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -71,4 +71,17 @@ describe('User', () => { // Should represent a single player // Should have a parameter to take in a userData object //Each user should have id, name, address, email, stride length, daily step goal, friends hydration/sleep? -// Should have method to return users first name \ No newline at end of file +// Should have method to return users first name + + +// Let user1 = new User({"id": 1, +// "name": "Luisa Hane", +// "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", +// "email": "Diana.Hayes1@hotmail.com", +// "strideLength": 4.3, +// "dailyStepGoal": 10000, +// "friends": [ +// 16, +// 4, +// 8 +// ]}) \ No newline at end of file From c01e99835ca5b98603e5e395d7bcabf5bab8b030 Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sat, 3 Dec 2022 14:41:10 -0700 Subject: [PATCH 020/188] refactor and add beforeeach --- test/User-test.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/test/User-test.js b/test/User-test.js index 9ffb574cc6..2141dad873 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -2,64 +2,63 @@ import { expect } from 'chai'; import User from '../src/User'; // import UserRepository from '../src/UserRepository'; import users from '../src/data/users'; - +import userData from '../src/data/users'; describe('User', () => { + let user1, user2, user3 + beforeEach(() => { + user1 = new User(userData) + user2 = new User(userData) + user3 = new User(userData) + }) + it('should be a function', function () { expect(User).to.be.a('function'); }); it('should instantiate a new User', function () { - let user = new User() expect(User).to.be.a('function'); }) it('should have a Userdata parameter', function () { - let user = new User(userData); expect(userData).to.equal({}); }) it('should have an id', function () { - let user = new User(userData); expect(user.id).to.equal(user.id); }) it('should have an name', function () { - let user = new User(userData); expect(user.name).to.equal(user.name); }) it('should have an address', function () { - let user = new User(userData); expect(user.address).to.equal(user.address); }) it('should have an email', function () { - let user = new User(userData); expect(user.email).to.equal(user.email); }) it('should have a strideLength', function () { - let user = new User(userData); expect(user.strideLength).to.equal(user.strideLength); }) it('should have a step goal', function () { - let user = new User(userData); expect(user.dailyStepGoal).to.equal(user.dailyStepGoal); }) it('should have friends', function () { - let user = new User(userData); + expect(user.friends).to.equal(user.friends); }) From 046d2f792844636df0b9d10d66bd956040692d15 Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Sat, 3 Dec 2022 15:05:19 -0700 Subject: [PATCH 021/188] Add getFirstName method --- test/User-test.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/test/User-test.js b/test/User-test.js index 2141dad873..2a95a38c7e 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -29,38 +29,46 @@ describe('User', () => { it('should have an id', function () { - expect(user.id).to.equal(user.id); + expect(user.id).to.equal(userData.id); }) it('should have an name', function () { - expect(user.name).to.equal(user.name); + expect(user.name).to.equal(userData.name); }) it('should have an address', function () { - expect(user.address).to.equal(user.address); + expect(user.address).to.equal(userData.address); }) it('should have an email', function () { - expect(user.email).to.equal(user.email); + expect(user.email).to.equal(userData.email); }) it('should have a strideLength', function () { - expect(user.strideLength).to.equal(user.strideLength); + expect(user.strideLength).to.equal(userData.strideLength); }) it('should have a step goal', function () { - expect(user.dailyStepGoal).to.equal(user.dailyStepGoal); + expect(user.dailyStepGoal).to.equal(userData.dailyStepGoal); }) it('should have friends', function () { - expect(user.friends).to.equal(user.friends); + expect(user.friends).to.equal(userData.friends); + }) + + it('should return users first name,' function() { + + user.getFirstName(userData) + + + expect(user.name).to.equal(userData.name) }) }); From a952749f0910f63c86c6628079b39f65666d06d6 Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Sat, 3 Dec 2022 15:05:38 -0700 Subject: [PATCH 022/188] Add new instance test --- test/UserRepository-test.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/UserRepository-test.js b/test/UserRepository-test.js index 9b71ef14b7..2d54f4a392 100644 --- a/test/UserRepository-test.js +++ b/test/UserRepository-test.js @@ -5,6 +5,12 @@ describe('User Repository', () => { it('should be a function', function () { expect(UserRepository).to.be.a('function'); }); + + it('should instantiate a new user repository', function () { + + expect(userRepository).to.be.a('function'); + }) + }); From 25c22f62bba2d81d809b5bdd0a1ba35729d8f33a Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Sat, 3 Dec 2022 15:06:31 -0700 Subject: [PATCH 023/188] Add take in data test --- test/UserRepository-test.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/UserRepository-test.js b/test/UserRepository-test.js index 2d54f4a392..3e00a6f499 100644 --- a/test/UserRepository-test.js +++ b/test/UserRepository-test.js @@ -10,7 +10,12 @@ describe('User Repository', () => { expect(userRepository).to.be.a('function'); }) + + it('should take in user data', function() { + expect(user.data).to.equal({}) + }) + }); From c2692bbed7cb91dbc4a63b9d97dbaa4b366af4f1 Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Sat, 3 Dec 2022 15:07:30 -0700 Subject: [PATCH 024/188] Add id supplies data test --- test/UserRepository-test.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/UserRepository-test.js b/test/UserRepository-test.js index 3e00a6f499..fced2a4489 100644 --- a/test/UserRepository-test.js +++ b/test/UserRepository-test.js @@ -16,6 +16,13 @@ describe('User Repository', () => { expect(user.data).to.equal({}) }) + it('should supply user data when given id', function() { + + userRepository.getData() + + expect(user.id).to.equal(user.userData) + }) + }); From 8650f2297bcd523253a64a58ee51b374c1677771 Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Sat, 3 Dec 2022 15:08:07 -0700 Subject: [PATCH 025/188] Add average stap method test --- test/UserRepository-test.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/UserRepository-test.js b/test/UserRepository-test.js index fced2a4489..437e9dbca0 100644 --- a/test/UserRepository-test.js +++ b/test/UserRepository-test.js @@ -22,7 +22,13 @@ describe('User Repository', () => { expect(user.id).to.equal(user.userData) }) + + it('should give the average step goal of all users', function () { + + userRepository.stepAverage() + expect() + }) }); From 9066a49bb8f420ee49e05d3ac12630a48a1568da Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Sat, 3 Dec 2022 15:31:30 -0700 Subject: [PATCH 026/188] Add classes to grid elements --- dist/index.html | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/dist/index.html b/dist/index.html index d88917ed40..0d4fc8d586 100644 --- a/dist/index.html +++ b/dist/index.html @@ -1,7 +1,8 @@ - + + Fitlit @@ -11,15 +12,12 @@

Activity Tracker

-
Hi
+
Hi
Bonjour
-
Hola
+
Hola
Annyeong
Konnichiwa
Da jia hao
-
Dobre dien
-
Ciao
-
Shalom
From 46a200f1fee2d973f2270f28f0b8b34708191660 Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Sat, 3 Dec 2022 15:31:55 -0700 Subject: [PATCH 027/188] Add css styling to grid items --- src/css/styles.css | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/src/css/styles.css b/src/css/styles.css index b4a2b0d298..5c35eda122 100644 --- a/src/css/styles.css +++ b/src/css/styles.css @@ -1,5 +1,32 @@ body, html { - background-image: linear-gradient(to top, #ff9a9e 0%, #fecfef 99%, #fecfef 100%); + background-image: linear-gradient(to top, aliceblue 0%, lightblue 90%, blue 100%); background-repeat: no-repeat; height: 100%; -} \ No newline at end of file +} + +.grid-container { + display: grid; + grid-template-columns: repeat(4, 1fr); + gap: 20px; + grid-template-rows: 1fr 1fr 1fr; +} + +.grid-item { + background-color: bisque; + color: black; + border: 2px solid #2c3e50; + border-radius: 2px; + font-size: 4em; + display: flex; + justify-content: center; + align-items: center; +} + +.zero { + grid-column: 1 / 3; +} + +.two { + grid-column: 4; + grid-row: 1 / 3; +} From be9750553c4d7f86357b6929e8c88be92b93fbe7 Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sun, 4 Dec 2022 09:15:25 -0700 Subject: [PATCH 028/188] Add user1 instance to test file --- test/User-test.js | 50 +++++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/test/User-test.js b/test/User-test.js index 2a95a38c7e..ba6602efd6 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -8,70 +8,82 @@ import userData from '../src/data/users'; describe('User', () => { let user1, user2, user3 beforeEach(() => { - user1 = new User(userData) + user1 = new User({ + "id": 1, + "name": "Luisa Hane", + "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", + "email": "Diana.Hayes1@hotmail.com", + "strideLength": 4.3, + "dailyStepGoal": 10000, + "friends": [ + 16, + 4, + 8 + ] + }) user2 = new User(userData) user3 = new User(userData) }) - it('should be a function', function () { + it('should be a function', function () { expect(User).to.be.a('function'); }); it('should instantiate a new User', function () { - expect(User).to.be.a('function'); + expect(User).to.be.a('function'); }) it('should have a Userdata parameter', function () { - expect(userData).to.equal({}); + expect(userData).to.equal({}); }) it('should have an id', function () { - expect(user.id).to.equal(userData.id); + expect(user.id).to.equal(userData.id); }) - + it('should have an name', function () { - expect(user.name).to.equal(userData.name); + expect(user.name).to.equal(userData.name); }) - + it('should have an address', function () { - expect(user.address).to.equal(userData.address); + expect(user.address).to.equal(userData.address); }) - + it('should have an email', function () { - expect(user.email).to.equal(userData.email); + expect(user.email).to.equal(userData.email); }) it('should have a strideLength', function () { - expect(user.strideLength).to.equal(userData.strideLength); + expect(user.strideLength).to.equal(userData.strideLength); }) - + it('should have a step goal', function () { - expect(user.dailyStepGoal).to.equal(userData.dailyStepGoal); + expect(user.dailyStepGoal).to.equal(userData.dailyStepGoal); }) it('should have friends', function () { - expect(user.friends).to.equal(userData.friends); + expect(user.friends).to.equal(userData.friends); }) - it('should return users first name,' function() { + it('should return users first name,' function () { - user.getFirstName(userData) + user.getFirstName(userData) - expect(user.name).to.equal(userData.name) + expect(user.name).to.equal(userData.name) }) - }); +}); // Should be a function From 5c87e1656f4b9eb66a10dccef472fc31600bfa1c Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sun, 4 Dec 2022 09:16:29 -0700 Subject: [PATCH 029/188] Add user2 instance to test --- test/User-test.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/test/User-test.js b/test/User-test.js index ba6602efd6..22cc78ed7d 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -21,7 +21,20 @@ describe('User', () => { 8 ] }) - user2 = new User(userData) + user2 = new User({ + "id": 2, + "name": "Jarvis Considine", + "address": "30086 Kathryn Port, Ciceroland NE 07273", + "email": "Dimitri.Bechtelar11@gmail.com", + "strideLength": 4.5, + "dailyStepGoal": 5000, + "friends": [ + 9, + 18, + 24, + 19 + ] + }) user3 = new User(userData) }) From bc9c5571aa9cf0db76e7ffe2a7e16372c43638a1 Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sun, 4 Dec 2022 09:16:59 -0700 Subject: [PATCH 030/188] Add user3 instance to test file --- test/User-test.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/test/User-test.js b/test/User-test.js index 22cc78ed7d..5aaf7868b9 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -35,7 +35,20 @@ describe('User', () => { 19 ] }) - user3 = new User(userData) + user3 = new User({ + "id": 3, + "name": "Herminia Witting", + "address": "85823 Bosco Fork, East Oscarstad MI 85126-5660", + "email": "Elwin.Tromp@yahoo.com", + "strideLength": 4.4, + "dailyStepGoal": 5000, + "friends": [ + 19, + 11, + 42, + 33 + ] + }) }) it('should be a function', function () { From b645a978f9cc70896db47fd03b16b9535916fb92 Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sun, 4 Dec 2022 09:24:57 -0700 Subject: [PATCH 031/188] Add skips to all tests and pass first test --- test/User-test.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/User-test.js b/test/User-test.js index 5aaf7868b9..20cc697061 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -55,53 +55,53 @@ describe('User', () => { expect(User).to.be.a('function'); }); - it('should instantiate a new User', function () { + it.skip('should instantiate a new User', function () { expect(User).to.be.a('function'); }) - it('should have a Userdata parameter', function () { + it.skip('should have a Userdata parameter', function () { expect(userData).to.equal({}); }) - it('should have an id', function () { + it.skip('should have an id', function () { expect(user.id).to.equal(userData.id); }) - it('should have an name', function () { + it.skip('should have an name', function () { expect(user.name).to.equal(userData.name); }) - it('should have an address', function () { + it.skip('should have an address', function () { expect(user.address).to.equal(userData.address); }) - it('should have an email', function () { + it.skip('should have an email', function () { expect(user.email).to.equal(userData.email); }) - it('should have a strideLength', function () { + it.skip('should have a strideLength', function () { expect(user.strideLength).to.equal(userData.strideLength); }) - it('should have a step goal', function () { + it.skip('should have a step goal', function () { expect(user.dailyStepGoal).to.equal(userData.dailyStepGoal); }) - it('should have friends', function () { + it.skip('should have friends', function () { expect(user.friends).to.equal(userData.friends); }) - it('should return users first name,' function () { + it.skip('should return users first name', function () { user.getFirstName(userData) From f95b201e5e8e8a0d11bff2505966771f9f448976 Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Sun, 4 Dec 2022 09:33:23 -0700 Subject: [PATCH 032/188] Add beforeEach --- test/UserRepository-test.js | 40 +++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/test/UserRepository-test.js b/test/UserRepository-test.js index 437e9dbca0..f8489d3490 100644 --- a/test/UserRepository-test.js +++ b/test/UserRepository-test.js @@ -1,29 +1,53 @@ import { expect } from 'chai'; +import { beforeEach } from 'mocha'; +import User from '../src/User'; import UserRepository from '../src/UserRepository'; +import userData from '../src/data/users.js'; describe('User Repository', () => { - it('should be a function', function () { + let user1, user2, user3, userRepository; + +beforeEach(() => { + user1 = new User(userData[0]) + user2 = new User(userData[1]) + user3 = new User(userData[2]) + userRepository = new UserRepository([user1, user2, user3]) +}) + + it.skip('should be a function', function () { expect(UserRepository).to.be.a('function'); }); - it('should instantiate a new user repository', function () { + it.skip('should instantiate a new user repository', function () { expect(userRepository).to.be.a('function'); }) - it('should take in user data', function() { - - expect(user.data).to.equal({}) + it.skip('should take in user data', function() { + + expect(user1.data).to.equal( + {"id": 1, + "name": "Luisa Hane", + "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", + "email": "Diana.Hayes1@hotmail.com", + "strideLength": 4.3, + "dailyStepGoal": 10000, + "friends": [ + 16, + 4, + 8 + ] + }) }) - it('should supply user data when given id', function() { + it.skip('should supply user data when given id', function() { userRepository.getData() - expect(user.id).to.equal(user.userData) + expect(user2.id).to.equal(user2.userData) }) - it('should give the average step goal of all users', function () { + it.skip('should give the average step goal of all users', function () { userRepository.stepAverage() From 078abffa7dad59aa998b6bdc0bce5afd259e7ffd Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sun, 4 Dec 2022 09:44:02 -0700 Subject: [PATCH 033/188] Pass class instantiation and parameter testing --- src/User.js | 2 +- test/User-test.js | 18 +++++++++++++++--- test/UserRepository-test.js | 32 ++++++++++++++++---------------- 3 files changed, 32 insertions(+), 20 deletions(-) diff --git a/src/User.js b/src/User.js index 3dcf6346dd..31151f8ab9 100644 --- a/src/User.js +++ b/src/User.js @@ -1,6 +1,6 @@ class User { constructor(userData) { - + this.userData = userData; } } diff --git a/test/User-test.js b/test/User-test.js index 20cc697061..bb5b1549b0 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -55,14 +55,26 @@ describe('User', () => { expect(User).to.be.a('function'); }); - it.skip('should instantiate a new User', function () { + it('should instantiate a new User', function () { expect(User).to.be.a('function'); }) - it.skip('should have a Userdata parameter', function () { + it('should have a Userdata parameter', function () { - expect(userData).to.equal({}); + expect(user1.userData).to.deep.equal({ + "id": 1, + "name": "Luisa Hane", + "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", + "email": "Diana.Hayes1@hotmail.com", + "strideLength": 4.3, + "dailyStepGoal": 10000, + "friends": [ + 16, + 4, + 8 + ] + }); }) it.skip('should have an id', function () { diff --git a/test/UserRepository-test.js b/test/UserRepository-test.js index 437e9dbca0..96265b3001 100644 --- a/test/UserRepository-test.js +++ b/test/UserRepository-test.js @@ -2,33 +2,33 @@ import { expect } from 'chai'; import UserRepository from '../src/UserRepository'; describe('User Repository', () => { - it('should be a function', function () { + it.skip('should be a function', function () { expect(UserRepository).to.be.a('function'); }); - it('should instantiate a new user repository', function () { + it.skip('should instantiate a new user repository', function () { expect(userRepository).to.be.a('function'); - }) - - it('should take in user data', function() { + }) + + it.skip('should take in user data', function () { expect(user.data).to.equal({}) - }) - - it('should supply user data when given id', function() { - + }) + + it.skip('should supply user data when given id', function () { + userRepository.getData() - + expect(user.id).to.equal(user.userData) - }) - - it('should give the average step goal of all users', function () { - + }) + + it.skip('should give the average step goal of all users', function () { + userRepository.stepAverage() - + expect() - }) + }) }); From 0c20f092a9782a67c976cc393eaa4d324724372c Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sun, 4 Dec 2022 09:46:54 -0700 Subject: [PATCH 034/188] Pass test 4 --- test/User-test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/User-test.js b/test/User-test.js index bb5b1549b0..48c5940d7a 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -77,9 +77,9 @@ describe('User', () => { }); }) - it.skip('should have an id', function () { + it('should have an id', function () { - expect(user.id).to.equal(userData.id); + expect(user1.userData.id).to.equal(1); }) it.skip('should have an name', function () { From 743a9b767c0da5c1f0107055c9265fd8055ac7da Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sun, 4 Dec 2022 09:48:38 -0700 Subject: [PATCH 035/188] Pass user test number 5 --- test/User-test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/User-test.js b/test/User-test.js index 48c5940d7a..e16a51bde5 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -82,9 +82,9 @@ describe('User', () => { expect(user1.userData.id).to.equal(1); }) - it.skip('should have an name', function () { + it('should have an name', function () { - expect(user.name).to.equal(userData.name); + expect(user1.userData.name).to.equal("Luisa Hane"); }) it.skip('should have an address', function () { From 0c08729a73f10b9f08c1164bb7d2356230494226 Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sun, 4 Dec 2022 10:04:51 -0700 Subject: [PATCH 036/188] Pass address test --- test/User-test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/User-test.js b/test/User-test.js index e16a51bde5..6e088c341e 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -87,9 +87,9 @@ describe('User', () => { expect(user1.userData.name).to.equal("Luisa Hane"); }) - it.skip('should have an address', function () { + it('should have an address', function () { - expect(user.address).to.equal(userData.address); + expect(user1.userData.address).to.equal("15195 Nakia Tunnel, Erdmanport VA 19901-1697"); }) it.skip('should have an email', function () { From 2bca2accbcf3380b309d80544e1bc602e6ee1e32 Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sun, 4 Dec 2022 10:05:52 -0700 Subject: [PATCH 037/188] Pass email test --- test/User-test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/User-test.js b/test/User-test.js index 6e088c341e..142127ddcf 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -92,9 +92,9 @@ describe('User', () => { expect(user1.userData.address).to.equal("15195 Nakia Tunnel, Erdmanport VA 19901-1697"); }) - it.skip('should have an email', function () { + it('should have an email', function () { - expect(user.email).to.equal(userData.email); + expect(user1.userData.email).to.equal("Diana.Hayes1@hotmail.com"); }) it.skip('should have a strideLength', function () { From 052e0155aec6be4b51992712126e904485e21461 Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sun, 4 Dec 2022 10:07:02 -0700 Subject: [PATCH 038/188] Pass stride length test --- test/User-test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/User-test.js b/test/User-test.js index 142127ddcf..33fa314b9f 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -97,9 +97,9 @@ describe('User', () => { expect(user1.userData.email).to.equal("Diana.Hayes1@hotmail.com"); }) - it.skip('should have a strideLength', function () { + it('should have a strideLength', function () { - expect(user.strideLength).to.equal(userData.strideLength); + expect(user1.userData.strideLength).to.equal(4.3); }) it.skip('should have a step goal', function () { From 6c7ffa1ad91e9493f9fef3218f0dd7bcb3affcbf Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sun, 4 Dec 2022 10:08:30 -0700 Subject: [PATCH 039/188] Pass step goal test --- test/User-test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/User-test.js b/test/User-test.js index 33fa314b9f..68432a4193 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -102,9 +102,9 @@ describe('User', () => { expect(user1.userData.strideLength).to.equal(4.3); }) - it.skip('should have a step goal', function () { + it('should have a step goal', function () { - expect(user.dailyStepGoal).to.equal(userData.dailyStepGoal); + expect(user1.userData.dailyStepGoal).to.equal(10000); }) it.skip('should have friends', function () { From 63f1c9043a3a7dfe4a6de2062b9efa58fe0ca95c Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sun, 4 Dec 2022 10:11:15 -0700 Subject: [PATCH 040/188] Pass friends test --- test/User-test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/User-test.js b/test/User-test.js index 68432a4193..2b6b89e25b 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -107,10 +107,10 @@ describe('User', () => { expect(user1.userData.dailyStepGoal).to.equal(10000); }) - it.skip('should have friends', function () { + it('should have friends', function () { - expect(user.friends).to.equal(userData.friends); + expect(user1.userData.friends).to.deep.equal([16, 4, 8]); }) it.skip('should return users first name', function () { From f40e2b8be24a37d0d03250bb5883018f85418809 Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sun, 4 Dec 2022 10:16:08 -0700 Subject: [PATCH 041/188] Add getFirstName method and pass corresponding test --- src/User.js | 4 ++++ test/User-test.js | 8 ++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/User.js b/src/User.js index 31151f8ab9..9e787b5fb7 100644 --- a/src/User.js +++ b/src/User.js @@ -2,6 +2,10 @@ class User { constructor(userData) { this.userData = userData; } + + getFirstName() { + return this.userData.name; + } } export default User; \ No newline at end of file diff --git a/test/User-test.js b/test/User-test.js index 2b6b89e25b..e6f26e3d6f 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -109,16 +109,12 @@ describe('User', () => { it('should have friends', function () { - expect(user1.userData.friends).to.deep.equal([16, 4, 8]); }) - it.skip('should return users first name', function () { - - user.getFirstName(userData) - + it('should return users first name', function () { - expect(user.name).to.equal(userData.name) + expect(user1.getFirstName()).to.equal("Luisa Hane"); }) }); From a0a8ed87a00c7fd34e48c2c6df5bd9b5df52a585 Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sun, 4 Dec 2022 10:18:43 -0700 Subject: [PATCH 042/188] Remove all comments --- test/User-test.js | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/test/User-test.js b/test/User-test.js index e6f26e3d6f..c80e1374c6 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -1,8 +1,5 @@ import { expect } from 'chai'; import User from '../src/User'; -// import UserRepository from '../src/UserRepository'; -import users from '../src/data/users'; -import userData from '../src/data/users'; describe('User', () => { @@ -52,6 +49,7 @@ describe('User', () => { }) it('should be a function', function () { + expect(User).to.be.a('function'); }); @@ -117,24 +115,4 @@ describe('User', () => { expect(user1.getFirstName()).to.equal("Luisa Hane"); }) -}); - - -// Should be a function -// Should represent a single player -// Should have a parameter to take in a userData object -//Each user should have id, name, address, email, stride length, daily step goal, friends hydration/sleep? -// Should have method to return users first name - - -// Let user1 = new User({"id": 1, -// "name": "Luisa Hane", -// "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", -// "email": "Diana.Hayes1@hotmail.com", -// "strideLength": 4.3, -// "dailyStepGoal": 10000, -// "friends": [ -// 16, -// 4, -// 8 -// ]}) \ No newline at end of file +}); \ No newline at end of file From a4175f215aa56ee3df27a86fdcd6582022968da5 Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Sun, 4 Dec 2022 10:40:29 -0700 Subject: [PATCH 043/188] Add beforeEach to user repo --- src/UserRepository.js | 5 ++++- test/User-test.js | 2 +- test/UserRepository-test.js | 16 ++++++++-------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/UserRepository.js b/src/UserRepository.js index be15c9fa0f..f0743bf880 100644 --- a/src/UserRepository.js +++ b/src/UserRepository.js @@ -1,6 +1,9 @@ +import userData from './data/users'; +// const data = require('./data/users') + class UserRepository { constructor(data) { - + this.data = data } } diff --git a/test/User-test.js b/test/User-test.js index 2a95a38c7e..ca6cd72a86 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -63,7 +63,7 @@ describe('User', () => { expect(user.friends).to.equal(userData.friends); }) - it('should return users first name,' function() { + it('should return users first name', function() { user.getFirstName(userData) diff --git a/test/UserRepository-test.js b/test/UserRepository-test.js index f8489d3490..3a4c909294 100644 --- a/test/UserRepository-test.js +++ b/test/UserRepository-test.js @@ -1,10 +1,9 @@ import { expect } from 'chai'; -import { beforeEach } from 'mocha'; import User from '../src/User'; import UserRepository from '../src/UserRepository'; -import userData from '../src/data/users.js'; +import userData from '../src/data/users'; -describe('User Repository', () => { +describe('UserRepository', () => { let user1, user2, user3, userRepository; beforeEach(() => { @@ -14,18 +13,19 @@ beforeEach(() => { userRepository = new UserRepository([user1, user2, user3]) }) - it.skip('should be a function', function () { + it('should be a function', function () { + expect(UserRepository).to.be.a('function'); }); - it.skip('should instantiate a new user repository', function () { - - expect(userRepository).to.be.a('function'); + it('should instantiate a new user repository', function () { + + expect(userRepository.data).to.deep.equal([user1, user2, user3]); }) it.skip('should take in user data', function() { - expect(user1.data).to.equal( + expect(user1.userData).to.equal( {"id": 1, "name": "Luisa Hane", "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", From 102af27b3918c24c17189df76d8181343ecd9aa4 Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Sun, 4 Dec 2022 10:50:56 -0700 Subject: [PATCH 044/188] Pass tests --- test/UserRepository-test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/UserRepository-test.js b/test/UserRepository-test.js index f44aca20e5..695577f2bb 100644 --- a/test/UserRepository-test.js +++ b/test/UserRepository-test.js @@ -23,9 +23,9 @@ beforeEach(() => { expect(userRepository.data).to.deep.equal([user1, user2, user3]); }) - it.skip('should take in user data', function() { + it('should take in user data', function() { - expect(user1.userData).to.equal( + expect(user1.userData).to.deep.equal( {"id": 1, "name": "Luisa Hane", "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", From 11402f20d432abacb1b6d42add00ef1ed92d60e2 Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Sun, 4 Dec 2022 11:52:49 -0700 Subject: [PATCH 045/188] Write and pass test on line 43 --- test/UserRepository-test.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/test/UserRepository-test.js b/test/UserRepository-test.js index 695577f2bb..0f51e8a21b 100644 --- a/test/UserRepository-test.js +++ b/test/UserRepository-test.js @@ -40,18 +40,14 @@ beforeEach(() => { }) }) - it.skip('should supply user data when given id', function() { + it('should supply user data when given id', function() { - userRepository.getData() - - expect(user2.id).to.equal(user2.userData) + expect(userRepository.getData(user2.userData.id)).to.deep.equal(user2) }) - it.skip('should give the average step goal of all users', function () { + it('should give the average step goal of all users', function () { - userRepository.stepAverage() - - expect() + expect(userRepository.stepAverage()).to.equal() }) }); From 5f27c9ef2861c22e4242d242a258e259c147c251 Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Sun, 4 Dec 2022 12:01:24 -0700 Subject: [PATCH 046/188] Write and pass test for avg step goal --- test/UserRepository-test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/UserRepository-test.js b/test/UserRepository-test.js index 0f51e8a21b..502b2c0551 100644 --- a/test/UserRepository-test.js +++ b/test/UserRepository-test.js @@ -47,7 +47,7 @@ beforeEach(() => { it('should give the average step goal of all users', function () { - expect(userRepository.stepAverage()).to.equal() + expect(userRepository.stepGoalAverage()).to.equal(6666) }) }); From f73e578b1f23559d4c669ed3fd1d920d0da7a4ac Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Sun, 4 Dec 2022 12:01:58 -0700 Subject: [PATCH 047/188] Add methods for getData and stepGoalAverage --- src/UserRepository.js | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/src/UserRepository.js b/src/UserRepository.js index f0743bf880..e8c80375f6 100644 --- a/src/UserRepository.js +++ b/src/UserRepository.js @@ -1,10 +1,29 @@ import userData from './data/users'; +import User from './User'; // const data = require('./data/users') class UserRepository { - constructor(data) { - this.data = data - } + constructor(data) { + this.data = data + } + + getData(userID) { + let user = this.data.find((currentUser) => { + if (currentUser.userData.id === userID) { + return currentUser.userData + } + }) + return user + } + + stepGoalAverage() { + let sum = this.data.reduce((acc, user) => { + acc += user.userData.dailyStepGoal + return acc + }, 0) + let totalUsers = this.data.length + return parseInt(sum / totalUsers) + } } export default UserRepository; @@ -25,13 +44,13 @@ export default UserRepository; // It should have methods to determine: // Given a user’s ID, what is their user data? - //go through the users - //return the corresponding user object when its found - //now we have access to their info + //go through the users + //return the corresponding user object when its found + //now we have access to their info // The average step goal amongst all users - //go through each user - //possibly use reduce method? - //get total daily step goal number - //divide by user count \ No newline at end of file + //go through each user + //possibly use reduce method? + //get total daily step goal number + //divide by user count \ No newline at end of file From 647d5e5a32dc2263b741b83c92b333a226372c3e Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Mon, 5 Dec 2022 14:00:50 -0700 Subject: [PATCH 048/188] Add imports and getUser method start --- src/scripts.js | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/scripts.js b/src/scripts.js index 06bae3d5d1..65f5c3e550 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -1,17 +1,23 @@ -// This is the JavaScript entry file - your code begins here -// Do not delete or rename this file ******** - -console.log(userData,"<>>>>userData") -// An example of how you tell webpack to use a CSS file +// import './images/turing-logo.png' +//console.log(userData,"<>>>>userData") import './css/styles.css'; +import User from '../src/User'; +import userData from '../src/data/users' +import UserRepository from './UserRepository'; + +// Global Variables + + +// +function getUser() { + let randomIndex = Math.floor(Math.random() * userRepository.data.length); + let randomUser = userRepository.data[randomIndex]; + currentUser = new User(randomUser); +} + -// An example of how you tell webpack to use an image (also need to link to it in the index.html) -import './images/turing-logo.png' console.log('This is the JavaScript entry file - your code begins here.'); -// An example of how you tell webpack to use a JS file -import userData from './data/users'; -import UserRepository from './UserRepository'; From dd7ffc468f688867e08f4c25c0eedab760e58f13 Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Mon, 5 Dec 2022 14:03:54 -0700 Subject: [PATCH 049/188] Add commented out section names --- src/scripts.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/scripts.js b/src/scripts.js index 65f5c3e550..c4704a40ca 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -7,8 +7,13 @@ import UserRepository from './UserRepository'; // Global Variables +//Query Selectors -// +// Event Listeners + +//Event Handlers + +// Functions function getUser() { let randomIndex = Math.floor(Math.random() * userRepository.data.length); let randomUser = userRepository.data[randomIndex]; From e29635de3f475bb7e483306c2dbf7fd458ec3698 Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Mon, 5 Dec 2022 14:15:03 -0700 Subject: [PATCH 050/188] Add infoBox query selector --- src/scripts.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/scripts.js b/src/scripts.js index c4704a40ca..579f3182ec 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -8,7 +8,7 @@ import UserRepository from './UserRepository'; // Global Variables //Query Selectors - +const infoBox = document.querySelector('.zero') // Event Listeners //Event Handlers @@ -20,6 +20,10 @@ function getUser() { currentUser = new User(randomUser); } +function displayUserInfo() { + +} + console.log('This is the JavaScript entry file - your code begins here.'); From 8951594ea64a3caf422a640533638fd57777fdef Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Mon, 5 Dec 2022 15:38:05 -0700 Subject: [PATCH 051/188] Connect HTML to DOM --- src/scripts.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/scripts.js b/src/scripts.js index 579f3182ec..ba32148390 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -1,18 +1,26 @@ // import './images/turing-logo.png' //console.log(userData,"<>>>>userData") import './css/styles.css'; -import User from '../src/User'; -import userData from '../src/data/users' -import UserRepository from './UserRepository'; +// import User fromgit '../src/User'; +// import userData from '../src/data/users' +// import UserRepository from './UserRepository'; // Global Variables +let one = 1 //Query Selectors -const infoBox = document.querySelector('.zero') +var infoBox = document.querySelector('.zero') + console.log(1) + console.log(infoBox) + // Event Listeners +infoBox.addEventListener('click', displayUserInfo) //Event Handlers - +function displayUserInfo() { + console.log("Hi") + infoBox.innerHTML = "Hello" +} // Functions function getUser() { let randomIndex = Math.floor(Math.random() * userRepository.data.length); @@ -20,9 +28,6 @@ function getUser() { currentUser = new User(randomUser); } -function displayUserInfo() { - -} From be1aee53730bafba3d5aa3d5f7f090cd5acc745e Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Mon, 5 Dec 2022 15:39:04 -0700 Subject: [PATCH 052/188] Add and remove scripts.js --- dist/index.html | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/dist/index.html b/dist/index.html index 0d4fc8d586..f3c10149a5 100644 --- a/dist/index.html +++ b/dist/index.html @@ -8,20 +8,21 @@

Activity Tracker

- turing logo +
-
Hi
-
Bonjour
+
Your Info
+
Bonjour
Hola
-
Annyeong
-
Konnichiwa
-
Da jia hao
+
Annyeong
+
Konnichiwa
+
Da jia hao
- + + \ No newline at end of file From e814a15bee62132fff74d2a51fa854978c66e399 Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Mon, 5 Dec 2022 15:45:31 -0700 Subject: [PATCH 053/188] Add export --- test/User-test.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/User-test.js b/test/User-test.js index 691cbc08a9..9fbb81d842 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -1,5 +1,6 @@ import { expect } from 'chai'; -import User from '../src/User'; +import userData from '../src/data/users' +import User from '../src/User' describe('User', () => { From 551c2ccf13c865b110b955e03fbfc195ac0e14dc Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Mon, 5 Dec 2022 15:46:00 -0700 Subject: [PATCH 054/188] Add formatting --- src/scripts.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/scripts.js b/src/scripts.js index ba32148390..10b5907b15 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -10,17 +10,16 @@ let one = 1 //Query Selectors var infoBox = document.querySelector('.zero') - console.log(1) - console.log(infoBox) + // Event Listeners -infoBox.addEventListener('click', displayUserInfo) +window.addEventListener('load', displayUserInfo) //Event Handlers function displayUserInfo() { - console.log("Hi") infoBox.innerHTML = "Hello" } + // Functions function getUser() { let randomIndex = Math.floor(Math.random() * userRepository.data.length); From d31a831b345b883f9699391a5695a538e1e42796 Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Mon, 5 Dec 2022 16:09:05 -0700 Subject: [PATCH 055/188] Add HTML titles to grid boxes --- dist/index.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/index.html b/dist/index.html index f3c10149a5..0900a10c1e 100644 --- a/dist/index.html +++ b/dist/index.html @@ -13,11 +13,11 @@

Activity Tracker

Your Info
-
Bonjour
-
Hola
-
Annyeong
-
Konnichiwa
-
Da jia hao
+
Hydration
+
StepGoal
+
Activity
+
Friends
+
Sleep
From ff29ac976a11322f72499317dd7b52fe6ace2020 Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Mon, 5 Dec 2022 16:09:30 -0700 Subject: [PATCH 056/188] Add event listers and query selectors --- src/scripts.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/scripts.js b/src/scripts.js index 10b5907b15..8704a140c9 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -9,11 +9,24 @@ import './css/styles.css'; let one = 1 //Query Selectors -var infoBox = document.querySelector('.zero') - + infoBox = document.querySelector('.zero') + hydrationBox = document.querySelector('.one') + stepGoalBox = document.querySelector('.two') + activityBox = document.querySelector('.three') + friendsBox = document.querySelector('.four') + sleepBox = document.querySelector('.five') + activityTrackerTitle = document.querySelector(h1) // Event Listeners window.addEventListener('load', displayUserInfo) +// infoBox.addEventListener('click', ) +// hydrationBox.addEventListener('click', ) +// stepGoalBox.addEventListener('click', ) +// activityBox.addEventListener('click', ) +// friendsBox.addEventListener('click', ) +// sleepBox.addEventListener('click', ) +// activityTrackerTitle.addEventListener('click', ) + //Event Handlers function displayUserInfo() { From 2ee458868e42bc7a374d2bdf3460bc51bec7c3e4 Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Mon, 5 Dec 2022 17:21:53 -0700 Subject: [PATCH 057/188] Write fetch call for all data --- src/apiCalls.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/apiCalls.js b/src/apiCalls.js index f26ab3fc82..b7a7f4b277 100644 --- a/src/apiCalls.js +++ b/src/apiCalls.js @@ -1,5 +1,14 @@ // Your fetch requests will live here! +// const usersURL = 'https://fitlit-api.herokuapp.com/api/v1/users' +// const sleepURL = 'https://fitlit-api.herokuapp.com/api/v1/sleep' +// const hydrationURL = 'https://fitlit-api.herokuapp.com/api/v1/hydration' +function getAPIData(info) { + const fetchedInfo = fetch(`https://fitlit-api.herokuapp.com/api/v1/${info}`) + .then((res) => res.json()) + .catch(err => console.log('To err is human', err)) + return fetchedInfo +} -console.log('I will be a fetch request!') +export {getAPIData} \ No newline at end of file From 1e48ef4fbf1333f02821ccf7666d5b6d1d432273 Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Mon, 5 Dec 2022 17:23:07 -0700 Subject: [PATCH 058/188] Write promise all, refactor getUser function --- src/scripts.js | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/src/scripts.js b/src/scripts.js index 10b5907b15..0f63832036 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -1,12 +1,16 @@ // import './images/turing-logo.png' //console.log(userData,"<>>>>userData") import './css/styles.css'; -// import User fromgit '../src/User'; +import {getAPIData} from './apiCalls' +import User from '../src/User'; // import userData from '../src/data/users' -// import UserRepository from './UserRepository'; +import UserRepository from './UserRepository'; // Global Variables let one = 1 +let users +let sleep +let hydration //Query Selectors var infoBox = document.querySelector('.zero') @@ -16,15 +20,33 @@ var infoBox = document.querySelector('.zero') window.addEventListener('load', displayUserInfo) //Event Handlers +function getAllData() { + Promise.all([getAPIData('users'), getAPIData('sleep'), getAPIData('hydration')]) + .then((data) => { + users = new UserRepository(data[0]) + sleep = data[1] + hydration = data[2] + + console.log('users', users) + console.log('sleep', sleep) + console.log('hydration', hydration) + }) + .then() + +} + function displayUserInfo() { - infoBox.innerHTML = "Hello" + // infoBox.innerHTML = "Hello" + getAllData() + getUser() } // Functions function getUser() { - let randomIndex = Math.floor(Math.random() * userRepository.data.length); - let randomUser = userRepository.data[randomIndex]; + let randomIndex = Math.floor(Math.random() * users.data.length); + let randomUser = users.data[randomIndex]; currentUser = new User(randomUser); + console.log('current user', currentUser) } From 0834a6e3848d263203200ae488d51836bdeebf60 Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Mon, 5 Dec 2022 17:36:21 -0700 Subject: [PATCH 059/188] Move .catch statement to scripts file --- src/apiCalls.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/apiCalls.js b/src/apiCalls.js index b7a7f4b277..cf0d77fe5e 100644 --- a/src/apiCalls.js +++ b/src/apiCalls.js @@ -6,7 +6,6 @@ function getAPIData(info) { const fetchedInfo = fetch(`https://fitlit-api.herokuapp.com/api/v1/${info}`) .then((res) => res.json()) - .catch(err => console.log('To err is human', err)) return fetchedInfo } From 74213aea40f7a68868bfb14ade006c24b687eddb Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Mon, 5 Dec 2022 17:37:13 -0700 Subject: [PATCH 060/188] Refactor getUser function to get a current user --- src/scripts.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/scripts.js b/src/scripts.js index 0f63832036..ddb660617e 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -11,6 +11,7 @@ let one = 1 let users let sleep let hydration +let currentUser //Query Selectors var infoBox = document.querySelector('.zero') @@ -31,22 +32,20 @@ function getAllData() { console.log('sleep', sleep) console.log('hydration', hydration) }) - .then() - + .then(() => getUser()) + .catch(err => console.log('To err is human', err)) } function displayUserInfo() { // infoBox.innerHTML = "Hello" getAllData() - getUser() } // Functions function getUser() { - let randomIndex = Math.floor(Math.random() * users.data.length); - let randomUser = users.data[randomIndex]; + let randomIndex = Math.floor(Math.random() * users.data.userData.length); + let randomUser = users.data.userData[randomIndex]; currentUser = new User(randomUser); - console.log('current user', currentUser) } From 65658e43c9c4051f90f1439ee2a55fdf4a3a6eee Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Mon, 5 Dec 2022 18:16:46 -0700 Subject: [PATCH 061/188] add a user class instantiation --- src/UserRepository.js | 1 - src/scripts.js | 19 +++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/UserRepository.js b/src/UserRepository.js index e8c80375f6..54afc21403 100644 --- a/src/UserRepository.js +++ b/src/UserRepository.js @@ -40,7 +40,6 @@ export default UserRepository; - // It should have methods to determine: // Given a user’s ID, what is their user data? diff --git a/src/scripts.js b/src/scripts.js index 8704a140c9..1b609819a9 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -1,12 +1,27 @@ // import './images/turing-logo.png' //console.log(userData,"<>>>>userData") import './css/styles.css'; -// import User fromgit '../src/User'; +import User from '../src/User'; // import userData from '../src/data/users' // import UserRepository from './UserRepository'; // Global Variables -let one = 1 + +const user = new User ( { + "id": 1, + "name": "Luisa Hane", + "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", + "email": "Diana.Hayes1@hotmail.com", + "strideLength": 4.3, + "dailyStepGoal": 10000, + "friends": [ + 16, + 4, + 8 + ] +}) + +console.log(user) //Query Selectors infoBox = document.querySelector('.zero') From 72185a0352808f912cd0d7cb36e7b16dfec55c6d Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Mon, 5 Dec 2022 18:35:18 -0700 Subject: [PATCH 062/188] add user name display --- src/scripts.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/scripts.js b/src/scripts.js index 1b609819a9..f7c6e74e9b 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -24,13 +24,13 @@ const user = new User ( { console.log(user) //Query Selectors - infoBox = document.querySelector('.zero') - hydrationBox = document.querySelector('.one') - stepGoalBox = document.querySelector('.two') - activityBox = document.querySelector('.three') - friendsBox = document.querySelector('.four') - sleepBox = document.querySelector('.five') - activityTrackerTitle = document.querySelector(h1) + let infoBox = document.querySelector('.zero') + let hydrationBox = document.querySelector('.one') + let stepGoalBox = document.querySelector('.two') + let activityBox = document.querySelector('.three') + let friendsBox = document.querySelector('.four') + let sleepBox = document.querySelector('.five') + let activityTrackerTitle = document.querySelector('h1') // Event Listeners window.addEventListener('load', displayUserInfo) @@ -45,7 +45,8 @@ window.addEventListener('load', displayUserInfo) //Event Handlers function displayUserInfo() { - infoBox.innerHTML = "Hello" + console.log('hi') + infoBox.innerText = `${user.userData.name}` } // Functions From 1280e0ba041fa9e797efd36225d40eb0f550ea3a Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Mon, 5 Dec 2022 18:45:00 -0700 Subject: [PATCH 063/188] update getfirstname function --- dist/index.html | 2 +- src/User.js | 2 +- src/scripts.js | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/dist/index.html b/dist/index.html index 0900a10c1e..b31d8955b8 100644 --- a/dist/index.html +++ b/dist/index.html @@ -7,7 +7,7 @@
-

Activity Tracker

+

Welcome

diff --git a/src/User.js b/src/User.js index 9e787b5fb7..ed0d3c7304 100644 --- a/src/User.js +++ b/src/User.js @@ -4,7 +4,7 @@ class User { } getFirstName() { - return this.userData.name; + return this.userData.name.split(' ')[0]; } } diff --git a/src/scripts.js b/src/scripts.js index f7c6e74e9b..b64906a010 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -40,7 +40,7 @@ window.addEventListener('load', displayUserInfo) // activityBox.addEventListener('click', ) // friendsBox.addEventListener('click', ) // sleepBox.addEventListener('click', ) -// activityTrackerTitle.addEventListener('click', ) +window.addEventListener('load', displayWelcomeName) //Event Handlers @@ -49,6 +49,11 @@ function displayUserInfo() { infoBox.innerText = `${user.userData.name}` } +function displayWelcomeName() { + console.log('potato') + activityTrackerTitle.innerText += ` ${user.getFirstName()}` + } + // Functions function getUser() { let randomIndex = Math.floor(Math.random() * userRepository.data.length); From 85bb263475025c4588544c13ceef44a01bc19b57 Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Mon, 5 Dec 2022 18:59:48 -0700 Subject: [PATCH 064/188] display most users info --- dist/index.html | 2 +- src/scripts.js | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dist/index.html b/dist/index.html index b31d8955b8..f7882d241d 100644 --- a/dist/index.html +++ b/dist/index.html @@ -12,7 +12,7 @@

Welcome

-
Your Info
+
Your Info
Hydration
StepGoal
Activity
diff --git a/src/scripts.js b/src/scripts.js index b64906a010..060a7d7671 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -31,6 +31,7 @@ console.log(user) let friendsBox = document.querySelector('.four') let sleepBox = document.querySelector('.five') let activityTrackerTitle = document.querySelector('h1') + let userInfoList = document.querySelector("#userInfoList") // Event Listeners window.addEventListener('load', displayUserInfo) @@ -46,7 +47,12 @@ window.addEventListener('load', displayWelcomeName) //Event Handlers function displayUserInfo() { console.log('hi') - infoBox.innerText = `${user.userData.name}` + userInfoList.innerHTML += `
  • ${user.userData.name}
  • +
  • ${user.userData.address}
  • +
  • ${user.userData.email}
  • +
  • Stride Length: ${user.userData.strideLength}
  • +
  • Daily Step Goal: ${user.userData.dailyStepGoal}
  • +
  • Friends: ${user.userData.friends}
  • ` } function displayWelcomeName() { From dc027f6f362a6c5ea63258a5d1f9bc862afba1dc Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Mon, 5 Dec 2022 19:05:35 -0700 Subject: [PATCH 065/188] add user repo class instantiation --- src/scripts.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/scripts.js b/src/scripts.js index 060a7d7671..1b555939af 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -2,8 +2,8 @@ //console.log(userData,"<>>>>userData") import './css/styles.css'; import User from '../src/User'; -// import userData from '../src/data/users' -// import UserRepository from './UserRepository'; +import userData from '../src/data/users' +import UserRepository from './UserRepository'; // Global Variables @@ -21,7 +21,9 @@ const user = new User ( { ] }) -console.log(user) +const userRepository = new UserRepository(userData) + +console.log(userRepository) //Query Selectors let infoBox = document.querySelector('.zero') From c80438418acd7d730ae318ded9ddc1597259c0fe Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Mon, 5 Dec 2022 20:07:34 -0700 Subject: [PATCH 066/188] add users friends function and update getdata function --- src/UserRepository.js | 11 ++++------- src/scripts.js | 13 ++++++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/UserRepository.js b/src/UserRepository.js index 54afc21403..b2fdf436e6 100644 --- a/src/UserRepository.js +++ b/src/UserRepository.js @@ -8,13 +8,10 @@ class UserRepository { } getData(userID) { - let user = this.data.find((currentUser) => { - if (currentUser.userData.id === userID) { - return currentUser.userData - } - }) - return user - } + let user = this.data.find((currentUser) => currentUser.id === userID) + console.log(user) + return user +} stepGoalAverage() { let sum = this.data.reduce((acc, user) => { diff --git a/src/scripts.js b/src/scripts.js index 1b555939af..512a758f6b 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -54,7 +54,7 @@ function displayUserInfo() {
  • ${user.userData.email}
  • Stride Length: ${user.userData.strideLength}
  • Daily Step Goal: ${user.userData.dailyStepGoal}
  • -
  • Friends: ${user.userData.friends}
  • ` +
  • Friends: ${getUserFriends()}
  • ` } function displayWelcomeName() { @@ -69,10 +69,13 @@ function getUser() { currentUser = new User(randomUser); } - - - -console.log('This is the JavaScript entry file - your code begins here.'); +function getUserFriends() { + let friendsArray = user.userData.friends.map(friend => { + return userRepository.getData(friend).name + }) + console.log(friendsArray) + return friendsArray.join(', ') +} From 5aa82efb969035340154404fde015b4f6d219bf1 Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Mon, 5 Dec 2022 20:12:03 -0700 Subject: [PATCH 067/188] refactor to remove console logs --- src/UserRepository.js | 5 ++--- src/scripts.js | 3 --- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/UserRepository.js b/src/UserRepository.js index b2fdf436e6..7f72e31a63 100644 --- a/src/UserRepository.js +++ b/src/UserRepository.js @@ -8,9 +8,8 @@ class UserRepository { } getData(userID) { - let user = this.data.find((currentUser) => currentUser.id === userID) - console.log(user) - return user + return this.data.find((currentUser) => currentUser.id === userID) + } stepGoalAverage() { diff --git a/src/scripts.js b/src/scripts.js index 512a758f6b..53e15c2b20 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -48,7 +48,6 @@ window.addEventListener('load', displayWelcomeName) //Event Handlers function displayUserInfo() { - console.log('hi') userInfoList.innerHTML += `
  • ${user.userData.name}
  • ${user.userData.address}
  • ${user.userData.email}
  • @@ -58,7 +57,6 @@ function displayUserInfo() { } function displayWelcomeName() { - console.log('potato') activityTrackerTitle.innerText += ` ${user.getFirstName()}` } @@ -73,7 +71,6 @@ function getUserFriends() { let friendsArray = user.userData.friends.map(friend => { return userRepository.getData(friend).name }) - console.log(friendsArray) return friendsArray.join(', ') } From f007b85c94ff0d7ec6ab24dc553d97757bf91322 Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Mon, 5 Dec 2022 20:17:27 -0700 Subject: [PATCH 068/188] add dynamic step goal display --- src/scripts.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/scripts.js b/src/scripts.js index 53e15c2b20..813f6a212b 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -39,7 +39,7 @@ console.log(userRepository) window.addEventListener('load', displayUserInfo) // infoBox.addEventListener('click', ) // hydrationBox.addEventListener('click', ) -// stepGoalBox.addEventListener('click', ) +window.addEventListener('load', stepGoalDisplay) // activityBox.addEventListener('click', ) // friendsBox.addEventListener('click', ) // sleepBox.addEventListener('click', ) @@ -60,6 +60,10 @@ function displayWelcomeName() { activityTrackerTitle.innerText += ` ${user.getFirstName()}` } +function stepGoalDisplay() { + stepGoalBox.innerText = `Your step goal is ${user.userData.dailyStepGoal} steps.` +} + // Functions function getUser() { let randomIndex = Math.floor(Math.random() * userRepository.data.length); From 1d2cacfa2b8301226c84a8bcbaf4a2fb144e4eae Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Mon, 5 Dec 2022 20:19:24 -0700 Subject: [PATCH 069/188] add average step goal comparison --- src/UserRepository.js | 2 +- src/scripts.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/UserRepository.js b/src/UserRepository.js index 7f72e31a63..f490103cd4 100644 --- a/src/UserRepository.js +++ b/src/UserRepository.js @@ -14,7 +14,7 @@ class UserRepository { stepGoalAverage() { let sum = this.data.reduce((acc, user) => { - acc += user.userData.dailyStepGoal + acc += user.dailyStepGoal return acc }, 0) let totalUsers = this.data.length diff --git a/src/scripts.js b/src/scripts.js index 813f6a212b..a64248af64 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -61,7 +61,7 @@ function displayWelcomeName() { } function stepGoalDisplay() { - stepGoalBox.innerText = `Your step goal is ${user.userData.dailyStepGoal} steps.` + stepGoalBox.innerText = `Your step goal is ${user.userData.dailyStepGoal} steps. The average step goal is ${userRepository.stepGoalAverage()}.` } // Functions From 50ad33e0d149861c3932607b3ad7b581ed761606 Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Tue, 6 Dec 2022 17:17:47 -0700 Subject: [PATCH 070/188] Debug errors in getAllData function --- src/scripts.js | 49 +++++++++++++++++++------------------------------ 1 file changed, 19 insertions(+), 30 deletions(-) diff --git a/src/scripts.js b/src/scripts.js index 9a16e9d1b3..b6cd19c7ba 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -3,7 +3,7 @@ import './css/styles.css'; import {getAPIData} from './apiCalls' import User from '../src/User'; -// import userData from '../src/data/users' +import userData from '../src/data/users' import UserRepository from './UserRepository'; // Global Variables @@ -11,22 +11,7 @@ let one = 1 let users let sleep let hydration -let currentUser - - -const user = new User ( { - "id": 1, - "name": "Luisa Hane", - "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", - "email": "Diana.Hayes1@hotmail.com", - "strideLength": 4.3, - "dailyStepGoal": 10000, - "friends": [ - 16, - 4, - 8 - ] -}) +let currentUser const userRepository = new UserRepository(userData) @@ -43,14 +28,15 @@ console.log(userRepository) let userInfoList = document.querySelector("#userInfoList") // Event Listeners -window.addEventListener('load', displayUserInfo) +window.addEventListener('load', getAllData) +// window.addEventListener('load', displayUserInfo) // infoBox.addEventListener('click', ) // hydrationBox.addEventListener('click', ) -window.addEventListener('load', stepGoalDisplay) +// window.addEventListener('load', stepGoalDisplay) // activityBox.addEventListener('click', ) // friendsBox.addEventListener('click', ) // sleepBox.addEventListener('click', ) -window.addEventListener('load', displayWelcomeName) +// window.addEventListener('load', displayWelcomeName) //Event Handlers @@ -60,31 +46,34 @@ function getAllData() { users = new UserRepository(data[0]) sleep = data[1] hydration = data[2] - + console.log('data', data) console.log('users', users) console.log('sleep', sleep) console.log('hydration', hydration) }) .then(() => getUser()) + .then(() => displayUserInfo()) + .then(() => stepGoalDisplay()) + .then(() => displayWelcomeName()) .catch(err => console.log('To err is human', err)) } function displayUserInfo() { - getAllData() - userInfoList.innerHTML += `
  • ${user.userData.name}
  • -
  • ${user.userData.address}
  • -
  • ${user.userData.email}
  • -
  • Stride Length: ${user.userData.strideLength}
  • -
  • Daily Step Goal: ${user.userData.dailyStepGoal}
  • + // getAllData() + userInfoList.innerHTML += `
  • ${currentUser.userData.name}
  • +
  • ${currentUser.userData.address}
  • +
  • ${currentUser.userData.email}
  • +
  • Stride Length: ${currentUser.userData.strideLength}
  • +
  • Daily Step Goal: ${currentUser.userData.dailyStepGoal}
  • Friends: ${getUserFriends()}
  • ` } function displayWelcomeName() { - activityTrackerTitle.innerText += ` ${user.getFirstName()}` + activityTrackerTitle.innerText += ` ${currentUser.getFirstName()}` } function stepGoalDisplay() { - stepGoalBox.innerText = `Your step goal is ${user.userData.dailyStepGoal} steps. The average step goal is ${userRepository.stepGoalAverage()}.` + stepGoalBox.innerText = `Your step goal is ${currentUser.userData.dailyStepGoal} steps. The average step goal is ${userRepository.stepGoalAverage()}.` } // Functions @@ -95,7 +84,7 @@ function getUser() { } function getUserFriends() { - let friendsArray = user.userData.friends.map(friend => { + let friendsArray = currentUser.userData.friends.map(friend => { return userRepository.getData(friend).name }) return friendsArray.join(', ') From 6c80d9be3ecb755908fd2145006ec5eac1626694 Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Tue, 6 Dec 2022 17:40:51 -0700 Subject: [PATCH 071/188] Comment out file to check API is working --- src/data/users.js | 1354 ++++++++++++++++++++++----------------------- 1 file changed, 677 insertions(+), 677 deletions(-) diff --git a/src/data/users.js b/src/data/users.js index dc315bd52d..9d541aca00 100644 --- a/src/data/users.js +++ b/src/data/users.js @@ -1,679 +1,679 @@ // Do not edit this file - const userData = [ - { - "id": 1, - "name": "Luisa Hane", - "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", - "email": "Diana.Hayes1@hotmail.com", - "strideLength": 4.3, - "dailyStepGoal": 10000, - "friends": [ - 16, - 4, - 8 - ] - }, - { - "id": 2, - "name": "Jarvis Considine", - "address": "30086 Kathryn Port, Ciceroland NE 07273", - "email": "Dimitri.Bechtelar11@gmail.com", - "strideLength": 4.5, - "dailyStepGoal": 5000, - "friends": [ - 9, - 18, - 24, - 19 - ] - }, - { - "id": 3, - "name": "Herminia Witting", - "address": "85823 Bosco Fork, East Oscarstad MI 85126-5660", - "email": "Elwin.Tromp@yahoo.com", - "strideLength": 4.4, - "dailyStepGoal": 5000, - "friends": [ - 19, - 11, - 42, - 33 - ] - }, - { - "id": 4, - "name": "Mae Connelly", - "address": "28926 Schinner Islands, Turnermouth NE 23720-3230", - "email": "Marcos_Pollich@hotmail.com", - "strideLength": 3.1, - "dailyStepGoal": 4000, - "friends": [ - 48, - 7, - 44, - 8 - ] - }, - { - "id": 5, - "name": "Erick Schaden", - "address": "514 Mayert Walk, Jordaneside SC 55023-6523", - "email": "Vanessa_Gerhold@gmail.com", - "strideLength": 3.1, - "dailyStepGoal": 8000, - "friends": [ - 13, - 44, - 49, - 33, - 10 - ] - }, - { - "id": 6, - "name": "Jerrold Bogisich", - "address": "8283 Carroll Harbor, Borerfort CT 69020-3448", - "email": "Mercedes_Zboncak53@yahoo.com", - "strideLength": 3.7, - "dailyStepGoal": 11000, - "friends": [ - 11, - 48, - 15 - ] - }, - { - "id": 7, - "name": "Breanne Fay", - "address": "834 Retta Knoll, Stantonland MA 71627-4121", - "email": "Dashawn28@gmail.com", - "strideLength": 2.9, - "dailyStepGoal": 8000, - "friends": [ - 12, - 27, - 22, - 30 - ] - }, - { - "id": 8, - "name": "Laney Abshire", - "address": "86416 Koch Inlet, North Kaciefurt MA 80635", - "email": "Janice_Nitzsche2@yahoo.com", - "strideLength": 2.8, - "dailyStepGoal": 2000, - "friends": [ - 11, - 41, - 23, - 49 - ] - }, - { - "id": 9, - "name": "Myron Schmitt", - "address": "85251 Martina Fields, West Aletha MD 00163-5315", - "email": "Gerard_Langosh22@hotmail.com", - "strideLength": 3.8, - "dailyStepGoal": 6000, - "friends": [ - 16, - 26, - 17 - ] - }, - { - "id": 10, - "name": "Roslyn Bernhard", - "address": "22859 Sean Meadow, Lake Dorthyfort MA 89560", - "email": "Hillary83@gmail.com", - "strideLength": 4.1, - "dailyStepGoal": 3000, - "friends": [ - 40, - 33 - ] - }, - { - "id": 11, - "name": "Dannie Berge", - "address": "52042 Douglas Passage, Port Faye NC 82258", - "email": "Fabian_Murray92@yahoo.com", - "strideLength": 2.9, - "dailyStepGoal": 9000, - "friends": [ - 15, - 19 - ] - }, - { - "id": 12, - "name": "Otis Kuhic", - "address": "853 Kulas Highway, Port Estellbury WI 96713", - "email": "Morton40@hotmail.com", - "strideLength": 3.4, - "dailyStepGoal": 11000, - "friends": [ - 28, - 41, - 24, - 23 - ] - }, - { - "id": 13, - "name": "Tom Schmeler", - "address": "1524 Clemmie River, Newtonbury RI 02849-3159", - "email": "Leopoldo.Sauer@gmail.com", - "strideLength": 3.2, - "dailyStepGoal": 4000, - "friends": [ - 33, - 14, - 3, - 43, - 35 - ] - }, - { - "id": 14, - "name": "Gloria Frami", - "address": "326 Littel Run, Tracemouth HI 02826-6898", - "email": "Jadon.OConnell@hotmail.com", - "strideLength": 3.5, - "dailyStepGoal": 12000, - "friends": [ - 34, - 22 - ] - }, - { - "id": 15, - "name": "Ezequiel Feest", - "address": "78801 Lauryn Plain, Lake Elinor MN 27856-9054", - "email": "Anthony_Toy@hotmail.com", - "strideLength": 4.4, - "dailyStepGoal": 5000, - "friends": [ - 10, - 23, - 35, - 20, - 5 - ] - }, - { - "id": 16, - "name": "Garnett Cruickshank", - "address": "992 Zita Mall, North Tremainemouth MA 19312-3532", - "email": "Laverna47@hotmail.com", - "strideLength": 3.9, - "dailyStepGoal": 10000, - "friends": [ - 25, - 31, - 3, - 16 - ] - }, - { - "id": 17, - "name": "Jade Walter", - "address": "796 Rogahn Track, Lubowitzhaven NJ 62669-3244", - "email": "Dylan_Langworth65@hotmail.com", - "strideLength": 4.3, - "dailyStepGoal": 5000, - "friends": [ - 8, - 31, - 40 - ] - }, - { - "id": 18, - "name": "Dan Hodkiewicz", - "address": "735 Johnnie Crest, New Madisyn IN 51116-6094", - "email": "Gertrude12@gmail.com", - "strideLength": 2.9, - "dailyStepGoal": 2000, - "friends": [ - 33, - 37 - ] - }, - { - "id": 19, - "name": "Wilburn Collins", - "address": "543 Keeling Road, Schummside ID 47123-6269", - "email": "Blake27@gmail.com", - "strideLength": 3.3, - "dailyStepGoal": 8000, - "friends": [ - 30, - 43, - 22, - 39 - ] - }, - { - "id": 20, - "name": "Ora O'Connell", - "address": "79585 Tania Ports, North Lillie MI 38947-4029", - "email": "Audreanne.Gulgowski6@yahoo.com", - "strideLength": 3.4, - "dailyStepGoal": 8000, - "friends": [ - 2, - 12, - 11, - 33 - ] - }, - { - "id": 21, - "name": "Alexandrea Wehner", - "address": "314 Richmond Islands, Brekkefort WI 71702-6994", - "email": "Americo_Hammes31@gmail.com", - "strideLength": 3, - "dailyStepGoal": 9000, - "friends": [ - 29, - 19 - ] - }, - { - "id": 22, - "name": "Maria Kemmer", - "address": "3416 Zoey Cliff, West Eda PA 17789-2282", - "email": "Nya25@yahoo.com", - "strideLength": 4.2, - "dailyStepGoal": 2000, - "friends": [ - 40, - 44, - 14 - ] - }, - { - "id": 23, - "name": "Karli Rodriguez", - "address": "52618 Conroy Burgs, Wiegandhaven NC 32787", - "email": "Marge.Farrell25@yahoo.com", - "strideLength": 3.2, - "dailyStepGoal": 7000, - "friends": [ - 28, - 31, - 14 - ] - }, - { - "id": 24, - "name": "Kristin Cruickshank", - "address": "806 Raynor Port, Kilbackbury OK 11077", - "email": "Waylon_Zulauf@hotmail.com", - "strideLength": 3.3, - "dailyStepGoal": 4000, - "friends": [ - 17, - 16, - 45, - 12 - ] - }, - { - "id": 25, - "name": "Isobel Schmeler", - "address": "5592 Donnelly Trail, Scottieport SC 35511", - "email": "Name79@yahoo.com", - "strideLength": 3.3, - "dailyStepGoal": 4000, - "friends": [ - 37, - 31, - 43 - ] - }, - { - "id": 26, - "name": "Greta Corkery", - "address": "99020 Botsford Knoll, Lake Cecil ID 44141", - "email": "Virgil28@hotmail.com", - "strideLength": 3, - "dailyStepGoal": 12000, - "friends": [ - 10, - 34, - 8, - 43 - ] - }, - { - "id": 27, - "name": "Johnathan Schulist", - "address": "868 Kathryn Pike, Gibsonport ME 79500-6839", - "email": "Mayra49@yahoo.com", - "strideLength": 3, - "dailyStepGoal": 10000, - "friends": [ - 17, - 46, - 40, - 44 - ] - }, - { - "id": 28, - "name": "Noemi Huels", - "address": "5437 Barton Oval, Caesarview RI 88637", - "email": "Geovany.Jaskolski@hotmail.com", - "strideLength": 3.3, - "dailyStepGoal": 2000, - "friends": [ - 18, - 16, - 47 - ] - }, - { - "id": 29, - "name": "Colten Trantow", - "address": "2625 Waino Skyway, Kaceybury ME 18723", - "email": "Demetris67@hotmail.com", - "strideLength": 4.2, - "dailyStepGoal": 9000, - "friends": [ - 9, - 5, - 41 - ] - }, - { - "id": 30, - "name": "Deborah Keebler", - "address": "039 Jerde Brook, South Helen TN 08907-6883", - "email": "Colt_Hermann59@gmail.com", - "strideLength": 3.7, - "dailyStepGoal": 9000, - "friends": [ - 13, - 36, - 2, - 26, - 28 - ] - }, - { - "id": 31, - "name": "Bertrand Yundt", - "address": "0032 Claudia Plain, Delfinaland RI 22298-3685", - "email": "Sibyl.Schmidt39@yahoo.com", - "strideLength": 3.4, - "dailyStepGoal": 7000, - "friends": [ - 16, - 41, - 9 - ] - }, - { - "id": 32, - "name": "Carrie Smith", - "address": "408 Windler Camp, Eddietown MA 11960", - "email": "Nikolas.Brakus31@yahoo.com", - "strideLength": 4.3, - "dailyStepGoal": 3000, - "friends": [ - 47, - 33 - ] - }, - { - "id": 33, - "name": "Leilani Quitzon", - "address": "60013 Golden Overpass, Lake Dejon WI 77309-0820", - "email": "Trinity_Rowe@hotmail.com", - "strideLength": 3.5, - "dailyStepGoal": 8000, - "friends": [ - 4, - 18, - 36, - 30 - ] - }, - { - "id": 34, - "name": "Lindsay Ruecker", - "address": "026 Koelpin Fall, Port Demarcus HI 76813-9743", - "email": "Art44@gmail.com", - "strideLength": 2.5, - "dailyStepGoal": 11000, - "friends": [ - 47, - 19, - 10 - ] - }, - { - "id": 35, - "name": "Nico Bechtelar", - "address": "83360 Christelle Ports, North Elliot IA 75496", - "email": "Eric_Aufderhar@yahoo.com", - "strideLength": 3.3, - "dailyStepGoal": 8000, - "friends": [ - 39, - 23, - 36 - ] - }, - { - "id": 36, - "name": "Clay Pfannerstill", - "address": "40262 Hauck Creek, Halvorsonfurt AL 81358-9303", - "email": "Zander21@gmail.com", - "strideLength": 3.7, - "dailyStepGoal": 8000, - "friends": [ - 40, - 11, - 14, - 29 - ] - }, - { - "id": 37, - "name": "Erling Anderson", - "address": "772 Hamill Avenue, Mortonport ID 38546-4861", - "email": "Aisha6@gmail.com", - "strideLength": 3.4, - "dailyStepGoal": 4000, - "friends": [ - 44, - 19, - 16 - ] - }, - { - "id": 38, - "name": "Kaitlyn Weber", - "address": "9440 Sincere Turnpike, New Shanon MN 11526-5774", - "email": "Dustin48@yahoo.com", - "strideLength": 3.6, - "dailyStepGoal": 10000, - "friends": [ - 5, - 21, - 37 - ] - }, - { - "id": 39, - "name": "Kenyatta Boyle", - "address": "80711 Beer Lakes, Nicolatown WA 89298", - "email": "Bailey_Abbott@yahoo.com", - "strideLength": 3.7, - "dailyStepGoal": 8000, - "friends": [ - 43, - 10, - 17 - ] - }, - { - "id": 40, - "name": "Esperanza Schumm", - "address": "5719 Hal Fork, Frederikstad SC 23125", - "email": "Otis_Beahan@yahoo.com", - "strideLength": 3.5, - "dailyStepGoal": 6000, - "friends": [ - 29, - 28, - 3 - ] - }, - { - "id": 41, - "name": "Meta Leffler", - "address": "51598 Sauer Plaza, Port Vicente WY 87161-8441", - "email": "Brice.Greenholt9@hotmail.com", - "strideLength": 2.8, - "dailyStepGoal": 2000, - "friends": [ - 6, - 45, - 31 - ] - }, - { - "id": 42, - "name": "Ernestine Heathcote", - "address": "9160 Blanche Ford, Dawnmouth OH 11816-1604", - "email": "Brandyn_Quitzon@hotmail.com", - "strideLength": 4.5, - "dailyStepGoal": 9000, - "friends": [ - 20, - 25, - 22 - ] - }, - { - "id": 43, - "name": "Alfonso Sporer", - "address": "584 Mayert Greens, West Arden SC 97033", - "email": "Jadon_Borer@gmail.com", - "strideLength": 4, - "dailyStepGoal": 5000, - "friends": [ - 2, - 19, - 43, - 33 - ] - }, - { - "id": 44, - "name": "Cora Rice", - "address": "32723 Brekke Burg, West Randallburgh DE 20889", - "email": "Coralie80@yahoo.com", - "strideLength": 3.1, - "dailyStepGoal": 8000, - "friends": [ - 25, - 37, - 42, - 27 - ] - }, - { - "id": 45, - "name": "Jennie O'Hara", - "address": "492 Stracke Mews, East Jazlyn OH 58002-5475", - "email": "Elenor.Block12@yahoo.com", - "strideLength": 4.4, - "dailyStepGoal": 7000, - "friends": [ - 35, - 39, - 31, - 25, - 33 - ] - }, - { - "id": 46, - "name": "Vincenzo Hayes", - "address": "03146 Bella Ferry, Port Royceberg NE 64057-4380", - "email": "Carlo.Walker@hotmail.com", - "strideLength": 3.6, - "dailyStepGoal": 4000, - "friends": [ - 10, - 29, - 44 - ] - }, - { - "id": 47, - "name": "Jevon Koss", - "address": "983 Charlotte Island, Schroederchester ME 39894-0208", - "email": "Kasandra_Bashirian@gmail.com", - "strideLength": 4.3, - "dailyStepGoal": 10000, - "friends": [ - 11, - 48, - 27, - 4 - ] - }, - { - "id": 48, - "name": "Jasper Stracke", - "address": "9119 Ziemann Road, Coltberg IA 56671", - "email": "Domenica.Kovacek17@yahoo.com", - "strideLength": 3.6, - "dailyStepGoal": 7000, - "friends": [ - 9, - 7, - 30 - ] - }, - { - "id": 49, - "name": "Herbert Douglas", - "address": "460 Boyd Viaduct, Florianburgh NM 04038-3499", - "email": "Douglas_Swift99@hotmail.com", - "strideLength": 3.8, - "dailyStepGoal": 4000, - "friends": [ - 29, - 15, - 32, - 37, - 31 - ] - }, - { - "id": 50, - "name": "Jordon Lind", - "address": "3866 Jay Loaf, New Felix OR 96784-0274", - "email": "Dane76@hotmail.com", - "strideLength": 4.4, - "dailyStepGoal": 2000, - "friends": [ - 9, - 27, - 21, - 13 - ] - } -]; -export default userData; \ No newline at end of file +// userData = [ +// {const +// "id": 1, +// "name": "Luisa Hane", +// "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", +// "email": "Diana.Hayes1@hotmail.com", +// "strideLength": 4.3, +// "dailyStepGoal": 10000, +// "friends": [ +// 16, +// 4, +// 8 +// ] +// }, +// { +// "id": 2, +// "name": "Jarvis Considine", +// "address": "30086 Kathryn Port, Ciceroland NE 07273", +// "email": "Dimitri.Bechtelar11@gmail.com", +// "strideLength": 4.5, +// "dailyStepGoal": 5000, +// "friends": [ +// 9, +// 18, +// 24, +// 19 +// ] +// }, +// { +// "id": 3, +// "name": "Herminia Witting", +// "address": "85823 Bosco Fork, East Oscarstad MI 85126-5660", +// "email": "Elwin.Tromp@yahoo.com", +// "strideLength": 4.4, +// "dailyStepGoal": 5000, +// "friends": [ +// 19, +// 11, +// 42, +// 33 +// ] +// }, +// { +// "id": 4, +// "name": "Mae Connelly", +// "address": "28926 Schinner Islands, Turnermouth NE 23720-3230", +// "email": "Marcos_Pollich@hotmail.com", +// "strideLength": 3.1, +// "dailyStepGoal": 4000, +// "friends": [ +// 48, +// 7, +// 44, +// 8 +// ] +// }, +// { +// "id": 5, +// "name": "Erick Schaden", +// "address": "514 Mayert Walk, Jordaneside SC 55023-6523", +// "email": "Vanessa_Gerhold@gmail.com", +// "strideLength": 3.1, +// "dailyStepGoal": 8000, +// "friends": [ +// 13, +// 44, +// 49, +// 33, +// 10 +// ] +// }, +// { +// "id": 6, +// "name": "Jerrold Bogisich", +// "address": "8283 Carroll Harbor, Borerfort CT 69020-3448", +// "email": "Mercedes_Zboncak53@yahoo.com", +// "strideLength": 3.7, +// "dailyStepGoal": 11000, +// "friends": [ +// 11, +// 48, +// 15 +// ] +// }, +// { +// "id": 7, +// "name": "Breanne Fay", +// "address": "834 Retta Knoll, Stantonland MA 71627-4121", +// "email": "Dashawn28@gmail.com", +// "strideLength": 2.9, +// "dailyStepGoal": 8000, +// "friends": [ +// 12, +// 27, +// 22, +// 30 +// ] +// }, +// { +// "id": 8, +// "name": "Laney Abshire", +// "address": "86416 Koch Inlet, North Kaciefurt MA 80635", +// "email": "Janice_Nitzsche2@yahoo.com", +// "strideLength": 2.8, +// "dailyStepGoal": 2000, +// "friends": [ +// 11, +// 41, +// 23, +// 49 +// ] +// }, +// { +// "id": 9, +// "name": "Myron Schmitt", +// "address": "85251 Martina Fields, West Aletha MD 00163-5315", +// "email": "Gerard_Langosh22@hotmail.com", +// "strideLength": 3.8, +// "dailyStepGoal": 6000, +// "friends": [ +// 16, +// 26, +// 17 +// ] +// }, +// { +// "id": 10, +// "name": "Roslyn Bernhard", +// "address": "22859 Sean Meadow, Lake Dorthyfort MA 89560", +// "email": "Hillary83@gmail.com", +// "strideLength": 4.1, +// "dailyStepGoal": 3000, +// "friends": [ +// 40, +// 33 +// ] +// }, +// { +// "id": 11, +// "name": "Dannie Berge", +// "address": "52042 Douglas Passage, Port Faye NC 82258", +// "email": "Fabian_Murray92@yahoo.com", +// "strideLength": 2.9, +// "dailyStepGoal": 9000, +// "friends": [ +// 15, +// 19 +// ] +// }, +// { +// "id": 12, +// "name": "Otis Kuhic", +// "address": "853 Kulas Highway, Port Estellbury WI 96713", +// "email": "Morton40@hotmail.com", +// "strideLength": 3.4, +// "dailyStepGoal": 11000, +// "friends": [ +// 28, +// 41, +// 24, +// 23 +// ] +// }, +// { +// "id": 13, +// "name": "Tom Schmeler", +// "address": "1524 Clemmie River, Newtonbury RI 02849-3159", +// "email": "Leopoldo.Sauer@gmail.com", +// "strideLength": 3.2, +// "dailyStepGoal": 4000, +// "friends": [ +// 33, +// 14, +// 3, +// 43, +// 35 +// ] +// }, +// { +// "id": 14, +// "name": "Gloria Frami", +// "address": "326 Littel Run, Tracemouth HI 02826-6898", +// "email": "Jadon.OConnell@hotmail.com", +// "strideLength": 3.5, +// "dailyStepGoal": 12000, +// "friends": [ +// 34, +// 22 +// ] +// }, +// { +// "id": 15, +// "name": "Ezequiel Feest", +// "address": "78801 Lauryn Plain, Lake Elinor MN 27856-9054", +// "email": "Anthony_Toy@hotmail.com", +// "strideLength": 4.4, +// "dailyStepGoal": 5000, +// "friends": [ +// 10, +// 23, +// 35, +// 20, +// 5 +// ] +// }, +// { +// "id": 16, +// "name": "Garnett Cruickshank", +// "address": "992 Zita Mall, North Tremainemouth MA 19312-3532", +// "email": "Laverna47@hotmail.com", +// "strideLength": 3.9, +// "dailyStepGoal": 10000, +// "friends": [ +// 25, +// 31, +// 3, +// 16 +// ] +// }, +// { +// "id": 17, +// "name": "Jade Walter", +// "address": "796 Rogahn Track, Lubowitzhaven NJ 62669-3244", +// "email": "Dylan_Langworth65@hotmail.com", +// "strideLength": 4.3, +// "dailyStepGoal": 5000, +// "friends": [ +// 8, +// 31, +// 40 +// ] +// }, +// { +// "id": 18, +// "name": "Dan Hodkiewicz", +// "address": "735 Johnnie Crest, New Madisyn IN 51116-6094", +// "email": "Gertrude12@gmail.com", +// "strideLength": 2.9, +// "dailyStepGoal": 2000, +// "friends": [ +// 33, +// 37 +// ] +// }, +// { +// "id": 19, +// "name": "Wilburn Collins", +// "address": "543 Keeling Road, Schummside ID 47123-6269", +// "email": "Blake27@gmail.com", +// "strideLength": 3.3, +// "dailyStepGoal": 8000, +// "friends": [ +// 30, +// 43, +// 22, +// 39 +// ] +// }, +// { +// "id": 20, +// "name": "Ora O'Connell", +// "address": "79585 Tania Ports, North Lillie MI 38947-4029", +// "email": "Audreanne.Gulgowski6@yahoo.com", +// "strideLength": 3.4, +// "dailyStepGoal": 8000, +// "friends": [ +// 2, +// 12, +// 11, +// 33 +// ] +// }, +// { +// "id": 21, +// "name": "Alexandrea Wehner", +// "address": "314 Richmond Islands, Brekkefort WI 71702-6994", +// "email": "Americo_Hammes31@gmail.com", +// "strideLength": 3, +// "dailyStepGoal": 9000, +// "friends": [ +// 29, +// 19 +// ] +// }, +// { +// "id": 22, +// "name": "Maria Kemmer", +// "address": "3416 Zoey Cliff, West Eda PA 17789-2282", +// "email": "Nya25@yahoo.com", +// "strideLength": 4.2, +// "dailyStepGoal": 2000, +// "friends": [ +// 40, +// 44, +// 14 +// ] +// }, +// { +// "id": 23, +// "name": "Karli Rodriguez", +// "address": "52618 Conroy Burgs, Wiegandhaven NC 32787", +// "email": "Marge.Farrell25@yahoo.com", +// "strideLength": 3.2, +// "dailyStepGoal": 7000, +// "friends": [ +// 28, +// 31, +// 14 +// ] +// }, +// { +// "id": 24, +// "name": "Kristin Cruickshank", +// "address": "806 Raynor Port, Kilbackbury OK 11077", +// "email": "Waylon_Zulauf@hotmail.com", +// "strideLength": 3.3, +// "dailyStepGoal": 4000, +// "friends": [ +// 17, +// 16, +// 45, +// 12 +// ] +// }, +// { +// "id": 25, +// "name": "Isobel Schmeler", +// "address": "5592 Donnelly Trail, Scottieport SC 35511", +// "email": "Name79@yahoo.com", +// "strideLength": 3.3, +// "dailyStepGoal": 4000, +// "friends": [ +// 37, +// 31, +// 43 +// ] +// }, +// { +// "id": 26, +// "name": "Greta Corkery", +// "address": "99020 Botsford Knoll, Lake Cecil ID 44141", +// "email": "Virgil28@hotmail.com", +// "strideLength": 3, +// "dailyStepGoal": 12000, +// "friends": [ +// 10, +// 34, +// 8, +// 43 +// ] +// }, +// { +// "id": 27, +// "name": "Johnathan Schulist", +// "address": "868 Kathryn Pike, Gibsonport ME 79500-6839", +// "email": "Mayra49@yahoo.com", +// "strideLength": 3, +// "dailyStepGoal": 10000, +// "friends": [ +// 17, +// 46, +// 40, +// 44 +// ] +// }, +// { +// "id": 28, +// "name": "Noemi Huels", +// "address": "5437 Barton Oval, Caesarview RI 88637", +// "email": "Geovany.Jaskolski@hotmail.com", +// "strideLength": 3.3, +// "dailyStepGoal": 2000, +// "friends": [ +// 18, +// 16, +// 47 +// ] +// }, +// { +// "id": 29, +// "name": "Colten Trantow", +// "address": "2625 Waino Skyway, Kaceybury ME 18723", +// "email": "Demetris67@hotmail.com", +// "strideLength": 4.2, +// "dailyStepGoal": 9000, +// "friends": [ +// 9, +// 5, +// 41 +// ] +// }, +// { +// "id": 30, +// "name": "Deborah Keebler", +// "address": "039 Jerde Brook, South Helen TN 08907-6883", +// "email": "Colt_Hermann59@gmail.com", +// "strideLength": 3.7, +// "dailyStepGoal": 9000, +// "friends": [ +// 13, +// 36, +// 2, +// 26, +// 28 +// ] +// }, +// { +// "id": 31, +// "name": "Bertrand Yundt", +// "address": "0032 Claudia Plain, Delfinaland RI 22298-3685", +// "email": "Sibyl.Schmidt39@yahoo.com", +// "strideLength": 3.4, +// "dailyStepGoal": 7000, +// "friends": [ +// 16, +// 41, +// 9 +// ] +// }, +// { +// "id": 32, +// "name": "Carrie Smith", +// "address": "408 Windler Camp, Eddietown MA 11960", +// "email": "Nikolas.Brakus31@yahoo.com", +// "strideLength": 4.3, +// "dailyStepGoal": 3000, +// "friends": [ +// 47, +// 33 +// ] +// }, +// { +// "id": 33, +// "name": "Leilani Quitzon", +// "address": "60013 Golden Overpass, Lake Dejon WI 77309-0820", +// "email": "Trinity_Rowe@hotmail.com", +// "strideLength": 3.5, +// "dailyStepGoal": 8000, +// "friends": [ +// 4, +// 18, +// 36, +// 30 +// ] +// }, +// { +// "id": 34, +// "name": "Lindsay Ruecker", +// "address": "026 Koelpin Fall, Port Demarcus HI 76813-9743", +// "email": "Art44@gmail.com", +// "strideLength": 2.5, +// "dailyStepGoal": 11000, +// "friends": [ +// 47, +// 19, +// 10 +// ] +// }, +// { +// "id": 35, +// "name": "Nico Bechtelar", +// "address": "83360 Christelle Ports, North Elliot IA 75496", +// "email": "Eric_Aufderhar@yahoo.com", +// "strideLength": 3.3, +// "dailyStepGoal": 8000, +// "friends": [ +// 39, +// 23, +// 36 +// ] +// }, +// { +// "id": 36, +// "name": "Clay Pfannerstill", +// "address": "40262 Hauck Creek, Halvorsonfurt AL 81358-9303", +// "email": "Zander21@gmail.com", +// "strideLength": 3.7, +// "dailyStepGoal": 8000, +// "friends": [ +// 40, +// 11, +// 14, +// 29 +// ] +// }, +// { +// "id": 37, +// "name": "Erling Anderson", +// "address": "772 Hamill Avenue, Mortonport ID 38546-4861", +// "email": "Aisha6@gmail.com", +// "strideLength": 3.4, +// "dailyStepGoal": 4000, +// "friends": [ +// 44, +// 19, +// 16 +// ] +// }, +// { +// "id": 38, +// "name": "Kaitlyn Weber", +// "address": "9440 Sincere Turnpike, New Shanon MN 11526-5774", +// "email": "Dustin48@yahoo.com", +// "strideLength": 3.6, +// "dailyStepGoal": 10000, +// "friends": [ +// 5, +// 21, +// 37 +// ] +// }, +// { +// "id": 39, +// "name": "Kenyatta Boyle", +// "address": "80711 Beer Lakes, Nicolatown WA 89298", +// "email": "Bailey_Abbott@yahoo.com", +// "strideLength": 3.7, +// "dailyStepGoal": 8000, +// "friends": [ +// 43, +// 10, +// 17 +// ] +// }, +// { +// "id": 40, +// "name": "Esperanza Schumm", +// "address": "5719 Hal Fork, Frederikstad SC 23125", +// "email": "Otis_Beahan@yahoo.com", +// "strideLength": 3.5, +// "dailyStepGoal": 6000, +// "friends": [ +// 29, +// 28, +// 3 +// ] +// }, +// { +// "id": 41, +// "name": "Meta Leffler", +// "address": "51598 Sauer Plaza, Port Vicente WY 87161-8441", +// "email": "Brice.Greenholt9@hotmail.com", +// "strideLength": 2.8, +// "dailyStepGoal": 2000, +// "friends": [ +// 6, +// 45, +// 31 +// ] +// }, +// { +// "id": 42, +// "name": "Ernestine Heathcote", +// "address": "9160 Blanche Ford, Dawnmouth OH 11816-1604", +// "email": "Brandyn_Quitzon@hotmail.com", +// "strideLength": 4.5, +// "dailyStepGoal": 9000, +// "friends": [ +// 20, +// 25, +// 22 +// ] +// }, +// { +// "id": 43, +// "name": "Alfonso Sporer", +// "address": "584 Mayert Greens, West Arden SC 97033", +// "email": "Jadon_Borer@gmail.com", +// "strideLength": 4, +// "dailyStepGoal": 5000, +// "friends": [ +// 2, +// 19, +// 43, +// 33 +// ] +// }, +// { +// "id": 44, +// "name": "Cora Rice", +// "address": "32723 Brekke Burg, West Randallburgh DE 20889", +// "email": "Coralie80@yahoo.com", +// "strideLength": 3.1, +// "dailyStepGoal": 8000, +// "friends": [ +// 25, +// 37, +// 42, +// 27 +// ] +// }, +// { +// "id": 45, +// "name": "Jennie O'Hara", +// "address": "492 Stracke Mews, East Jazlyn OH 58002-5475", +// "email": "Elenor.Block12@yahoo.com", +// "strideLength": 4.4, +// "dailyStepGoal": 7000, +// "friends": [ +// 35, +// 39, +// 31, +// 25, +// 33 +// ] +// }, +// { +// "id": 46, +// "name": "Vincenzo Hayes", +// "address": "03146 Bella Ferry, Port Royceberg NE 64057-4380", +// "email": "Carlo.Walker@hotmail.com", +// "strideLength": 3.6, +// "dailyStepGoal": 4000, +// "friends": [ +// 10, +// 29, +// 44 +// ] +// }, +// { +// "id": 47, +// "name": "Jevon Koss", +// "address": "983 Charlotte Island, Schroederchester ME 39894-0208", +// "email": "Kasandra_Bashirian@gmail.com", +// "strideLength": 4.3, +// "dailyStepGoal": 10000, +// "friends": [ +// 11, +// 48, +// 27, +// 4 +// ] +// }, +// { +// "id": 48, +// "name": "Jasper Stracke", +// "address": "9119 Ziemann Road, Coltberg IA 56671", +// "email": "Domenica.Kovacek17@yahoo.com", +// "strideLength": 3.6, +// "dailyStepGoal": 7000, +// "friends": [ +// 9, +// 7, +// 30 +// ] +// }, +// { +// "id": 49, +// "name": "Herbert Douglas", +// "address": "460 Boyd Viaduct, Florianburgh NM 04038-3499", +// "email": "Douglas_Swift99@hotmail.com", +// "strideLength": 3.8, +// "dailyStepGoal": 4000, +// "friends": [ +// 29, +// 15, +// 32, +// 37, +// 31 +// ] +// }, +// { +// "id": 50, +// "name": "Jordon Lind", +// "address": "3866 Jay Loaf, New Felix OR 96784-0274", +// "email": "Dane76@hotmail.com", +// "strideLength": 4.4, +// "dailyStepGoal": 2000, +// "friends": [ +// 9, +// 27, +// 21, +// 13 +// ] +// } +// ]; +// export default userData;np \ No newline at end of file From 2f6ab87aef646d3149afd1fc619fad3cd4f6984e Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Tue, 6 Dec 2022 17:41:15 -0700 Subject: [PATCH 072/188] Clean up formatting --- src/scripts.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/scripts.js b/src/scripts.js index b6cd19c7ba..5a1194d349 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -88,7 +88,4 @@ function getUserFriends() { return userRepository.getData(friend).name }) return friendsArray.join(', ') -} - - - +} \ No newline at end of file From 879cbc52a7778864653effa314a47c56021323e9 Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Tue, 6 Dec 2022 19:44:37 -0700 Subject: [PATCH 073/188] Add parameters in getUser function --- src/Sleep.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 src/Sleep.js diff --git a/src/Sleep.js b/src/Sleep.js new file mode 100644 index 0000000000..0b890f7c31 --- /dev/null +++ b/src/Sleep.js @@ -0,0 +1,7 @@ +class Sleep { + constructor() { + + } +} + +module.exports = Sleep; \ No newline at end of file From 39975682a8e4332eaaefa7379dac3e9d8286531a Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Tue, 6 Dec 2022 19:45:32 -0700 Subject: [PATCH 074/188] Add tests for Sleep class --- test/Sleep-test.js | 70 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 test/Sleep-test.js diff --git a/test/Sleep-test.js b/test/Sleep-test.js new file mode 100644 index 0000000000..82126d7dbe --- /dev/null +++ b/test/Sleep-test.js @@ -0,0 +1,70 @@ +import { expect } from 'chai'; +import userData from '../src/data/users' +import User from '../src/User' +import Sleep from '../src/Sleep' +import {getAPIData} from './apiCalls' + +describe('User', () => { + let user1, user2, user3 + beforeEach(() => { + user1 = new User({ + "id": 1, + "name": "Luisa Hane", + "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", + "email": "Diana.Hayes1@hotmail.com", + "strideLength": 4.3, + "dailyStepGoal": 10000, + "friends": [ + 16, + 4, + 8 + ] + }) + user2 = new User({ + "id": 2, + "name": "Jarvis Considine", + "address": "30086 Kathryn Port, Ciceroland NE 07273", + "email": "Dimitri.Bechtelar11@gmail.com", + "strideLength": 4.5, + "dailyStepGoal": 5000, + "friends": [ + 9, + 18, + 24, + 19 + ] + }) + user3 = new User({ + "id": 3, + "name": "Herminia Witting", + "address": "85823 Bosco Fork, East Oscarstad MI 85126-5660", + "email": "Elwin.Tromp@yahoo.com", + "strideLength": 4.4, + "dailyStepGoal": 5000, + "friends": [ + 19, + 11, + 42, + 33 + ] + }) + }) + + it('should be a function', function () { + + expect(Sleep).to.be.a('function'); + }); + + it('should instantiate a new User', function () { + + expect(Sleep).to.be.a('function'); + }) + + it('should find average hours slept per day', function() { + + getUser() + + + + }) + }) \ No newline at end of file From 0075aa66a2c762dcb7be5d3cc052d66ed1709b45 Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Wed, 7 Dec 2022 15:07:23 -0700 Subject: [PATCH 075/188] Fixed errors --- src/UserRepository.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/UserRepository.js b/src/UserRepository.js index f490103cd4..9dee84571c 100644 --- a/src/UserRepository.js +++ b/src/UserRepository.js @@ -8,16 +8,16 @@ class UserRepository { } getData(userID) { - return this.data.find((currentUser) => currentUser.id === userID) + return this.data.userData.find((currentUser) => currentUser.id === userID) } stepGoalAverage() { - let sum = this.data.reduce((acc, user) => { + let sum = this.data.userData.reduce((acc, user) => { acc += user.dailyStepGoal return acc }, 0) - let totalUsers = this.data.length + let totalUsers = this.data.userData.length return parseInt(sum / totalUsers) } } From 11ff59a2d7de24c4c32288d782d9ba71a570e862 Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Wed, 7 Dec 2022 15:07:50 -0700 Subject: [PATCH 076/188] Fixed errors and refactored code --- src/scripts.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/scripts.js b/src/scripts.js index 5a1194d349..84768fdd1e 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -46,9 +46,6 @@ function getAllData() { users = new UserRepository(data[0]) sleep = data[1] hydration = data[2] - console.log('data', data) - console.log('users', users) - console.log('sleep', sleep) console.log('hydration', hydration) }) .then(() => getUser()) @@ -73,7 +70,7 @@ function displayWelcomeName() { } function stepGoalDisplay() { - stepGoalBox.innerText = `Your step goal is ${currentUser.userData.dailyStepGoal} steps. The average step goal is ${userRepository.stepGoalAverage()}.` + stepGoalBox.innerText = `Your step goal is ${currentUser.userData.dailyStepGoal} steps. The average step goal is ${users.stepGoalAverage()}.` } // Functions @@ -85,7 +82,7 @@ function getUser() { function getUserFriends() { let friendsArray = currentUser.userData.friends.map(friend => { - return userRepository.getData(friend).name + return users.getData(friend).name }) return friendsArray.join(', ') } \ No newline at end of file From 4fb0dce867a5714dbb1bf94e67918f5dd506ecdc Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Wed, 7 Dec 2022 15:08:46 -0700 Subject: [PATCH 077/188] Begin writing code for avg daily water --- src/User.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/User.js b/src/User.js index ed0d3c7304..7cd2f377c2 100644 --- a/src/User.js +++ b/src/User.js @@ -1,11 +1,18 @@ class User { - constructor(userData) { + constructor(userData, sleepData, hydrationData) { this.userData = userData; + this.sleepData = sleepData; + this.hydrationData = hydrationData; } getFirstName() { return this.userData.name.split(' ')[0]; } + +// Hydration + getAvgDailyWater(userID) { + console.log(this.hydrationData.hydrationData) + } } export default User; \ No newline at end of file From 1bfe06dbf1454397726d80c7f10fdd830fe64f80 Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Wed, 7 Dec 2022 15:09:11 -0700 Subject: [PATCH 078/188] Refactored hydration sample data --- test/User-test.js | 126 ++++++++++++++++++++++++++++++---------------- 1 file changed, 83 insertions(+), 43 deletions(-) diff --git a/test/User-test.js b/test/User-test.js index 9fbb81d842..1e0b517182 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -4,49 +4,76 @@ import User from '../src/User' describe('User', () => { - let user1, user2, user3 + let user1, user2, user3, hydrationData beforeEach(() => { - user1 = new User({ - "id": 1, - "name": "Luisa Hane", - "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", - "email": "Diana.Hayes1@hotmail.com", - "strideLength": 4.3, - "dailyStepGoal": 10000, - "friends": [ - 16, - 4, - 8 - ] - }) - user2 = new User({ - "id": 2, - "name": "Jarvis Considine", - "address": "30086 Kathryn Port, Ciceroland NE 07273", - "email": "Dimitri.Bechtelar11@gmail.com", - "strideLength": 4.5, - "dailyStepGoal": 5000, - "friends": [ - 9, - 18, - 24, - 19 - ] - }) - user3 = new User({ - "id": 3, - "name": "Herminia Witting", - "address": "85823 Bosco Fork, East Oscarstad MI 85126-5660", - "email": "Elwin.Tromp@yahoo.com", - "strideLength": 4.4, - "dailyStepGoal": 5000, - "friends": [ - 19, - 11, - 42, - 33 - ] - }) + user1 = new User({ + "id": 1, + "name": "Luisa Hane", + "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", + "email": "Diana.Hayes1@hotmail.com", + "strideLength": 4.3, + "dailyStepGoal": 10000, + "friends": [ + 16, + 4, + 8 + ] + }) + user2 = new User({ + "id": 2, + "name": "Jarvis Considine", + "address": "30086 Kathryn Port, Ciceroland NE 07273", + "email": "Dimitri.Bechtelar11@gmail.com", + "strideLength": 4.5, + "dailyStepGoal": 5000, + "friends": [ + 9, + 18, + 24, + 19 + ] + }) + user3 = new User({ + "id": 3, + "name": "Herminia Witting", + "address": "85823 Bosco Fork, East Oscarstad MI 85126-5660", + "email": "Elwin.Tromp@yahoo.com", + "strideLength": 4.4, + "dailyStepGoal": 5000, + "friends": [ + 19, + 11, + 42, + 33 + ] + }) + hydrationData = {hydrationData: [ + { + userID: 1, + date: "2019/06/15", + numOunces: 37 + }, + { + userID: 2, + date: "2019/06/15", + numOunces: 75 + }, + { + userID: 3, + date: "2019/06/15", + numOunces: 47 + }, + { + userID: 1, + date: "2019/06/16", + numOunces: 85 + }, + { + userID: 2, + date: "2019/06/16", + numOunces: 42 + } + ]} }) it('should be a function', function () { @@ -111,11 +138,24 @@ describe('User', () => { expect(user1.userData.friends).to.deep.equal([16, 4, 8]); }) - it('should return users first name', function() { expect(user1.getFirstName()).to.equal("Luisa Hane"); }) + it('should output the average fluid ounces of water consumed daily', function() { + + expect(user1.getAvgDailyWater()).to.equal(61); + }) + + it.skip('should identify how many ounces of water a user consumed on a specific day', function() { + + expect(user2.getWaterPerDay("2019/06/15")).to.equal(75); + }) + + it.skip('should calculate average ounces consumed daily over the course of one week', function() { + + expect().to.equal() + }) }); \ No newline at end of file From e6bfbd4aca7b595869b1a41a404e06ac967ce352 Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Wed, 7 Dec 2022 15:52:11 -0700 Subject: [PATCH 079/188] Fix semicolons --- src/User.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/User.js b/src/User.js index ed0d3c7304..87387e5cc7 100644 --- a/src/User.js +++ b/src/User.js @@ -1,11 +1,28 @@ class User { - constructor(userData) { + constructor(userData, sleepData, hydrationData) { this.userData = userData; + this.sleepData = sleepData + this.hydrationData = hydrationData } getFirstName() { return this.userData.name.split(' ')[0]; } + + getAverage() { + let totalHours = this.sleepData.hoursSlept.reduce((acc, user) => { + acc += user.hoursSlept + return acc + }, 0) + let averageHours = totalHours/this.sleepData.hoursSlept.length + console.log("average hours", averageHours) + return parseInt(averageHours) + } + } + + + +//For a user (identified by their userID), the average number of hours slept per day export default User; \ No newline at end of file From 9a2dff56a9d5d67b9782fc0dc4ba904eb8b6c2af Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Wed, 7 Dec 2022 15:52:47 -0700 Subject: [PATCH 080/188] Refactor getData method --- src/UserRepository.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/UserRepository.js b/src/UserRepository.js index f490103cd4..5591353310 100644 --- a/src/UserRepository.js +++ b/src/UserRepository.js @@ -8,12 +8,14 @@ class UserRepository { } getData(userID) { - return this.data.find((currentUser) => currentUser.id === userID) + let userDataArr = Object.entries(this.data) + console.log(userDataArr) + return userDataArr.find((currentUser) => currentUser.userData.id === userID) } stepGoalAverage() { - let sum = this.data.reduce((acc, user) => { + let sum = this.data.userData.reduce((acc, user) => { acc += user.dailyStepGoal return acc }, 0) From f7bb23cfa7df0dee6c3c8d6cb54afa269b89b4fd Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Wed, 7 Dec 2022 15:53:12 -0700 Subject: [PATCH 081/188] Refactor failing methods --- src/scripts.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/scripts.js b/src/scripts.js index 5a1194d349..128176c0fe 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -51,7 +51,7 @@ function getAllData() { console.log('sleep', sleep) console.log('hydration', hydration) }) - .then(() => getUser()) + .then(() => getUser(sleep, hydration)) .then(() => displayUserInfo()) .then(() => stepGoalDisplay()) .then(() => displayWelcomeName()) @@ -73,19 +73,20 @@ function displayWelcomeName() { } function stepGoalDisplay() { - stepGoalBox.innerText = `Your step goal is ${currentUser.userData.dailyStepGoal} steps. The average step goal is ${userRepository.stepGoalAverage()}.` + stepGoalBox.innerText = `Your step goal is ${currentUser.userData.dailyStepGoal} steps. The average step goal is ${users.stepGoalAverage()}.` } // Functions -function getUser() { +function getUser(sleep, hydration) { let randomIndex = Math.floor(Math.random() * users.data.userData.length); let randomUser = users.data.userData[randomIndex]; - currentUser = new User(randomUser); + currentUser = new User(randomUser, sleep, hydration); + console.log('string', currentUser) } function getUserFriends() { let friendsArray = currentUser.userData.friends.map(friend => { - return userRepository.getData(friend).name + return users.getData(friend).name }) return friendsArray.join(', ') -} \ No newline at end of file +} From e1c4e6bba275bb9e26cdf47c8d0a9118aeed7365 Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Wed, 7 Dec 2022 15:53:42 -0700 Subject: [PATCH 082/188] update tests with API data --- test/Sleep-test.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/test/Sleep-test.js b/test/Sleep-test.js index 82126d7dbe..bdc906e936 100644 --- a/test/Sleep-test.js +++ b/test/Sleep-test.js @@ -2,7 +2,7 @@ import { expect } from 'chai'; import userData from '../src/data/users' import User from '../src/User' import Sleep from '../src/Sleep' -import {getAPIData} from './apiCalls' +// import {getAPIData} from './apiCalls' describe('User', () => { let user1, user2, user3 @@ -60,11 +60,4 @@ describe('User', () => { expect(Sleep).to.be.a('function'); }) - it('should find average hours slept per day', function() { - - getUser() - - - - }) }) \ No newline at end of file From 9f0a0d9ec7125a864a0b4e8788456f0facbe48f5 Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Wed, 7 Dec 2022 15:54:15 -0700 Subject: [PATCH 083/188] Update instances --- test/User-test.js | 45 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/test/User-test.js b/test/User-test.js index 9fbb81d842..e6e3055691 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -6,7 +6,8 @@ import User from '../src/User' describe('User', () => { let user1, user2, user3 beforeEach(() => { - user1 = new User({ + user1 = new User( + { "id": 1, "name": "Luisa Hane", "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", @@ -18,7 +19,15 @@ describe('User', () => { 4, 8 ] - }) + }, + [{userID: 1, date: '2019/06/15', hoursSlept: 6.1, sleepQuality: 2.2}, + {userID: 1, date: '2019/06/16', hoursSlept: 4.1, sleepQuality: 3.8}, + {userID: 1, date: '2019/06/17', hoursSlept: 5.4, sleepQuality: 3.6}], + + [{userID: 1, date: '2019/06/15', numOunces: 70}, + {userID: 1, date: '2019/06/16', numOunces: 65}, + {userID: 1, date: '2019/06/17', numOunces: 73}] + ) user2 = new User({ "id": 2, "name": "Jarvis Considine", @@ -32,7 +41,15 @@ describe('User', () => { 24, 19 ] - }) + }, + [{userID: 2, date: '2019/06/15', hoursSlept: 7, sleepQuality: 4.7}, + {userID: 2, date: '2019/06/16', hoursSlept: 3.1, sleepQuality: 3.1}, + {userID: 2, date: '2019/06/17', hoursSlept: 5.8, sleepQuality: 3.3}], + + [{userID: 2, date: '2019/06/15', numOunces: 65}, + {userID: 2, date: '2019/06/16', numOunces: 60}, + {userID: 2, date: '2019/06/17', numOunces: 71}] + ) user3 = new User({ "id": 3, "name": "Herminia Witting", @@ -46,7 +63,16 @@ describe('User', () => { 42, 33 ] - }) + }, + + [{userID: 3, date: '2019/06/15', hoursSlept: 6.3, sleepQuality: 3.7}, + {userID: 3, date: '2019/06/16', hoursSlept: 4.7, sleepQuality: 4.1}, + {userID: 3, date: '2019/06/17', hoursSlept: 5.8, sleepQuality: 3.9}], + + [{userID: 3, date: '2019/06/15', numOunces: 78}, + {userID: 3, date: '2019/06/16', numOunces: 40}, + {userID: 3, date: '2019/06/17', numOunces: 60}] + ) }) it('should be a function', function () { @@ -115,7 +141,16 @@ describe('User', () => { it('should return users first name', function() { - expect(user1.getFirstName()).to.equal("Luisa Hane"); + expect(user1.getFirstName()).to.equal("Luisa"); + }) + + it('should find average hours slept per day', function() { + + user1.getAverage() + console.log(user1) + + expect(user1.getAverage()).to.equal(5.2) + }) }); \ No newline at end of file From 2771cf2019e6295e1c50dcd083b1c42cb34a98f4 Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Wed, 7 Dec 2022 15:54:34 -0700 Subject: [PATCH 084/188] refactor tests with API data --- test/UserRepository-test.js | 93 +++++++++++++++++++++++++++++++++---- 1 file changed, 84 insertions(+), 9 deletions(-) diff --git a/test/UserRepository-test.js b/test/UserRepository-test.js index 502b2c0551..bc93c34721 100644 --- a/test/UserRepository-test.js +++ b/test/UserRepository-test.js @@ -7,11 +7,85 @@ describe('UserRepository', () => { let user1, user2, user3, userRepository; beforeEach(() => { - user1 = new User(userData[0]) - user2 = new User(userData[1]) - user3 = new User(userData[2]) + user1 = new User({ + "id": 1, + "name": "Luisa Hane", + "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", + "email": "Diana.Hayes1@hotmail.com", + "strideLength": 4.3, + "dailyStepGoal": 10000, + "friends": [ + 16, + 4, + 8 + ], + }, + {sleepData: [ + {userID: 1, date: '2019/06/15', hoursSlept: 6.1, sleepQuality: 2.2}, + {userID: 1, date: '2019/06/16', hoursSlept: 4.1, sleepQuality: 3.8}, + {userID: 1, date: '2019/06/17', hoursSlept: 5.4, sleepQuality: 3.6} + ]}, + + {hydrationData: [ + {userID: 1, date: '2019/06/15', numOunces: 70}, + {userID: 1, date: '2019/06/16', numOunces: 65}, + {userID: 1, date: '2019/06/17', numOunces: 73} + ]}) + user2 = new User({ + "id": 2, + "name": "Jarvis Considine", + "address": "30086 Kathryn Port, Ciceroland NE 07273", + "email": "Dimitri.Bechtelar11@gmail.com", + "strideLength": 4.5, + "dailyStepGoal": 5000, + "friends": [ + 9, + 18, + 24, + 19 + ], +}, + {sleepData: [ + {userID: 2, date: '2019/06/15', hoursSlept: 7, sleepQuality: 4.7}, + {userID: 2, date: '2019/06/16', hoursSlept: 3.1, sleepQuality: 3.1}, + {userID: 2, date: '2019/06/17', hoursSlept: 5.8, sleepQuality: 3.3} + ]}, + + {hydrationData: [ + {userID: 2, date: '2019/06/15', numOunces: 65}, + {userID: 2, date: '2019/06/16', numOunces: 60}, + {userID: 2, date: '2019/06/17', numOunces: 71} + ]} +) + user3 = new User({ + "id": 3, + "name": "Herminia Witting", + "address": "85823 Bosco Fork, East Oscarstad MI 85126-5660", + "email": "Elwin.Tromp@yahoo.com", + "strideLength": 4.4, + "dailyStepGoal": 5000, + "friends": [ + 19, + 11, + 42, + 33 + ], +}, + + {sleepData: [ + {userID: 3, date: '2019/06/15', hoursSlept: 6.3, sleepQuality: 3.7}, + {userID: 3, date: '2019/06/16', hoursSlept: 4.7, sleepQuality: 4.1}, + {userID: 3, date: '2019/06/17', hoursSlept: 5.8, sleepQuality: 3.9} + ]}, + + {hydrationData: [ + {userID: 3, date: '2019/06/15', numOunces: 78}, + {userID: 3, date: '2019/06/16', numOunces: 40}, + {userID: 3, date: '2019/06/17', numOunces: 60} + ]} + ) userRepository = new UserRepository([user1, user2, user3]) -}) + }) it('should be a function', function () { @@ -41,16 +115,17 @@ beforeEach(() => { }) it('should supply user data when given id', function() { - - expect(userRepository.getData(user2.userData.id)).to.deep.equal(user2) + + console.log(userRepository.data[1].userData.id) + expect(userRepository.getData(userRepository.data[1].userData.id)).to.deep.equal(user2) + }) it('should give the average step goal of all users', function () { - expect(userRepository.stepGoalAverage()).to.equal(6666) + expect(userRepository.data.stepGoalAverage()).to.equal(6666) }) -}); - +}) //test the data being passed in -> test this.data From 08fa171d5cee0f3697a6a2400de82e1a5afcfb81 Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Wed, 7 Dec 2022 16:00:00 -0700 Subject: [PATCH 085/188] Add changes to methods --- src/User.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/User.js b/src/User.js index 7cd2f377c2..3cead4c700 100644 --- a/src/User.js +++ b/src/User.js @@ -11,7 +11,7 @@ class User { // Hydration getAvgDailyWater(userID) { - console.log(this.hydrationData.hydrationData) + console.log('where are you', this.hydrationData) } } From 3a5f43ae8e2c71523d78d072e45fa4b6ad36542b Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Wed, 7 Dec 2022 16:00:19 -0700 Subject: [PATCH 086/188] Add changes to method test --- test/User-test.js | 240 +++++++++++++++++++++++----------------------- 1 file changed, 120 insertions(+), 120 deletions(-) diff --git a/test/User-test.js b/test/User-test.js index 1e0b517182..34a4e1168e 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -4,9 +4,91 @@ import User from '../src/User' describe('User', () => { - let user1, user2, user3, hydrationData - beforeEach(() => { - user1 = new User({ + let user1, user2, user3, hydrationData + beforeEach(() => { + hydrationData = {hydrationData: [ + { + userID: 1, + date: "2019/06/15", + numOunces: 37 + }, + { + userID: 2, + date: "2019/06/15", + numOunces: 75 + }, + { + userID: 3, + date: "2019/06/15", + numOunces: 47 + }, + { + userID: 1, + date: "2019/06/16", + numOunces: 85 + }, + { + userID: 2, + date: "2019/06/16", + numOunces: 42 + } + ]} + user1 = new User({ + "id": 1, + "name": "Luisa Hane", + "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", + "email": "Diana.Hayes1@hotmail.com", + "strideLength": 4.3, + "dailyStepGoal": 10000, + "friends": [ + 16, + 4, + 8 + ] + }, {}, hydrationData) + user2 = new User({ + "id": 2, + "name": "Jarvis Considine", + "address": "30086 Kathryn Port, Ciceroland NE 07273", + "email": "Dimitri.Bechtelar11@gmail.com", + "strideLength": 4.5, + "dailyStepGoal": 5000, + "friends": [ + 9, + 18, + 24, + 19 + ] + }, {}, hydrationData) + user3 = new User({ + "id": 3, + "name": "Herminia Witting", + "address": "85823 Bosco Fork, East Oscarstad MI 85126-5660", + "email": "Elwin.Tromp@yahoo.com", + "strideLength": 4.4, + "dailyStepGoal": 5000, + "friends": [ + 19, + 11, + 42, + 33 + ] + }, {}, hydrationData) + }) + + it('should be a function', function () { + + expect(User).to.be.a('function'); + }); + + it('should instantiate a new User', function () { + + expect(User).to.be.a('function'); + }) + + it('should have a Userdata parameter', function () { + + expect(user1.userData).to.deep.equal({ "id": 1, "name": "Luisa Hane", "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", @@ -18,144 +100,62 @@ describe('User', () => { 4, 8 ] - }) - user2 = new User({ - "id": 2, - "name": "Jarvis Considine", - "address": "30086 Kathryn Port, Ciceroland NE 07273", - "email": "Dimitri.Bechtelar11@gmail.com", - "strideLength": 4.5, - "dailyStepGoal": 5000, - "friends": [ - 9, - 18, - 24, - 19 - ] - }) - user3 = new User({ - "id": 3, - "name": "Herminia Witting", - "address": "85823 Bosco Fork, East Oscarstad MI 85126-5660", - "email": "Elwin.Tromp@yahoo.com", - "strideLength": 4.4, - "dailyStepGoal": 5000, - "friends": [ - 19, - 11, - 42, - 33 - ] - }) - hydrationData = {hydrationData: [ - { - userID: 1, - date: "2019/06/15", - numOunces: 37 - }, - { - userID: 2, - date: "2019/06/15", - numOunces: 75 - }, - { - userID: 3, - date: "2019/06/15", - numOunces: 47 - }, - { - userID: 1, - date: "2019/06/16", - numOunces: 85 - }, - { - userID: 2, - date: "2019/06/16", - numOunces: 42 - } - ]} - }) - - it('should be a function', function () { - - expect(User).to.be.a('function'); - }); - - it('should instantiate a new User', function () { - - expect(User).to.be.a('function'); - }) - - it('should have a Userdata parameter', function () { - - expect(user1.userData).to.deep.equal({ - "id": 1, - "name": "Luisa Hane", - "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", - "email": "Diana.Hayes1@hotmail.com", - "strideLength": 4.3, - "dailyStepGoal": 10000, - "friends": [ - 16, - 4, - 8 - ] - }); - }) + }); + }) - it('should have an id', function () { + it('should have an id', function () { - expect(user1.userData.id).to.equal(1); - }) + expect(user1.userData.id).to.equal(1); + }) - it('should have an name', function () { + it('should have an name', function () { - expect(user1.userData.name).to.equal("Luisa Hane"); - }) + expect(user1.userData.name).to.equal("Luisa Hane"); + }) - it('should have an address', function () { + it('should have an address', function () { - expect(user1.userData.address).to.equal("15195 Nakia Tunnel, Erdmanport VA 19901-1697"); - }) + expect(user1.userData.address).to.equal("15195 Nakia Tunnel, Erdmanport VA 19901-1697"); + }) - it('should have an email', function () { + it('should have an email', function () { - expect(user1.userData.email).to.equal("Diana.Hayes1@hotmail.com"); - }) + expect(user1.userData.email).to.equal("Diana.Hayes1@hotmail.com"); + }) - it('should have a strideLength', function () { + it('should have a strideLength', function () { - expect(user1.userData.strideLength).to.equal(4.3); - }) + expect(user1.userData.strideLength).to.equal(4.3); + }) - it('should have a step goal', function () { + it('should have a step goal', function () { - expect(user1.userData.dailyStepGoal).to.equal(10000); - }) + expect(user1.userData.dailyStepGoal).to.equal(10000); + }) - it('should have friends', function () { + it('should have friends', function () { - expect(user1.userData.friends).to.deep.equal([16, 4, 8]); - }) + expect(user1.userData.friends).to.deep.equal([16, 4, 8]); + }) - it('should return users first name', function() { + it('should return users first name', function() { - expect(user1.getFirstName()).to.equal("Luisa Hane"); - }) + expect(user1.getFirstName()).to.equal("Luisa Hane"); + }) - it('should output the average fluid ounces of water consumed daily', function() { + it.only('should output the average fluid ounces of water consumed daily', function() { - expect(user1.getAvgDailyWater()).to.equal(61); - }) + expect(user1.getAvgDailyWater(1)).to.equal(61); + }) - it.skip('should identify how many ounces of water a user consumed on a specific day', function() { + it.skip('should identify how many ounces of water a user consumed on a specific day', function() { - expect(user2.getWaterPerDay("2019/06/15")).to.equal(75); - }) + expect(user2.getWaterPerDay("2019/06/15")).to.equal(75); + }) - it.skip('should calculate average ounces consumed daily over the course of one week', function() { + it.skip('should calculate average ounces consumed daily over the course of one week', function() { - expect().to.equal() - }) + expect().to.equal() + }) }); \ No newline at end of file From 8c310dcd785c15ae05187e0f1d59bce38abfc9bd Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Wed, 7 Dec 2022 16:01:18 -0700 Subject: [PATCH 087/188] Add minor changes --- test/Sleep-test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Sleep-test.js b/test/Sleep-test.js index 82126d7dbe..87a9bf8387 100644 --- a/test/Sleep-test.js +++ b/test/Sleep-test.js @@ -2,7 +2,7 @@ import { expect } from 'chai'; import userData from '../src/data/users' import User from '../src/User' import Sleep from '../src/Sleep' -import {getAPIData} from './apiCalls' +// import {getAPIData} from './apiCalls' describe('User', () => { let user1, user2, user3 From a065aad077c71d5dfa83878e33fd1a9b0d315b20 Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Wed, 7 Dec 2022 18:27:24 -0700 Subject: [PATCH 088/188] Refactor user test structure --- test/User-test.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/test/User-test.js b/test/User-test.js index f66ceaeec2..134cbe20f8 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -2,9 +2,7 @@ import { expect } from 'chai'; import userData from '../src/data/users' import User from '../src/User' - describe('User', () => { - let user1, user2, user3, hydrationData beforeEach(() => { hydrationData = {hydrationData: [ @@ -274,10 +272,8 @@ describe('User', () => { expect(user1.userData.friends).to.deep.equal([16, 4, 8]); }) - it('should return users first name', function() { - expect(user1.getFirstName()).to.equal("Luisa"); }) @@ -289,10 +285,8 @@ describe('User', () => { expect(user1.getAverage()).to.equal(5.2) }) - - - - expect(user1.getFirstName()).to.equal("Luisa Hane"); +// was this supposed to be outside of the it block? + expect(user1.getFirstName()).to.equal("Luisa Hane"); }) it.only('should output the average fluid ounces of water consumed daily', function() { From adb289517b536b1c843d76d35ddf5774bc5c50a5 Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Wed, 7 Dec 2022 18:35:39 -0700 Subject: [PATCH 089/188] Fix fetch call - promise --- src/scripts.js | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/scripts.js b/src/scripts.js index 448bc87680..1e12ec689c 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -3,19 +3,19 @@ import './css/styles.css'; import {getAPIData} from './apiCalls' import User from '../src/User'; -import userData from '../src/data/users' +// import userData from '../src/data/users' import UserRepository from './UserRepository'; // Global Variables -let one = 1 +// let one = 1 let users let sleep let hydration let currentUser -const userRepository = new UserRepository(userData) - -console.log(userRepository) +// const userRepository = new UserRepository(userData) +// +// console.log(userRepository) //Query Selectors let infoBox = document.querySelector('.zero') @@ -46,12 +46,11 @@ function getAllData() { users = new UserRepository(data[0]) sleep = data[1] hydration = data[2] + loadPage() console.log('hydration', hydration) + console.log('users', users) + console.log('currentUser', currentUser) }) - .then(() => getUser(sleep, hydration)) - .then(() => displayUserInfo()) - .then(() => stepGoalDisplay()) - .then(() => displayWelcomeName()) .catch(err => console.log('To err is human', err)) } @@ -87,3 +86,10 @@ function getUserFriends() { }) return friendsArray.join(', ') } + +function loadPage() { + getUser(sleep, hydration) + displayUserInfo() + stepGoalDisplay() + displayWelcomeName() +} From 7b7271cfbdc23d96a6dfcf146ec4b32736f5eb28 Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Wed, 7 Dec 2022 19:30:39 -0700 Subject: [PATCH 090/188] Add functionality to avg daily water method --- src/User.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/User.js b/src/User.js index 4a0313b897..88bb779621 100644 --- a/src/User.js +++ b/src/User.js @@ -12,7 +12,14 @@ class User { // Hydration getAvgDailyWater(userID) { - console.log('where are you', this.hydrationData) + let matchedIDS = this.hydrationData.hydrationData.filter((user) => { + return user.userID === userID + }) + let avg = matchedIDS.reduce((acc, curr) => { + acc += curr.numOunces + return acc + }, 0) + return avg / matchedIDS.length } getAverage() { From a646f3f9e9f4ab23b963f02f5185bbf786c3a005 Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Wed, 7 Dec 2022 20:21:31 -0700 Subject: [PATCH 091/188] Add functionality to getWaterPerDay method --- src/User.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/User.js b/src/User.js index 88bb779621..22b4c2766c 100644 --- a/src/User.js +++ b/src/User.js @@ -9,8 +9,7 @@ class User { return this.userData.name.split(' ')[0]; } - -// Hydration + // Hydration getAvgDailyWater(userID) { let matchedIDS = this.hydrationData.hydrationData.filter((user) => { return user.userID === userID @@ -22,6 +21,19 @@ class User { return avg / matchedIDS.length } + getWaterPerDay(date) { + let dates = this.hydrationData.hydrationData.filter((user) => { + return user.date === date + }) + return dates.reduce((acc, curr) => { + if (curr.userID === this.userData.id) { + acc = curr.numOunces + } + return acc + }, 0) + } + + // Sleep getAverage() { let totalHours = this.sleepData.hoursSlept.reduce((acc, user) => { acc += user.hoursSlept From 77e89b0d87240afca75da6022b4bb076706dd5eb Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Wed, 7 Dec 2022 20:22:27 -0700 Subject: [PATCH 092/188] Modify tests and add expect --- test/User-test.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/User-test.js b/test/User-test.js index 134cbe20f8..c5a82a0fc6 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -289,14 +289,15 @@ describe('User', () => { expect(user1.getFirstName()).to.equal("Luisa Hane"); }) - it.only('should output the average fluid ounces of water consumed daily', function() { + it('should output the average fluid ounces of water consumed daily', function() { expect(user1.getAvgDailyWater(1)).to.equal(61); }) - it.skip('should identify how many ounces of water a user consumed on a specific day', function() { + it('should identify how many ounces of water a user consumed on a specific day', function() { expect(user2.getWaterPerDay("2019/06/15")).to.equal(75); + expect(user3.getWaterPerDay("2019/06/15")).to.equal(47); }) it.skip('should calculate average ounces consumed daily over the course of one week', function() { From 0d4eaea60eb24e173d22794f1c768ee8da007d35 Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Wed, 7 Dec 2022 20:34:05 -0700 Subject: [PATCH 093/188] Add sleep test for avg hours --- test/User-test.js | 49 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/test/User-test.js b/test/User-test.js index c5a82a0fc6..8291c0768d 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -3,7 +3,7 @@ import userData from '../src/data/users' import User from '../src/User' describe('User', () => { - let user1, user2, user3, hydrationData + let user1, user2, user3, hydrationData, sleepData beforeEach(() => { hydrationData = {hydrationData: [ { @@ -32,6 +32,37 @@ describe('User', () => { numOunces: 42 } ]} + sleepData = {sleepData: [{ + userID: 1, + date: "2019/06/15", + hoursSlept: 6.1, + sleepQuality: 2.2 + }, + { + userID: 2, + date: "2019/06/15", + hoursSlept: 7, + sleepQuality: 4.7 + }, + { + userID: 3, + date: "2019/06/15", + hoursSlept: 10.8, + sleepQuality: 4.7 + }, + { + userID: 1, + date: "2019/06/16", + hoursSlept: 5.4, + sleepQuality: 3 + }, + { + userID: 2, + date: "2019/06/16", + hoursSlept: 4.1, + sleepQuality: 3.6 + }] +} user1 = new User({ "id": 1, "name": "Luisa Hane", @@ -44,7 +75,7 @@ describe('User', () => { 4, 8 ] - }, {}, hydrationData) + }, sleepData, hydrationData) user2 = new User({ "id": 2, "name": "Jarvis Considine", @@ -58,7 +89,7 @@ describe('User', () => { 24, 19 ] - }, {}, hydrationData) + }, sleepData, hydrationData) user3 = new User({ "id": 3, "name": "Herminia Witting", @@ -72,7 +103,7 @@ describe('User', () => { 42, 33 ] - }, {}, hydrationData) + }, sleepData, hydrationData) }) it('should be a function', function () { @@ -288,7 +319,7 @@ describe('User', () => { // was this supposed to be outside of the it block? expect(user1.getFirstName()).to.equal("Luisa Hane"); }) - +//Hydration it('should output the average fluid ounces of water consumed daily', function() { expect(user1.getAvgDailyWater(1)).to.equal(61); @@ -304,4 +335,12 @@ describe('User', () => { expect().to.equal() }) + +//Sleep + it.skip('should output the average number of hours per day for a user', function() { + + expect().to.equal() + }) + + }); \ No newline at end of file From 21818e511fb730b9ed7ca312863dcc192e53d20b Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Thu, 8 Dec 2022 15:23:18 -0700 Subject: [PATCH 094/188] Restructure user-repo-test --- test/UserRepository-test.js | 185 +++++++++++++++--------------------- 1 file changed, 78 insertions(+), 107 deletions(-) diff --git a/test/UserRepository-test.js b/test/UserRepository-test.js index bc93c34721..71786c87f3 100644 --- a/test/UserRepository-test.js +++ b/test/UserRepository-test.js @@ -1,128 +1,99 @@ import { expect } from 'chai'; import User from '../src/User'; import UserRepository from '../src/UserRepository'; -import userData from '../src/data/users'; +//import userData from '../src/data/users'; describe('UserRepository', () => { - let user1, user2, user3, userRepository; - -beforeEach(() => { - user1 = new User({ - "id": 1, - "name": "Luisa Hane", - "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", - "email": "Diana.Hayes1@hotmail.com", - "strideLength": 4.3, - "dailyStepGoal": 10000, - "friends": [ - 16, - 4, - 8 - ], - }, - {sleepData: [ - {userID: 1, date: '2019/06/15', hoursSlept: 6.1, sleepQuality: 2.2}, - {userID: 1, date: '2019/06/16', hoursSlept: 4.1, sleepQuality: 3.8}, - {userID: 1, date: '2019/06/17', hoursSlept: 5.4, sleepQuality: 3.6} - ]}, - - {hydrationData: [ - {userID: 1, date: '2019/06/15', numOunces: 70}, - {userID: 1, date: '2019/06/16', numOunces: 65}, - {userID: 1, date: '2019/06/17', numOunces: 73} - ]}) - user2 = new User({ - "id": 2, - "name": "Jarvis Considine", - "address": "30086 Kathryn Port, Ciceroland NE 07273", - "email": "Dimitri.Bechtelar11@gmail.com", - "strideLength": 4.5, - "dailyStepGoal": 5000, - "friends": [ - 9, - 18, - 24, - 19 - ], -}, - {sleepData: [ - {userID: 2, date: '2019/06/15', hoursSlept: 7, sleepQuality: 4.7}, - {userID: 2, date: '2019/06/16', hoursSlept: 3.1, sleepQuality: 3.1}, - {userID: 2, date: '2019/06/17', hoursSlept: 5.8, sleepQuality: 3.3} - ]}, - - {hydrationData: [ - {userID: 2, date: '2019/06/15', numOunces: 65}, - {userID: 2, date: '2019/06/16', numOunces: 60}, - {userID: 2, date: '2019/06/17', numOunces: 71} - ]} -) - user3 = new User({ - "id": 3, - "name": "Herminia Witting", - "address": "85823 Bosco Fork, East Oscarstad MI 85126-5660", - "email": "Elwin.Tromp@yahoo.com", - "strideLength": 4.4, - "dailyStepGoal": 5000, - "friends": [ - 19, - 11, - 42, - 33 - ], -}, - - {sleepData: [ - {userID: 3, date: '2019/06/15', hoursSlept: 6.3, sleepQuality: 3.7}, - {userID: 3, date: '2019/06/16', hoursSlept: 4.7, sleepQuality: 4.1}, - {userID: 3, date: '2019/06/17', hoursSlept: 5.8, sleepQuality: 3.9} - ]}, - - {hydrationData: [ - {userID: 3, date: '2019/06/15', numOunces: 78}, - {userID: 3, date: '2019/06/16', numOunces: 40}, - {userID: 3, date: '2019/06/17', numOunces: 60} - ]} - ) - userRepository = new UserRepository([user1, user2, user3]) + let userRepository, users; + + beforeEach(() => { + + users = { + userData: [ + { + id: 1, + name: "Luisa Hane", + address: "15195 Nakia Tunnel, Erdmanport VA 19901-1697", + email: "Diana.Hayes1@hotmail.com", + strideLength: 4.3, + dailyStepGoal: 10000, + friends: [ + 16, + 4, + 8 + ] + }, + { + id: 2, + name: "Jarvis Considine", + address: "30086 Kathryn Port, Ciceroland NE 07273", + email: "Dimitri.Bechtelar11@gmail.com", + strideLength: 4.5, + dailyStepGoal: 5000, + friends: [ + 9, + 18, + 24, + 19 + ] + }, + { + id: 3, + name: "Herminia Witting", + address: "85823 Bosco Fork, East Oscarstad MI 85126-5660", + email: "Elwin.Tromp@yahoo.com", + strideLength: 4.4, + dailyStepGoal: 5000, + friends: [ + 19, + 11, + 42, + 33 + ] + }] + } + + userRepository = new UserRepository(users) }) - it('should be a function', function () { + it.skip('should be a function', function () { expect(UserRepository).to.be.a('function'); }); - it('should instantiate a new user repository', function () { - - expect(userRepository.data).to.deep.equal([user1, user2, user3]); - }) - - it('should take in user data', function() { + it.skip('should instantiate a new user repository', function () { + + expect(userRepository.data).to.deep.equal(users); + }) + + it('should take in user data', function () { expect(user1.userData).to.deep.equal( - {"id": 1, - "name": "Luisa Hane", - "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", - "email": "Diana.Hayes1@hotmail.com", - "strideLength": 4.3, - "dailyStepGoal": 10000, - "friends": [ - 16, - 4, - 8 - ] + { + "id": 1, + "name": "Luisa Hane", + "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", + "email": "Diana.Hayes1@hotmail.com", + "strideLength": 4.3, + "dailyStepGoal": 10000, + "friends": [ + 16, + 4, + 8 + ] }) - }) - - it('should supply user data when given id', function() { + + }) + + it('should supply user data when given id', function () { console.log(userRepository.data[1].userData.id) expect(userRepository.getData(userRepository.data[1].userData.id)).to.deep.equal(user2) - - }) - + + }) + it('should give the average step goal of all users', function () { - + expect(userRepository.data.stepGoalAverage()).to.equal(6666) }) }) From 568c31332f1fa69b0457f9eaa4d68afa98d707e7 Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Thu, 8 Dec 2022 15:37:42 -0700 Subject: [PATCH 095/188] fix return first name test --- test/User-test.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/test/User-test.js b/test/User-test.js index 8291c0768d..83e53efeef 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -316,9 +316,6 @@ describe('User', () => { expect(user1.getAverage()).to.equal(5.2) }) -// was this supposed to be outside of the it block? - expect(user1.getFirstName()).to.equal("Luisa Hane"); - }) //Hydration it('should output the average fluid ounces of water consumed daily', function() { @@ -342,5 +339,6 @@ describe('User', () => { expect().to.equal() }) - -}); \ No newline at end of file + + }) +}); \ No newline at end of file From 54eb6567eccf3e54fa64c2295a7dfdc8b6c80809 Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Thu, 8 Dec 2022 15:47:39 -0700 Subject: [PATCH 096/188] update user data test --- test/UserRepository-test.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/UserRepository-test.js b/test/UserRepository-test.js index 71786c87f3..d741ee5544 100644 --- a/test/UserRepository-test.js +++ b/test/UserRepository-test.js @@ -1,7 +1,6 @@ import { expect } from 'chai'; import User from '../src/User'; import UserRepository from '../src/UserRepository'; -//import userData from '../src/data/users'; describe('UserRepository', () => { let userRepository, users; @@ -56,19 +55,19 @@ describe('UserRepository', () => { userRepository = new UserRepository(users) }) - it.skip('should be a function', function () { + it('should be a function', function () { expect(UserRepository).to.be.a('function'); }); - it.skip('should instantiate a new user repository', function () { + it('should instantiate a new user repository', function () { expect(userRepository.data).to.deep.equal(users); }) it('should take in user data', function () { - expect(user1.userData).to.deep.equal( + expect(userRepository.data.userData[0]).to.deep.equal( { "id": 1, "name": "Luisa Hane", From f789fb025a0079aebaad08f443e35f4767ff9278 Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Thu, 8 Dec 2022 15:52:49 -0700 Subject: [PATCH 097/188] fix final user tests --- test/UserRepository-test.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/test/UserRepository-test.js b/test/UserRepository-test.js index d741ee5544..006244f7c9 100644 --- a/test/UserRepository-test.js +++ b/test/UserRepository-test.js @@ -86,14 +86,26 @@ describe('UserRepository', () => { it('should supply user data when given id', function () { - console.log(userRepository.data[1].userData.id) - expect(userRepository.getData(userRepository.data[1].userData.id)).to.deep.equal(user2) + expect(userRepository.getData(userRepository.data.userData[1].id)).to.deep.equal({ + id: 2, + name: "Jarvis Considine", + address: "30086 Kathryn Port, Ciceroland NE 07273", + email: "Dimitri.Bechtelar11@gmail.com", + strideLength: 4.5, + dailyStepGoal: 5000, + friends: [ + 9, + 18, + 24, + 19 + ] + }) }) it('should give the average step goal of all users', function () { - expect(userRepository.data.stepGoalAverage()).to.equal(6666) + expect(userRepository.stepGoalAverage()).to.equal(6666) }) }) From 5a79342468002381eb4334436779292278c80145 Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Thu, 8 Dec 2022 16:22:48 -0700 Subject: [PATCH 098/188] delete redundant code --- src/User.js | 3 +- test/User-test.js | 140 ++-------------------------------------------- 2 files changed, 7 insertions(+), 136 deletions(-) diff --git a/src/User.js b/src/User.js index 22b4c2766c..efdd667ca5 100644 --- a/src/User.js +++ b/src/User.js @@ -34,13 +34,12 @@ class User { } // Sleep - getAverage() { + getAverageDailySleep() { let totalHours = this.sleepData.hoursSlept.reduce((acc, user) => { acc += user.hoursSlept return acc }, 0) let averageHours = totalHours/this.sleepData.hoursSlept.length - console.log("average hours", averageHours) return parseInt(averageHours) } diff --git a/test/User-test.js b/test/User-test.js index 83e53efeef..411a3bad39 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -138,7 +138,7 @@ describe('User', () => { expect(user1.userData.id).to.equal(1); }) - it('should have an name', function () { + it('should have a name', function () { expect(user1.userData.name).to.equal("Luisa Hane"); }) @@ -168,89 +168,6 @@ describe('User', () => { expect(user1.userData.friends).to.deep.equal([16, 4, 8]); }) - it('should return users first name', function() { - - let user1, user2, user3 - beforeEach(() => { - user1 = new User( - { - "id": 1, - "name": "Luisa Hane", - "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", - "email": "Diana.Hayes1@hotmail.com", - "strideLength": 4.3, - "dailyStepGoal": 10000, - "friends": [ - 16, - 4, - 8 - ] - }, - [{userID: 1, date: '2019/06/15', hoursSlept: 6.1, sleepQuality: 2.2}, - {userID: 1, date: '2019/06/16', hoursSlept: 4.1, sleepQuality: 3.8}, - {userID: 1, date: '2019/06/17', hoursSlept: 5.4, sleepQuality: 3.6}], - - [{userID: 1, date: '2019/06/15', numOunces: 70}, - {userID: 1, date: '2019/06/16', numOunces: 65}, - {userID: 1, date: '2019/06/17', numOunces: 73}] - ) - user2 = new User({ - "id": 2, - "name": "Jarvis Considine", - "address": "30086 Kathryn Port, Ciceroland NE 07273", - "email": "Dimitri.Bechtelar11@gmail.com", - "strideLength": 4.5, - "dailyStepGoal": 5000, - "friends": [ - 9, - 18, - 24, - 19 - ] - }, - [{userID: 2, date: '2019/06/15', hoursSlept: 7, sleepQuality: 4.7}, - {userID: 2, date: '2019/06/16', hoursSlept: 3.1, sleepQuality: 3.1}, - {userID: 2, date: '2019/06/17', hoursSlept: 5.8, sleepQuality: 3.3}], - - [{userID: 2, date: '2019/06/15', numOunces: 65}, - {userID: 2, date: '2019/06/16', numOunces: 60}, - {userID: 2, date: '2019/06/17', numOunces: 71}] - ) - user3 = new User({ - "id": 3, - "name": "Herminia Witting", - "address": "85823 Bosco Fork, East Oscarstad MI 85126-5660", - "email": "Elwin.Tromp@yahoo.com", - "strideLength": 4.4, - "dailyStepGoal": 5000, - "friends": [ - 19, - 11, - 42, - 33 - ] - }, - - [{userID: 3, date: '2019/06/15', hoursSlept: 6.3, sleepQuality: 3.7}, - {userID: 3, date: '2019/06/16', hoursSlept: 4.7, sleepQuality: 4.1}, - {userID: 3, date: '2019/06/17', hoursSlept: 5.8, sleepQuality: 3.9}], - - [{userID: 3, date: '2019/06/15', numOunces: 78}, - {userID: 3, date: '2019/06/16', numOunces: 40}, - {userID: 3, date: '2019/06/17', numOunces: 60}] - ) - }) - - it('should be a function', function () { - - expect(User).to.be.a('function'); - }); - - it('should instantiate a new User', function () { - - expect(User).to.be.a('function'); - }) - it('should have a Userdata parameter', function () { expect(user1.userData).to.deep.equal({ @@ -265,57 +182,14 @@ describe('User', () => { 4, 8 ] - }); - }) - - it('should have an id', function () { - - expect(user1.userData.id).to.equal(1); - }) - - it('should have an name', function () { - - expect(user1.userData.name).to.equal("Luisa Hane"); - }) - - it('should have an address', function () { - - expect(user1.userData.address).to.equal("15195 Nakia Tunnel, Erdmanport VA 19901-1697"); - }) - - it('should have an email', function () { - - expect(user1.userData.email).to.equal("Diana.Hayes1@hotmail.com"); - }) - - it('should have a strideLength', function () { - - expect(user1.userData.strideLength).to.equal(4.3); - }) - - it('should have a step goal', function () { - - expect(user1.userData.dailyStepGoal).to.equal(10000); - }) - - it('should have friends', function () { - - expect(user1.userData.friends).to.deep.equal([16, 4, 8]); - }) + }) + }); it('should return users first name', function() { expect(user1.getFirstName()).to.equal("Luisa"); }) - it('should find average hours slept per day', function() { - - user1.getAverage() - console.log(user1) - - expect(user1.getAverage()).to.equal(5.2) - - }) //Hydration it('should output the average fluid ounces of water consumed daily', function() { @@ -334,11 +208,9 @@ describe('User', () => { }) //Sleep - it.skip('should output the average number of hours per day for a user', function() { + it('should output the average number of hours of sleep per day for a user', function() { - expect().to.equal() + expect(user2.getAverageDailySleep()).to.equal(5.3) }) - - }) -}); \ No newline at end of file +}) From 457c9997a6683a145fc172ce0570857a4097c4d2 Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Thu, 8 Dec 2022 16:50:35 -0700 Subject: [PATCH 099/188] Remove unnecessary import --- src/UserRepository.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/UserRepository.js b/src/UserRepository.js index 0a54ef71a8..f4e60535af 100644 --- a/src/UserRepository.js +++ b/src/UserRepository.js @@ -1,4 +1,3 @@ -import userData from './data/users'; import User from './User'; // const data = require('./data/users') From 5c5ff5c7a3f800c543d3650d1d77c70ce53c5a15 Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Thu, 8 Dec 2022 16:51:05 -0700 Subject: [PATCH 100/188] Remove unnecessary import --- src/scripts.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/scripts.js b/src/scripts.js index 1e12ec689c..7211db4d88 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -1,9 +1,7 @@ // import './images/turing-logo.png' -//console.log(userData,"<>>>>userData") import './css/styles.css'; import {getAPIData} from './apiCalls' import User from '../src/User'; -// import userData from '../src/data/users' import UserRepository from './UserRepository'; // Global Variables @@ -47,9 +45,9 @@ function getAllData() { sleep = data[1] hydration = data[2] loadPage() - console.log('hydration', hydration) - console.log('users', users) - console.log('currentUser', currentUser) + // console.log('hydration', hydration) + // console.log('users', users) + // console.log('currentUser', currentUser) }) .catch(err => console.log('To err is human', err)) } From dfb8562925ca9168cc0ae91822d9a9050f0f1db9 Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Thu, 8 Dec 2022 16:51:38 -0700 Subject: [PATCH 101/188] Add average overall sleep test frame --- test/User-test.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/User-test.js b/test/User-test.js index 411a3bad39..519e18431e 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -1,5 +1,4 @@ import { expect } from 'chai'; -import userData from '../src/data/users' import User from '../src/User' describe('User', () => { @@ -208,9 +207,15 @@ describe('User', () => { }) //Sleep - it('should output the average number of hours of sleep per day for a user', function() { + it.skip('should return a users average number of hours of sleep per day', function() { expect(user2.getAverageDailySleep()).to.equal(5.3) }) + it.skip('Should give user average sleep over all sleep data', function() { + + expect(user2.getOverallSleepAvg()).to.equal() + }) + + }) From 436ce098bbfb632e839a93fd8e19f1590992843b Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Thu, 8 Dec 2022 16:52:26 -0700 Subject: [PATCH 102/188] Add specig date hours slept test frame --- test/User-test.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/User-test.js b/test/User-test.js index 519e18431e..04ba8c4b82 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -217,5 +217,9 @@ describe('User', () => { expect(user2.getOverallSleepAvg()).to.equal() }) - + it.skip('Should give hours slept on a specific date' function() { + + expect(user2.sleepOnSpecificDate()).to.equal() + }) + }) From d7893131e25ef2014d86948d74be8a405a132d8f Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Thu, 8 Dec 2022 16:53:06 -0700 Subject: [PATCH 103/188] Add specific date sleep quality test frame --- test/User-test.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/User-test.js b/test/User-test.js index 04ba8c4b82..4f1d4bfdb5 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -222,4 +222,8 @@ describe('User', () => { expect(user2.sleepOnSpecificDate()).to.equal() }) + it.skip('Should provide users sleep quality on specific date', function() { + + expect(user.) + }) }) From 6746b3fa9900162ac50c99633cfee662f25efff8 Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Thu, 8 Dec 2022 16:55:47 -0700 Subject: [PATCH 104/188] Add given weekly sleep data test frame --- test/User-test.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/User-test.js b/test/User-test.js index 4f1d4bfdb5..d2318934d1 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -224,6 +224,11 @@ describe('User', () => { it.skip('Should provide users sleep quality on specific date', function() { - expect(user.) + expect(user2.sleepQualityOnSPecificDate()).to.equal() + }) + + it.skip('Should provide weekly sleep data for any given week', function() { + + expect(user2.givenWeekSleepData()).to.equal() }) }) From c10a2abcff2a672ce7020b6abe144556f87b668a Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Thu, 8 Dec 2022 16:58:01 -0700 Subject: [PATCH 105/188] Add given weekly sleep quality test frame --- test/User-test.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/User-test.js b/test/User-test.js index d2318934d1..5531193a36 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -227,8 +227,13 @@ describe('User', () => { expect(user2.sleepQualityOnSPecificDate()).to.equal() }) - it.skip('Should provide weekly sleep data for any given week', function() { + it.skip('Should provide daily sleep data for any given week', function() { - expect(user2.givenWeekSleepData()).to.equal() + expect(user2.givenWeekSleepDataByDay()).to.deeply.equal() + }) + + it.skip('Should provide daily sleep quality for any given week', function() { + + expect(user2.givenWeeksSleepQualityByDay().to.deeply.equal) }) }) From e340815fa4417896c208d089d85a55207cdb09fa Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Thu, 8 Dec 2022 16:59:40 -0700 Subject: [PATCH 106/188] Add overall sleep quality average test frame --- test/User-test.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/User-test.js b/test/User-test.js index 5531193a36..72a6d87312 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -236,4 +236,9 @@ describe('User', () => { expect(user2.givenWeeksSleepQualityByDay().to.deeply.equal) }) + + it.skip('Should average overall sleep quality', function() { + + expect(user2.averageSleepQuality())to.equal() + }) }) From fc3c614472459a988e80d7ae38e1f6ace0b2f1b7 Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Thu, 8 Dec 2022 17:46:41 -0700 Subject: [PATCH 107/188] Refactor getAverageDailySleep method --- src/User.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/User.js b/src/User.js index efdd667ca5..52763919b3 100644 --- a/src/User.js +++ b/src/User.js @@ -34,15 +34,24 @@ class User { } // Sleep - getAverageDailySleep() { - let totalHours = this.sleepData.hoursSlept.reduce((acc, user) => { + getAverageDailySleep(hoursSlept) { + let specificUserSleepData = this.getUserSleepData() + console.log("Specific ", specificUserSleepData) + let totalHours = specificUserSleepData.reduce((acc, user) => { acc += user.hoursSlept + console.log(acc) return acc }, 0) - let averageHours = totalHours/this.sleepData.hoursSlept.length - return parseInt(averageHours) + let averageHours = totalHours/specificUserSleepData.length + return averageHours } + getUserSleepData() { + let userOverallSleepData = this.sleepData.sleepData.filter(user => { + return user.userID === this.userData.id; + }) + return userOverallSleepData + } } From cc642927885f65f41b9e482c31a8fb6c6d609c1b Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Thu, 8 Dec 2022 17:47:44 -0700 Subject: [PATCH 108/188] Pass average sleep test --- test/User-test.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/User-test.js b/test/User-test.js index 72a6d87312..a3dae570a1 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -207,9 +207,9 @@ describe('User', () => { }) //Sleep - it.skip('should return a users average number of hours of sleep per day', function() { + it('should return a users average number of hours of sleep per day', function() { - expect(user2.getAverageDailySleep()).to.equal(5.3) + expect(user1.getAverageDailySleep()).to.equal(5.75) }) it.skip('Should give user average sleep over all sleep data', function() { @@ -217,9 +217,10 @@ describe('User', () => { expect(user2.getOverallSleepAvg()).to.equal() }) - it.skip('Should give hours slept on a specific date' function() { + it.skip('Should give hours slept on a specific date', function() { - expect(user2.sleepOnSpecificDate()).to.equal() + expect(user2.sleepOnSpecificDate("2019/06/15")).to.equal(7); + expect(user3.sleepOnSpecificDate("2019/06/15")).to.equal(10.8) }) it.skip('Should provide users sleep quality on specific date', function() { @@ -234,11 +235,11 @@ describe('User', () => { it.skip('Should provide daily sleep quality for any given week', function() { - expect(user2.givenWeeksSleepQualityByDay().to.deeply.equal) + expect(user2.givenWeeksSleepQualityByDay()).to.deeply.equal() }) it.skip('Should average overall sleep quality', function() { - expect(user2.averageSleepQuality())to.equal() + expect(user2.averageSleepQuality()).to.equal() }) }) From 7c0f98ae74a99e60b2eaab107003f2339971f597 Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Thu, 8 Dec 2022 18:20:17 -0700 Subject: [PATCH 109/188] Create getOverallSleepAvg method --- src/User.js | 18 ++- test/User-test.js | 299 +++++++++++++++++++++++----------------------- 2 files changed, 166 insertions(+), 151 deletions(-) diff --git a/src/User.js b/src/User.js index 52763919b3..cfc62ba73f 100644 --- a/src/User.js +++ b/src/User.js @@ -33,8 +33,16 @@ class User { }, 0) } + getWeeklyConsumption() { + let userWeeklyH20 = this.hydrationData.hydrationData.filter(user => { + return user.userID === this.userData.id; + }) + + return userWeeklyH20.slice(-7); + } + // Sleep - getAverageDailySleep(hoursSlept) { + getAverageDailySleep() { let specificUserSleepData = this.getUserSleepData() console.log("Specific ", specificUserSleepData) let totalHours = specificUserSleepData.reduce((acc, user) => { @@ -42,7 +50,7 @@ class User { console.log(acc) return acc }, 0) - let averageHours = totalHours/specificUserSleepData.length + let averageHours = totalHours / specificUserSleepData.length return averageHours } @@ -50,7 +58,11 @@ class User { let userOverallSleepData = this.sleepData.sleepData.filter(user => { return user.userID === this.userData.id; }) - return userOverallSleepData + return userOverallSleepData + } + + getOverallSleepAvg() { + } } diff --git a/test/User-test.js b/test/User-test.js index a3dae570a1..9caddd384b 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -4,242 +4,245 @@ import User from '../src/User' describe('User', () => { let user1, user2, user3, hydrationData, sleepData beforeEach(() => { - hydrationData = {hydrationData: [ - { - userID: 1, - date: "2019/06/15", - numOunces: 37 - }, - { - userID: 2, - date: "2019/06/15", - numOunces: 75 - }, - { - userID: 3, - date: "2019/06/15", - numOunces: 47 - }, - { - userID: 1, - date: "2019/06/16", - numOunces: 85 - }, - { - userID: 2, - date: "2019/06/16", - numOunces: 42 - } - ]} - sleepData = {sleepData: [{ - userID: 1, - date: "2019/06/15", - hoursSlept: 6.1, - sleepQuality: 2.2 + hydrationData = { + hydrationData: [ + { + userID: 1, + date: "2019/06/15", + numOunces: 37 + }, + { + userID: 2, + date: "2019/06/15", + numOunces: 75 + }, + { + userID: 3, + date: "2019/06/15", + numOunces: 47 + }, + { + userID: 1, + date: "2019/06/16", + numOunces: 85 + }, + { + userID: 2, + date: "2019/06/16", + numOunces: 42 + } + ] + } + sleepData = { + sleepData: [{ + userID: 1, + date: "2019/06/15", + hoursSlept: 6.1, + sleepQuality: 2.2 }, { - userID: 2, - date: "2019/06/15", - hoursSlept: 7, - sleepQuality: 4.7 + userID: 2, + date: "2019/06/15", + hoursSlept: 7, + sleepQuality: 4.7 }, { - userID: 3, - date: "2019/06/15", - hoursSlept: 10.8, - sleepQuality: 4.7 + userID: 3, + date: "2019/06/15", + hoursSlept: 10.8, + sleepQuality: 4.7 }, { - userID: 1, - date: "2019/06/16", - hoursSlept: 5.4, - sleepQuality: 3 + userID: 1, + date: "2019/06/16", + hoursSlept: 5.4, + sleepQuality: 3 }, { - userID: 2, - date: "2019/06/16", - hoursSlept: 4.1, - sleepQuality: 3.6 + userID: 2, + date: "2019/06/16", + hoursSlept: 4.1, + sleepQuality: 3.6 }] -} + } user1 = new User({ - "id": 1, - "name": "Luisa Hane", - "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", - "email": "Diana.Hayes1@hotmail.com", - "strideLength": 4.3, - "dailyStepGoal": 10000, - "friends": [ - 16, - 4, - 8 - ] + "id": 1, + "name": "Luisa Hane", + "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", + "email": "Diana.Hayes1@hotmail.com", + "strideLength": 4.3, + "dailyStepGoal": 10000, + "friends": [ + 16, + 4, + 8 + ] }, sleepData, hydrationData) user2 = new User({ - "id": 2, - "name": "Jarvis Considine", - "address": "30086 Kathryn Port, Ciceroland NE 07273", - "email": "Dimitri.Bechtelar11@gmail.com", - "strideLength": 4.5, - "dailyStepGoal": 5000, - "friends": [ - 9, - 18, - 24, - 19 - ] + "id": 2, + "name": "Jarvis Considine", + "address": "30086 Kathryn Port, Ciceroland NE 07273", + "email": "Dimitri.Bechtelar11@gmail.com", + "strideLength": 4.5, + "dailyStepGoal": 5000, + "friends": [ + 9, + 18, + 24, + 19 + ] }, sleepData, hydrationData) user3 = new User({ - "id": 3, - "name": "Herminia Witting", - "address": "85823 Bosco Fork, East Oscarstad MI 85126-5660", - "email": "Elwin.Tromp@yahoo.com", - "strideLength": 4.4, - "dailyStepGoal": 5000, - "friends": [ - 19, - 11, - 42, - 33 - ] + "id": 3, + "name": "Herminia Witting", + "address": "85823 Bosco Fork, East Oscarstad MI 85126-5660", + "email": "Elwin.Tromp@yahoo.com", + "strideLength": 4.4, + "dailyStepGoal": 5000, + "friends": [ + 19, + 11, + 42, + 33 + ] }, sleepData, hydrationData) }) it('should be a function', function () { - expect(User).to.be.a('function'); + expect(User).to.be.a('function'); }); it('should instantiate a new User', function () { - expect(User).to.be.a('function'); + expect(User).to.be.a('function'); }) it('should have a Userdata parameter', function () { - expect(user1.userData).to.deep.equal({ - "id": 1, - "name": "Luisa Hane", - "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", - "email": "Diana.Hayes1@hotmail.com", - "strideLength": 4.3, - "dailyStepGoal": 10000, - "friends": [ - 16, - 4, - 8 - ] - }); + expect(user1.userData).to.deep.equal({ + "id": 1, + "name": "Luisa Hane", + "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", + "email": "Diana.Hayes1@hotmail.com", + "strideLength": 4.3, + "dailyStepGoal": 10000, + "friends": [ + 16, + 4, + 8 + ] + }); }) it('should have an id', function () { - expect(user1.userData.id).to.equal(1); + expect(user1.userData.id).to.equal(1); }) it('should have a name', function () { - expect(user1.userData.name).to.equal("Luisa Hane"); + expect(user1.userData.name).to.equal("Luisa Hane"); }) it('should have an address', function () { - expect(user1.userData.address).to.equal("15195 Nakia Tunnel, Erdmanport VA 19901-1697"); + expect(user1.userData.address).to.equal("15195 Nakia Tunnel, Erdmanport VA 19901-1697"); }) it('should have an email', function () { - expect(user1.userData.email).to.equal("Diana.Hayes1@hotmail.com"); + expect(user1.userData.email).to.equal("Diana.Hayes1@hotmail.com"); }) it('should have a strideLength', function () { - expect(user1.userData.strideLength).to.equal(4.3); + expect(user1.userData.strideLength).to.equal(4.3); }) it('should have a step goal', function () { - expect(user1.userData.dailyStepGoal).to.equal(10000); + expect(user1.userData.dailyStepGoal).to.equal(10000); }) it('should have friends', function () { - expect(user1.userData.friends).to.deep.equal([16, 4, 8]); + expect(user1.userData.friends).to.deep.equal([16, 4, 8]); }) - it('should have a Userdata parameter', function () { + it('should have a Userdata parameter', function () { - expect(user1.userData).to.deep.equal({ - "id": 1, - "name": "Luisa Hane", - "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", - "email": "Diana.Hayes1@hotmail.com", - "strideLength": 4.3, - "dailyStepGoal": 10000, - "friends": [ - 16, - 4, - 8 - ] - }) - }); + expect(user1.userData).to.deep.equal({ + "id": 1, + "name": "Luisa Hane", + "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", + "email": "Diana.Hayes1@hotmail.com", + "strideLength": 4.3, + "dailyStepGoal": 10000, + "friends": [ + 16, + 4, + 8 + ] + }) + }); - it('should return users first name', function() { + it('should return users first name', function () { - expect(user1.getFirstName()).to.equal("Luisa"); - }) + expect(user1.getFirstName()).to.equal("Luisa"); + }) -//Hydration - it('should output the average fluid ounces of water consumed daily', function() { + //Hydration + it('should output the average fluid ounces of water consumed daily', function () { expect(user1.getAvgDailyWater(1)).to.equal(61); }) - it('should identify how many ounces of water a user consumed on a specific day', function() { + it('should identify how many ounces of water a user consumed on a specific day', function () { expect(user2.getWaterPerDay("2019/06/15")).to.equal(75); expect(user3.getWaterPerDay("2019/06/15")).to.equal(47); }) - it.skip('should calculate average ounces consumed daily over the course of one week', function() { + it.skip('should calculate average ounces consumed daily over the course of one week', function () { expect().to.equal() }) -//Sleep - it('should return a users average number of hours of sleep per day', function() { + //Sleep + it('should return a users average number of hours of sleep per day', function () { expect(user1.getAverageDailySleep()).to.equal(5.75) }) - it.skip('Should give user average sleep over all sleep data', function() { + it('Should give user average sleep over all sleep data', function () { - expect(user2.getOverallSleepAvg()).to.equal() - }) + expect(user2.getOverallSleepAvg()).to.equal() + }) - it.skip('Should give hours slept on a specific date', function() { + it.skip('Should give hours slept on a specific date', function () { - expect(user2.sleepOnSpecificDate("2019/06/15")).to.equal(7); + expect(user2.sleepOnSpecificDate("2019/06/15")).to.equal(7); expect(user3.sleepOnSpecificDate("2019/06/15")).to.equal(10.8) - }) + }) - it.skip('Should provide users sleep quality on specific date', function() { + it.skip('Should provide users sleep quality on specific date', function () { - expect(user2.sleepQualityOnSPecificDate()).to.equal() - }) + expect(user2.sleepQualityOnSPecificDate()).to.equal() + }) - it.skip('Should provide daily sleep data for any given week', function() { + it.skip('Should provide daily sleep data for any given week', function () { - expect(user2.givenWeekSleepDataByDay()).to.deeply.equal() - }) + expect(user2.givenWeekSleepDataByDay()).to.deeply.equal() + }) - it.skip('Should provide daily sleep quality for any given week', function() { + it.skip('Should provide daily sleep quality for any given week', function () { - expect(user2.givenWeeksSleepQualityByDay()).to.deeply.equal() - }) + expect(user2.givenWeeksSleepQualityByDay()).to.deeply.equal() + }) - it.skip('Should average overall sleep quality', function() { + it.skip('Should average overall sleep quality', function () { - expect(user2.averageSleepQuality()).to.equal() - }) + expect(user2.averageSleepQuality()).to.equal() + }) }) From 9e6e0cf9ccaf47b9cf8c07c57f5db2f79f6dc491 Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Thu, 8 Dec 2022 18:31:10 -0700 Subject: [PATCH 110/188] Complete getOverallQualityAvg method and pass test --- src/User.js | 12 ++++++++++-- test/User-test.js | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/User.js b/src/User.js index cfc62ba73f..625c732c03 100644 --- a/src/User.js +++ b/src/User.js @@ -61,8 +61,16 @@ class User { return userOverallSleepData } - getOverallSleepAvg() { - + getOverallQualityAvg() { + let specificUserSleepQuality = this.getUserSleepData() + //console.log("Specific ", specificUserSleepData) + let totalQuality = specificUserSleepQuality.reduce((acc, user) => { + acc += user.sleepQuality + console.log(acc) + return acc + }, 0) + let averageQuality = totalQuality / specificUserSleepQuality.length + return averageQuality } } diff --git a/test/User-test.js b/test/User-test.js index 9caddd384b..950c7f7dee 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -215,9 +215,9 @@ describe('User', () => { expect(user1.getAverageDailySleep()).to.equal(5.75) }) - it('Should give user average sleep over all sleep data', function () { + it('Should return a users average sleep quality', function () { - expect(user2.getOverallSleepAvg()).to.equal() + expect(user2.getOverallQualityAvg()).to.equal(4.15) }) it.skip('Should give hours slept on a specific date', function () { From c37e0df1879cfab7c2a466fb26d86332bd4795a2 Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Thu, 8 Dec 2022 18:39:25 -0700 Subject: [PATCH 111/188] Add sleepOnSpecificDate method and pass corresponding test --- src/User.js | 15 +++++++++++++-- test/User-test.js | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/User.js b/src/User.js index 625c732c03..d0d174054d 100644 --- a/src/User.js +++ b/src/User.js @@ -73,9 +73,20 @@ class User { return averageQuality } -} - + sleepOnSpecificDate(date) { + let dates = this.sleepData.sleepData.filter((user) => { + return user.date === date + }) + console.log('hi', dates) + return dates.reduce((acc, curr) => { + if (curr.userID === this.userData.id) { + acc = curr.hoursSlept + } + return acc + }, 0) + } +} //For a user (identified by their userID), the average number of hours slept per day diff --git a/test/User-test.js b/test/User-test.js index 950c7f7dee..374491c1a4 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -220,7 +220,7 @@ describe('User', () => { expect(user2.getOverallQualityAvg()).to.equal(4.15) }) - it.skip('Should give hours slept on a specific date', function () { + it('Should give hours slept on a specific date', function () { expect(user2.sleepOnSpecificDate("2019/06/15")).to.equal(7); expect(user3.sleepOnSpecificDate("2019/06/15")).to.equal(10.8) From 13287c772fd322513e728aff5f2d5cc747ec6026 Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Thu, 8 Dec 2022 18:42:38 -0700 Subject: [PATCH 112/188] Complete sleepQualityOnSPecificDate method --- src/User.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/User.js b/src/User.js index d0d174054d..616b56a228 100644 --- a/src/User.js +++ b/src/User.js @@ -86,6 +86,19 @@ class User { }, 0) } + sleepQualityOnSPecificDate(date) { + let dates = this.sleepData.sleepData.filter((user) => { + return user.date === date + }) + console.log('hi', dates) + return dates.reduce((acc, curr) => { + if (curr.userID === this.userData.id) { + acc = curr.sleepQuality + } + return acc + }, 0) + } + } From 525243d512470da91c9e621ce81696d6dede0bc1 Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Thu, 8 Dec 2022 18:43:30 -0700 Subject: [PATCH 113/188] Pass sleepQualityOnSPecificDate test --- test/User-test.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/User-test.js b/test/User-test.js index 374491c1a4..9227df936b 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -226,9 +226,10 @@ describe('User', () => { expect(user3.sleepOnSpecificDate("2019/06/15")).to.equal(10.8) }) - it.skip('Should provide users sleep quality on specific date', function () { + it('Should provide users sleep quality on specific date', function () { - expect(user2.sleepQualityOnSPecificDate()).to.equal() + expect(user2.sleepQualityOnSPecificDate("2019/06/15")).to.equal(4.7) + expect(user1.sleepQualityOnSPecificDate("2019/06/16")).to.equal(3) }) it.skip('Should provide daily sleep data for any given week', function () { From 4cdda30c31fc0c7aae4c17fec8401863bf040f89 Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Thu, 8 Dec 2022 18:56:14 -0700 Subject: [PATCH 114/188] Complete averageSleepQuality method --- src/User.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/User.js b/src/User.js index 616b56a228..097e1ab07d 100644 --- a/src/User.js +++ b/src/User.js @@ -99,6 +99,21 @@ class User { }, 0) } + averageSleepQuality() { + + //console.log("Specific ", specificUserSleepData) + let totalQuality = this.sleepData.sleepData.reduce((acc, user) => { + acc += user.sleepQuality + console.log(acc) + return acc + }, 0) + let averageQuality = totalQuality / this.sleepData.sleepData.length + console.log('avg uality', averageQuality) + return Number(averageQuality.toFixed(2)) + + // 3 + } + } From 3ac7e741d14f1fd148f0b1e164e71da36c9bc82f Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Thu, 8 Dec 2022 18:57:04 -0700 Subject: [PATCH 115/188] Pass averageSleepQuality --- test/User-test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/User-test.js b/test/User-test.js index 9227df936b..1b8f39aa7c 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -242,8 +242,8 @@ describe('User', () => { expect(user2.givenWeeksSleepQualityByDay()).to.deeply.equal() }) - it.skip('Should average overall sleep quality', function () { + it('Should average overall sleep quality for all users', function () { - expect(user2.averageSleepQuality()).to.equal() + expect(user1.averageSleepQuality()).to.equal(3.64) }) }) From d9ed92481145c15fe8906505f954f92ea6a8c7ef Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Fri, 9 Dec 2022 14:22:03 -0700 Subject: [PATCH 116/188] Add givenWeekSleepDataByDay method --- src/User.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/User.js b/src/User.js index 097e1ab07d..a51dcdc505 100644 --- a/src/User.js +++ b/src/User.js @@ -99,6 +99,18 @@ class User { }, 0) } + givenWeekSleepDataByDay() { + let userWeeklySleep = this.sleepData.sleepData.filter(user => { + return user.userID === this.userData.id; + }) + + let hi = userWeeklySleep.slice(-7) + + console.log('abced', hi); + + return hi; + } + averageSleepQuality() { //console.log("Specific ", specificUserSleepData) @@ -110,8 +122,6 @@ class User { let averageQuality = totalQuality / this.sleepData.sleepData.length console.log('avg uality', averageQuality) return Number(averageQuality.toFixed(2)) - - // 3 } } From c64b811b1cda6b5562db959f81e1da202db1fc6b Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Fri, 9 Dec 2022 14:22:31 -0700 Subject: [PATCH 117/188] Pass givenWeekSleepDataByDay test --- test/User-test.js | 56 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 51 insertions(+), 5 deletions(-) diff --git a/test/User-test.js b/test/User-test.js index 1b8f39aa7c..eaff053b19 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -63,7 +63,45 @@ describe('User', () => { date: "2019/06/16", hoursSlept: 4.1, sleepQuality: 3.6 - }] + }, + { + userID: 2, + date: "2019/06/17", + hoursSlept: 4.1, + sleepQuality: 3.6 + }, + { + userID: 2, + date: "2019/06/18", + hoursSlept: 4.1, + sleepQuality: 3.6 + }, + { + userID: 2, + date: "2019/06/19", + hoursSlept: 4.1, + sleepQuality: 3.6 + }, + { + userID: 2, + date: "2019/06/20", + hoursSlept: 6.5, + sleepQuality: 1.1 + }, + { + userID: 2, + date: "2019/06/21", + hoursSlept: 4.1, + sleepQuality: 3.6 + }, + { + userID: 2, + date: "2019/06/22", + hoursSlept: 3.9, + sleepQuality: 5.4 + } + + ] } user1 = new User({ "id": 1, @@ -232,14 +270,22 @@ describe('User', () => { expect(user1.sleepQualityOnSPecificDate("2019/06/16")).to.equal(3) }) - it.skip('Should provide daily sleep data for any given week', function () { - - expect(user2.givenWeekSleepDataByDay()).to.deeply.equal() + it('Should provide daily sleep data for any given week', function () { + + expect(user2.givenWeekSleepDataByDay()).to.deep.equal([ + { userID: 2, date: '2019/06/16', hoursSlept: 4.1, sleepQuality: 3.6 }, + { userID: 2, date: '2019/06/17', hoursSlept: 4.1, sleepQuality: 3.6 }, + { userID: 2, date: '2019/06/18', hoursSlept: 4.1, sleepQuality: 3.6 }, + { userID: 2, date: '2019/06/19', hoursSlept: 4.1, sleepQuality: 3.6 }, + { userID: 2, date: '2019/06/20', hoursSlept: 6.5, sleepQuality: 1.1 }, + { userID: 2, date: '2019/06/21', hoursSlept: 4.1, sleepQuality: 3.6 }, + { userID: 2, date: '2019/06/22', hoursSlept: 3.9, sleepQuality: 5.4 } + ]) }) it.skip('Should provide daily sleep quality for any given week', function () { - expect(user2.givenWeeksSleepQualityByDay()).to.deeply.equal() + expect(user2.givenWeeksSleepQualityByDay()).to.deep.equal() }) it('Should average overall sleep quality for all users', function () { From d8ea083a9b6c6499112cdb58ad9a0f58dc2f41df Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Fri, 9 Dec 2022 14:27:35 -0700 Subject: [PATCH 118/188] Refactor test for added instances --- test/User-test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/User-test.js b/test/User-test.js index eaff053b19..62ad9fa522 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -255,7 +255,7 @@ describe('User', () => { it('Should return a users average sleep quality', function () { - expect(user2.getOverallQualityAvg()).to.equal(4.15) + expect(user1.getOverallQualityAvg()).to.equal(2.6) }) it('Should give hours slept on a specific date', function () { @@ -283,13 +283,13 @@ describe('User', () => { ]) }) - it.skip('Should provide daily sleep quality for any given week', function () { + it('Should provide daily sleep quality for any given week', function () { expect(user2.givenWeeksSleepQualityByDay()).to.deep.equal() }) it('Should average overall sleep quality for all users', function () { - expect(user1.averageSleepQuality()).to.equal(3.64) + expect(user1.averageSleepQuality()).to.equal(3.55) }) }) From 9beaa4bb7243067770f0984a5762743ae445edfe Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Fri, 9 Dec 2022 15:02:51 -0700 Subject: [PATCH 119/188] Complete givenWeekSleepDataByDay method --- src/User.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/User.js b/src/User.js index a51dcdc505..d0bcc3b52c 100644 --- a/src/User.js +++ b/src/User.js @@ -104,11 +104,19 @@ class User { return user.userID === this.userData.id; }) - let hi = userWeeklySleep.slice(-7) + const last7SleepDays = userWeeklySleep.slice(-7); + + let filteredSleep = last7SleepDays.map(user => { + let sleepDate = user.date; + let sleepHours = user.hoursSlept; + let both = {}; + both[sleepDate] = sleepHours; + return both; + }) - console.log('abced', hi); + console.log('hi', filteredSleep) - return hi; + return filteredSleep; } averageSleepQuality() { From f15f6840b444799e10f6d0d8121c7161cef0c813 Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Fri, 9 Dec 2022 15:03:22 -0700 Subject: [PATCH 120/188] Pass givenWeekSleepDataByDay test --- test/User-test.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/User-test.js b/test/User-test.js index 62ad9fa522..1844eaf44b 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -273,17 +273,17 @@ describe('User', () => { it('Should provide daily sleep data for any given week', function () { expect(user2.givenWeekSleepDataByDay()).to.deep.equal([ - { userID: 2, date: '2019/06/16', hoursSlept: 4.1, sleepQuality: 3.6 }, - { userID: 2, date: '2019/06/17', hoursSlept: 4.1, sleepQuality: 3.6 }, - { userID: 2, date: '2019/06/18', hoursSlept: 4.1, sleepQuality: 3.6 }, - { userID: 2, date: '2019/06/19', hoursSlept: 4.1, sleepQuality: 3.6 }, - { userID: 2, date: '2019/06/20', hoursSlept: 6.5, sleepQuality: 1.1 }, - { userID: 2, date: '2019/06/21', hoursSlept: 4.1, sleepQuality: 3.6 }, - { userID: 2, date: '2019/06/22', hoursSlept: 3.9, sleepQuality: 5.4 } + { '2019/06/16': 4.1 }, + { '2019/06/17': 4.1 }, + { '2019/06/18': 4.1 }, + { '2019/06/19': 4.1 }, + { '2019/06/20': 6.5 }, + { '2019/06/21': 4.1 }, + { '2019/06/22': 3.9 } ]) }) - it('Should provide daily sleep quality for any given week', function () { + it.skip('Should provide daily sleep quality for any given week', function () { expect(user2.givenWeeksSleepQualityByDay()).to.deep.equal() }) From 6e8d477975a3e6200c399e6ac2c5e27cb186fc43 Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Fri, 9 Dec 2022 15:07:53 -0700 Subject: [PATCH 121/188] Complete givenWeeksSleepQualityByDay method --- src/User.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/User.js b/src/User.js index d0bcc3b52c..bacfc2af37 100644 --- a/src/User.js +++ b/src/User.js @@ -119,6 +119,26 @@ class User { return filteredSleep; } + givenWeeksSleepQualityByDay() { + let userWeeklySleep = this.sleepData.sleepData.filter(user => { + return user.userID === this.userData.id; + }) + + const last7SleepDays = userWeeklySleep.slice(-7); + + let filteredQuality = last7SleepDays.map(user => { + let sleepDate = user.date; + let sleepQuality = user.sleepQuality; + let both = {}; + both[sleepDate] = sleepQuality; + return both; + }) + + console.log('hi', filteredQuality) + + return filteredQuality; + } + averageSleepQuality() { //console.log("Specific ", specificUserSleepData) From 8464934a638bc1ae2f7b9839a3af562a1f0334fe Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Fri, 9 Dec 2022 15:08:47 -0700 Subject: [PATCH 122/188] Pass givenWeeksSleepQualityByDay test --- test/User-test.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/test/User-test.js b/test/User-test.js index 1844eaf44b..0b3c9c7f5e 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -283,9 +283,17 @@ describe('User', () => { ]) }) - it.skip('Should provide daily sleep quality for any given week', function () { - - expect(user2.givenWeeksSleepQualityByDay()).to.deep.equal() + it('Should provide daily sleep quality for any given week', function () { + + expect(user2.givenWeeksSleepQualityByDay()).to.deep.equal([ + { '2019/06/16': 3.6 }, + { '2019/06/17': 3.6 }, + { '2019/06/18': 3.6 }, + { '2019/06/19': 3.6 }, + { '2019/06/20': 1.1 }, + { '2019/06/21': 3.6 }, + { '2019/06/22': 5.4 } + ]) }) it('Should average overall sleep quality for all users', function () { From 2f75b8db193a8b0120e2b0a043fa84a79d1b42c0 Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Fri, 9 Dec 2022 15:28:03 -0700 Subject: [PATCH 123/188] Pass getWeeklyConsumption test --- test/User-test.js | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/test/User-test.js b/test/User-test.js index 0b3c9c7f5e..cd938f3b27 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -30,6 +30,41 @@ describe('User', () => { userID: 2, date: "2019/06/16", numOunces: 42 + }, + { + userID: 2, + date: "2019/06/17", + numOunces: 19 + }, + { + userID: 2, + date: "2019/06/18", + numOunces: 42 + }, + { + userID: 2, + date: "2019/06/19", + numOunces: 42 + }, + { + userID: 2, + date: "2019/06/20", + numOunces: 33 + }, + { + userID: 2, + date: "2019/06/21", + numOunces: 51 + }, + { + userID: 2, + date: "2019/06/22", + numOunces: 87 + }, + { + userID: 2, + date: "2019/06/23", + numOunces: 23 } ] } @@ -242,9 +277,17 @@ describe('User', () => { expect(user3.getWaterPerDay("2019/06/15")).to.equal(47); }) - it.skip('should calculate average ounces consumed daily over the course of one week', function () { + it('should calculate average ounces consumed daily over the course of one week', function () { - expect().to.equal() + expect(user2.getWeeklyConsumption()).to.deep.equal([ + { userID: 2, date: '2019/06/17', numOunces: 19 }, + { userID: 2, date: '2019/06/18', numOunces: 42 }, + { userID: 2, date: '2019/06/19', numOunces: 42 }, + { userID: 2, date: '2019/06/20', numOunces: 33 }, + { userID: 2, date: '2019/06/21', numOunces: 51 }, + { userID: 2, date: '2019/06/22', numOunces: 87 }, + { userID: 2, date: '2019/06/23', numOunces: 23 } + ]) }) //Sleep From 28b00ba5203ac9a75d2bb4907306895affc77d30 Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Fri, 9 Dec 2022 15:54:54 -0700 Subject: [PATCH 124/188] add daily water intake display on dashboard --- src/scripts.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/scripts.js b/src/scripts.js index 7211db4d88..3dc53d274c 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -85,9 +85,16 @@ function getUserFriends() { return friendsArray.join(', ') } +function displayWater() { + hydrationBox.innerText = `Your water intake for today is ${currentUser.getWaterPerDay('2019/06/15')} ounces` + +} + function loadPage() { getUser(sleep, hydration) displayUserInfo() stepGoalDisplay() displayWelcomeName() + displayWater() } + From 3bb496ad8f3eeca49ae9f753ec9aae05e8ea9194 Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Fri, 9 Dec 2022 16:18:14 -0700 Subject: [PATCH 125/188] update hydration index --- dist/index.html | 2 +- src/User.js | 14 +++++++++++++- src/scripts.js | 4 +++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/dist/index.html b/dist/index.html index f7882d241d..587ac06085 100644 --- a/dist/index.html +++ b/dist/index.html @@ -13,7 +13,7 @@

    Welcome

    Your Info
    -
    Hydration
    +
    Hydration
    StepGoal
    Activity
    Friends
    diff --git a/src/User.js b/src/User.js index bacfc2af37..27392c2efd 100644 --- a/src/User.js +++ b/src/User.js @@ -38,7 +38,19 @@ class User { return user.userID === this.userData.id; }) - return userWeeklyH20.slice(-7); + let weeklyWater = userWeeklyH20.slice(-7); + console.log('weeklyWater', weeklyWater) + + let filteredWater = weeklyWater.map(user => { + let date = user.date; + let numOunces = user.numOunces; + let both = {}; + both[date] = numOunces; + return both; + }) + console.log('filteredWater variable', filteredWater) + + return filteredWater; } // Sleep diff --git a/src/scripts.js b/src/scripts.js index 3dc53d274c..60846251c7 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -24,6 +24,7 @@ let currentUser let sleepBox = document.querySelector('.five') let activityTrackerTitle = document.querySelector('h1') let userInfoList = document.querySelector("#userInfoList") + let hydrationInfoList = document.querySelector("#hydrationInfoList") // Event Listeners window.addEventListener('load', getAllData) @@ -86,7 +87,8 @@ function getUserFriends() { } function displayWater() { - hydrationBox.innerText = `Your water intake for today is ${currentUser.getWaterPerDay('2019/06/15')} ounces` + hydrationInfoList.innerHTML += `
  • Your water intake for today is ${currentUser.getWaterPerDay('2019/06/15')} ounces
  • +
  • Your weekly water intake is ${currentUser.getWeeklyConsumption()} ounces
  • ` } From 92c5f8e47748e5fb5004b556469e423091a5c54d Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Fri, 9 Dec 2022 16:22:31 -0700 Subject: [PATCH 126/188] refactor code for complex calculus --- src/scripts.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/scripts.js b/src/scripts.js index 60846251c7..216a2cf3a7 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -76,7 +76,6 @@ function getUser(sleep, hydration) { let randomIndex = Math.floor(Math.random() * users.data.userData.length); let randomUser = users.data.userData[randomIndex]; currentUser = new User(randomUser, sleep, hydration); - console.log('string', currentUser) } function getUserFriends() { From b38fa8fb8e9ffbe66d97e4aa72fee7520491f9bc Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Fri, 9 Dec 2022 17:04:29 -0700 Subject: [PATCH 127/188] Refactor HTML to include an unordered list --- dist/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/index.html b/dist/index.html index 587ac06085..924f87ecd0 100644 --- a/dist/index.html +++ b/dist/index.html @@ -17,7 +17,7 @@

    Welcome

    StepGoal
    Activity
    Friends
    -
    Sleep
    +
    Sleep
    From 3244d288d1ff5e56411752c594235e5de361d51d Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Fri, 9 Dec 2022 17:05:03 -0700 Subject: [PATCH 128/188] Fix typo in sleep quality method --- src/User.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/User.js b/src/User.js index 27392c2efd..a45c2ae27e 100644 --- a/src/User.js +++ b/src/User.js @@ -98,7 +98,7 @@ class User { }, 0) } - sleepQualityOnSPecificDate(date) { + sleepQualityOnSpecificDate(date) { let dates = this.sleepData.sleepData.filter((user) => { return user.date === date }) From e1641d28269f14366d51f46418350eb16668ddc9 Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Fri, 9 Dec 2022 17:05:23 -0700 Subject: [PATCH 129/188] Add sleep data to the DOM --- src/scripts.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/scripts.js b/src/scripts.js index 216a2cf3a7..01824d6607 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -25,6 +25,7 @@ let currentUser let activityTrackerTitle = document.querySelector('h1') let userInfoList = document.querySelector("#userInfoList") let hydrationInfoList = document.querySelector("#hydrationInfoList") + let sleepInfoList = document.querySelector("#sleepInfoList") // Event Listeners window.addEventListener('load', getAllData) @@ -67,7 +68,7 @@ function displayWelcomeName() { activityTrackerTitle.innerText += ` ${currentUser.getFirstName()}` } -function stepGoalDisplay() { +function displayStepGoal() { stepGoalBox.innerText = `Your step goal is ${currentUser.userData.dailyStepGoal} steps. The average step goal is ${users.stepGoalAverage()}.` } @@ -91,11 +92,17 @@ function displayWater() { } +function displaySleep() { + sleepInfoList.innerHTML += `
  • Last night you slept ${currentUser.sleepOnSpecificDate('2019/06/15')} hours
  • +
  • The quality of your sleep last night was ${currentUser.sleepQualityOnSpecificDate('2019/06/15')} out of 5
  • ` +} + function loadPage() { getUser(sleep, hydration) displayUserInfo() - stepGoalDisplay() + displayStepGoal() displayWelcomeName() displayWater() + displaySleep() } From ebc8f625d8b86c3822bb8687ee8c22349e98b5e2 Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Fri, 9 Dec 2022 17:31:23 -0700 Subject: [PATCH 130/188] Modify HTML to include sleep history --- dist/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/index.html b/dist/index.html index 924f87ecd0..dcc61f2b55 100644 --- a/dist/index.html +++ b/dist/index.html @@ -16,7 +16,7 @@

    Welcome

    Hydration
    StepGoal
    Activity
    -
    Friends
    +
    Sleep History
    Sleep
    From 64210c20b693a28507c8b1829f75db604524d7d5 Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Fri, 9 Dec 2022 17:31:41 -0700 Subject: [PATCH 131/188] Add sleep history to the DOM --- src/scripts.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/scripts.js b/src/scripts.js index 01824d6607..20ac3f5101 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -20,12 +20,13 @@ let currentUser let hydrationBox = document.querySelector('.one') let stepGoalBox = document.querySelector('.two') let activityBox = document.querySelector('.three') - let friendsBox = document.querySelector('.four') + let sleepHistoryBox = document.querySelector('.four') let sleepBox = document.querySelector('.five') let activityTrackerTitle = document.querySelector('h1') let userInfoList = document.querySelector("#userInfoList") let hydrationInfoList = document.querySelector("#hydrationInfoList") let sleepInfoList = document.querySelector("#sleepInfoList") + let sleepHistoryList = document.querySelector("#sleepHistoryList") // Event Listeners window.addEventListener('load', getAllData) @@ -92,9 +93,21 @@ function displayWater() { } +// function showOverallSleep() { +// currentUser.sleepOnSpecificDate() +// currentUser.sleepQualityOnSpecificDate() +// } + function displaySleep() { + sleepInfoList.innerHTML += `
  • Last night you slept ${currentUser.sleepOnSpecificDate('2019/06/15')} hours
  • -
  • The quality of your sleep last night was ${currentUser.sleepQualityOnSpecificDate('2019/06/15')} out of 5
  • ` +
  • The quality of your sleep last night was ${currentUser.sleepQualityOnSpecificDate('2019/06/15')} out of 5
  • +
  • Your weekly sleep pattern: ${currentUser.givenWeekSleepDataByDay()} - ${currentUser.givenWeeksSleepQualityByDay()}
  • ` +} + +function displaySleepHistory() { + sleepHistoryList.innerHTML += `
  • Overall Sleep Hours: ${currentUser.getAverageDailySleep()} hours
  • +
  • Overall Sleep Quality: ${currentUser.getOverallQualityAvg()} out of 5
  • ` } function loadPage() { @@ -104,5 +117,6 @@ function loadPage() { displayWelcomeName() displayWater() displaySleep() + displaySleepHistory() } From fb6396ceb69e4291fce37350fd0eb3dc7fe9f35d Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Fri, 9 Dec 2022 17:40:16 -0700 Subject: [PATCH 132/188] Delete some console logs --- src/User.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/User.js b/src/User.js index a45c2ae27e..a912b60e0e 100644 --- a/src/User.js +++ b/src/User.js @@ -39,7 +39,6 @@ class User { }) let weeklyWater = userWeeklyH20.slice(-7); - console.log('weeklyWater', weeklyWater) let filteredWater = weeklyWater.map(user => { let date = user.date; @@ -48,22 +47,18 @@ class User { both[date] = numOunces; return both; }) - console.log('filteredWater variable', filteredWater) - return filteredWater; } // Sleep getAverageDailySleep() { let specificUserSleepData = this.getUserSleepData() - console.log("Specific ", specificUserSleepData) let totalHours = specificUserSleepData.reduce((acc, user) => { acc += user.hoursSlept - console.log(acc) return acc }, 0) let averageHours = totalHours / specificUserSleepData.length - return averageHours + return Number(averageHours.toFixed(2)) } getUserSleepData() { @@ -75,14 +70,12 @@ class User { getOverallQualityAvg() { let specificUserSleepQuality = this.getUserSleepData() - //console.log("Specific ", specificUserSleepData) let totalQuality = specificUserSleepQuality.reduce((acc, user) => { acc += user.sleepQuality - console.log(acc) return acc }, 0) let averageQuality = totalQuality / specificUserSleepQuality.length - return averageQuality + return Number(averageQuality.toFixed(2)) } sleepOnSpecificDate(date) { From 11cddea0b4fc3473285faa88f011b694da870619 Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sat, 10 Dec 2022 10:38:01 -0700 Subject: [PATCH 133/188] Refactor font size and height/width --- src/css/styles.css | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/css/styles.css b/src/css/styles.css index 5c35eda122..a7454186c2 100644 --- a/src/css/styles.css +++ b/src/css/styles.css @@ -1,7 +1,9 @@ -body, html { +body, +html { background-image: linear-gradient(to top, aliceblue 0%, lightblue 90%, blue 100%); background-repeat: no-repeat; height: 100%; + font-size: 7px; } .grid-container { @@ -9,6 +11,8 @@ body, html { grid-template-columns: repeat(4, 1fr); gap: 20px; grid-template-rows: 1fr 1fr 1fr; + height: 80vh; + width: 100vw; } .grid-item { @@ -29,4 +33,4 @@ body, html { .two { grid-column: 4; grid-row: 1 / 3; -} +} \ No newline at end of file From 16edb7d855454ff664c92b6e8c9ec6805db19085 Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sat, 10 Dec 2022 10:46:50 -0700 Subject: [PATCH 134/188] Refactor grid display format --- src/css/styles.css | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/css/styles.css b/src/css/styles.css index a7454186c2..f2a7f5b280 100644 --- a/src/css/styles.css +++ b/src/css/styles.css @@ -27,10 +27,15 @@ html { } .zero { - grid-column: 1 / 3; + grid-column: 2 / 3; } .two { - grid-column: 4; + grid-column: 1; grid-row: 1 / 3; +} + +.four { + grid-column: 2 / 4; + grid-row: 2; } \ No newline at end of file From 855959cb316af56e5606da2d11211df0e56f0761 Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sat, 10 Dec 2022 11:13:43 -0700 Subject: [PATCH 135/188] Refactor html organization --- dist/index.html | 54 ++++++++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/dist/index.html b/dist/index.html index dcc61f2b55..58e9947ba6 100644 --- a/dist/index.html +++ b/dist/index.html @@ -1,28 +1,36 @@ - - - - Fitlit - - -
    -

    Welcome

    - -
    -
    -
    -
    Your Info
    -
    Hydration
    -
    StepGoal
    -
    Activity
    -
    Sleep History
    -
    Sleep
    + + + + + Fitlit + + + +
    +

    Welcome

    + +
    +
    +
    +
    Sleep
    +
    +
    Hydration
    +
    +
    Your Info
    -
    +
    Activity
    +
    Sleep History
    +
    +
    Sleep +
    +
    +
    + + + + + - - - - \ No newline at end of file From 8baf8488492223811dc5bda851e3af5084f43f19 Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sat, 10 Dec 2022 11:14:04 -0700 Subject: [PATCH 136/188] Refactor query selectors --- src/scripts.js | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/scripts.js b/src/scripts.js index 20ac3f5101..6bf84a3f59 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -1,6 +1,6 @@ // import './images/turing-logo.png' import './css/styles.css'; -import {getAPIData} from './apiCalls' +import { getAPIData } from './apiCalls' import User from '../src/User'; import UserRepository from './UserRepository'; @@ -9,24 +9,24 @@ import UserRepository from './UserRepository'; let users let sleep let hydration -let currentUser +let currentUser // const userRepository = new UserRepository(userData) // // console.log(userRepository) //Query Selectors - let infoBox = document.querySelector('.zero') - let hydrationBox = document.querySelector('.one') - let stepGoalBox = document.querySelector('.two') - let activityBox = document.querySelector('.three') - let sleepHistoryBox = document.querySelector('.four') - let sleepBox = document.querySelector('.five') - let activityTrackerTitle = document.querySelector('h1') - let userInfoList = document.querySelector("#userInfoList") - let hydrationInfoList = document.querySelector("#hydrationInfoList") - let sleepInfoList = document.querySelector("#sleepInfoList") - let sleepHistoryList = document.querySelector("#sleepHistoryList") +let sleepBox = document.querySelector('.zero') +let hydrationBox = document.querySelector('.one') +let infoBox = document.querySelector('.two') +let activityBox = document.querySelector('.three') +let sleepHistoryBox = document.querySelector('.four') +let stepGoalBox = document.querySelector('.five') +let activityTrackerTitle = document.querySelector('h1') +let userInfoList = document.querySelector("#userInfoList") +let hydrationInfoList = document.querySelector("#hydrationInfoList") +let sleepInfoList = document.querySelector("#sleepInfoList") +let sleepHistoryList = document.querySelector("#sleepHistoryList") // Event Listeners window.addEventListener('load', getAllData) @@ -67,11 +67,11 @@ function displayUserInfo() { function displayWelcomeName() { activityTrackerTitle.innerText += ` ${currentUser.getFirstName()}` - } +} function displayStepGoal() { stepGoalBox.innerText = `Your step goal is ${currentUser.userData.dailyStepGoal} steps. The average step goal is ${users.stepGoalAverage()}.` -} +} // Functions function getUser(sleep, hydration) { @@ -83,7 +83,7 @@ function getUser(sleep, hydration) { function getUserFriends() { let friendsArray = currentUser.userData.friends.map(friend => { return users.getData(friend).name - }) + }) return friendsArray.join(', ') } From a3079af8f2a1a67d653293759ff18c5861ee73ce Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sat, 10 Dec 2022 11:24:27 -0700 Subject: [PATCH 137/188] Refactor html organization --- dist/index.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dist/index.html b/dist/index.html index 58e9947ba6..0b47f33e44 100644 --- a/dist/index.html +++ b/dist/index.html @@ -16,14 +16,15 @@

    Welcome

    Sleep
    -
    Hydration
    +
    Step Goal
    Your Info
    -
    Activity
    +
    Hydration +
    Sleep History
    -
    Sleep +
    Weekly H20
    From b0cf527f0b05b6ddf62f65fa49c47f2fa05ef17c Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sat, 10 Dec 2022 11:24:54 -0700 Subject: [PATCH 138/188] Refactor query selectors --- src/scripts.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/scripts.js b/src/scripts.js index 6bf84a3f59..36f5085014 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -17,11 +17,11 @@ let currentUser //Query Selectors let sleepBox = document.querySelector('.zero') -let hydrationBox = document.querySelector('.one') +let stepGoalBox = document.querySelector('.one') let infoBox = document.querySelector('.two') -let activityBox = document.querySelector('.three') +//let activityBox = document.querySelector('.three') let sleepHistoryBox = document.querySelector('.four') -let stepGoalBox = document.querySelector('.five') +let hydrationBox = document.querySelector('.three') let activityTrackerTitle = document.querySelector('h1') let userInfoList = document.querySelector("#userInfoList") let hydrationInfoList = document.querySelector("#hydrationInfoList") @@ -70,7 +70,7 @@ function displayWelcomeName() { } function displayStepGoal() { - stepGoalBox.innerText = `Your step goal is ${currentUser.userData.dailyStepGoal} steps. The average step goal is ${users.stepGoalAverage()}.` + stepGoalBox.innerText += ` Your step goal is ${currentUser.userData.dailyStepGoal} steps. The average step goal is ${users.stepGoalAverage()}.` } // Functions @@ -88,8 +88,8 @@ function getUserFriends() { } function displayWater() { - hydrationInfoList.innerHTML += `
  • Your water intake for today is ${currentUser.getWaterPerDay('2019/06/15')} ounces
  • -
  • Your weekly water intake is ${currentUser.getWeeklyConsumption()} ounces
  • ` + hydrationBox.innerText += `Your water intake for today is ${currentUser.getWaterPerDay('2019/06/15')} ounces` + hydrationInfoList.innerHTML += `
  • Your weekly water intake is ${currentUser.getWeeklyConsumption()} ounces
  • ` } From 8ca8943ef6d904789aad917914cde3f5d90d9700 Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Sat, 10 Dec 2022 13:12:52 -0700 Subject: [PATCH 139/188] Add charts file --- src/charts.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/charts.js diff --git a/src/charts.js b/src/charts.js new file mode 100644 index 0000000000..949e640594 --- /dev/null +++ b/src/charts.js @@ -0,0 +1,33 @@ +import Chart from 'chart.js/auto'; + +// Steps +var xValues = ["Your Steps", "Steps Remaining"]; +var yValues = [55, 45]; +var barColors = [ + "#b91d47", + "#00aba9", + "#2b5797", + "#e8c3b9", + "#1e7145" +]; +const steps = document.getElementById('stepGoal'); +function makeCharts() { + new Chart(steps, { + type: "doughnut", + data: { + labels: ["Your Steps", "Steps Remaining"], + datasets: [{ + backgroundColor: barColors, + data: yValues + }] + }, + options: { + title: { + display: true, + text: "World Wide Wine Production 2018" + } + } + }); +} + +export default makeCharts; \ No newline at end of file From ba9d022bd47684ba09c15d85f1e69e37eedc2cdb Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Sat, 10 Dec 2022 13:13:08 -0700 Subject: [PATCH 140/188] Add changes --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index 90731f1d8f..87beb4dac3 100644 --- a/package.json +++ b/package.json @@ -22,5 +22,8 @@ "webpack": "^5.38.1", "webpack-cli": "^4.7.0", "webpack-dev-server": "^3.11.2" + }, + "dependencies": { + "chart.js": "^4.0.1" } } From 43f3eb3a84b7e91aa84ee5836237c635eb76c623 Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Sat, 10 Dec 2022 13:13:34 -0700 Subject: [PATCH 141/188] Add canvas for first chart --- dist/index.html | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/dist/index.html b/dist/index.html index 0b47f33e44..50c266e46c 100644 --- a/dist/index.html +++ b/dist/index.html @@ -3,7 +3,9 @@ - + + Fitlit @@ -16,7 +18,10 @@

    Welcome

    Sleep
    -
    Step Goal +
    + Step Goal + +
    Your Info
    @@ -31,6 +36,7 @@

    Welcome

    + From 5ec2c29034f7a7825cb3e0fc1946fbf56d853bd5 Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Sat, 10 Dec 2022 13:14:09 -0700 Subject: [PATCH 142/188] Import chart file and invoke chart function --- src/scripts.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/scripts.js b/src/scripts.js index 36f5085014..472c8df461 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -1,5 +1,6 @@ // import './images/turing-logo.png' import './css/styles.css'; +import makeCharts from './charts'; import { getAPIData } from './apiCalls' import User from '../src/User'; import UserRepository from './UserRepository'; @@ -17,7 +18,7 @@ let currentUser //Query Selectors let sleepBox = document.querySelector('.zero') -let stepGoalBox = document.querySelector('.one') +let stepGoalBox = document.querySelector('#step-text') let infoBox = document.querySelector('.two') //let activityBox = document.querySelector('.three') let sleepHistoryBox = document.querySelector('.four') @@ -58,11 +59,11 @@ function getAllData() { function displayUserInfo() { // getAllData() userInfoList.innerHTML += `
  • ${currentUser.userData.name}
  • -
  • ${currentUser.userData.address}
  • -
  • ${currentUser.userData.email}
  • -
  • Stride Length: ${currentUser.userData.strideLength}
  • -
  • Daily Step Goal: ${currentUser.userData.dailyStepGoal}
  • -
  • Friends: ${getUserFriends()}
  • ` +
  • ${currentUser.userData.address}
  • +
  • ${currentUser.userData.email}
  • +
  • Stride Length: ${currentUser.userData.strideLength}
  • +
  • Daily Step Goal: ${currentUser.userData.dailyStepGoal}
  • +
  • Friends: ${getUserFriends()}
  • ` } function displayWelcomeName() { @@ -118,5 +119,6 @@ function loadPage() { displayWater() displaySleep() displaySleepHistory() + makeCharts() } From 009a74eac6e06f0206f4733046d5c59b97e989ab Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Sat, 10 Dec 2022 13:14:42 -0700 Subject: [PATCH 143/188] Add size info to step goal chart --- src/css/styles.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/css/styles.css b/src/css/styles.css index f2a7f5b280..e3f3cb5511 100644 --- a/src/css/styles.css +++ b/src/css/styles.css @@ -38,4 +38,9 @@ html { .four { grid-column: 2 / 4; grid-row: 2; +} + +#stepGoal { + height: 20px; + width: 20px; } \ No newline at end of file From 3553726d0587ffcc8251c625b78f6dd0491827ec Mon Sep 17 00:00:00 2001 From: Anna Peterson Date: Sat, 10 Dec 2022 13:16:27 -0700 Subject: [PATCH 144/188] Delete commented out code --- dist/index.html | 1 - 1 file changed, 1 deletion(-) diff --git a/dist/index.html b/dist/index.html index 50c266e46c..532b570916 100644 --- a/dist/index.html +++ b/dist/index.html @@ -21,7 +21,6 @@

    Welcome

    Step Goal -
    Your Info
    From 0f1033349e823ea7dcf18b669c9c3ffb936a5134 Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sat, 10 Dec 2022 14:11:13 -0700 Subject: [PATCH 145/188] Add hydration class --- dist/index.html | 5 +++-- src/charts.js | 3 --- src/css/styles.css | 2 +- src/scripts.js | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/dist/index.html b/dist/index.html index 532b570916..867be53235 100644 --- a/dist/index.html +++ b/dist/index.html @@ -19,12 +19,13 @@

    Welcome

    Sleep
    - Step Goal - +

    Step Goal

    +
    Your Info
    Hydration +
    Sleep History
    diff --git a/src/charts.js b/src/charts.js index 949e640594..7ff87e856b 100644 --- a/src/charts.js +++ b/src/charts.js @@ -6,9 +6,6 @@ var yValues = [55, 45]; var barColors = [ "#b91d47", "#00aba9", - "#2b5797", - "#e8c3b9", - "#1e7145" ]; const steps = document.getElementById('stepGoal'); function makeCharts() { diff --git a/src/css/styles.css b/src/css/styles.css index e3f3cb5511..a66a013196 100644 --- a/src/css/styles.css +++ b/src/css/styles.css @@ -19,7 +19,7 @@ html { background-color: bisque; color: black; border: 2px solid #2c3e50; - border-radius: 2px; + border-radius: 25px; font-size: 4em; display: flex; justify-content: center; diff --git a/src/scripts.js b/src/scripts.js index 472c8df461..d3312e82a8 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -114,7 +114,7 @@ function displaySleepHistory() { function loadPage() { getUser(sleep, hydration) displayUserInfo() - displayStepGoal() + // displayStepGoal() displayWelcomeName() displayWater() displaySleep() From 17485c8734924c97f2ebb0888d16ac746682fdbc Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sat, 10 Dec 2022 14:11:58 -0700 Subject: [PATCH 146/188] Add sleep history id --- dist/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/dist/index.html b/dist/index.html index 867be53235..d97c88406d 100644 --- a/dist/index.html +++ b/dist/index.html @@ -28,6 +28,7 @@

    Step Goal

    Sleep History
    +
    Weekly H20
    From 7cbfd8d1e79597c54b92d8cac01e770e7ad110b5 Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sat, 10 Dec 2022 14:12:43 -0700 Subject: [PATCH 147/188] add weekly hydration id --- dist/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/dist/index.html b/dist/index.html index d97c88406d..a7f51adb67 100644 --- a/dist/index.html +++ b/dist/index.html @@ -31,6 +31,7 @@

    Step Goal

    Weekly H20
    +
    From e6ab5159c73d0d9c9faeffe10715dabc0e25d533 Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sat, 10 Dec 2022 14:18:49 -0700 Subject: [PATCH 148/188] add HTML canvas lines --- dist/index.html | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/dist/index.html b/dist/index.html index a7f51adb67..ebe5ea170e 100644 --- a/dist/index.html +++ b/dist/index.html @@ -16,21 +16,27 @@

    Welcome

    -
    Sleep
    +
    +

    Daily Sleep

    +

    Step Goal

    -
    Your Info
    +
    +

    Your Info

    -
    Hydration +
    +

    Hydration

    -
    Sleep History
    +
    +

    Sleep History

    -
    Weekly H20
    +
    +

    Weekly Hydration

    From 42c5a6451b38af47b871d781cfd811c9059880ab Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sat, 10 Dec 2022 14:24:41 -0700 Subject: [PATCH 149/188] refactor CSS gridbox --- src/css/styles.css | 3 ++- src/scripts.js | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/css/styles.css b/src/css/styles.css index a66a013196..e33f5fe259 100644 --- a/src/css/styles.css +++ b/src/css/styles.css @@ -22,8 +22,9 @@ html { border-radius: 25px; font-size: 4em; display: flex; - justify-content: center; align-items: center; + flex-direction: column; + justify-content: flex-start; } .zero { diff --git a/src/scripts.js b/src/scripts.js index d3312e82a8..e403c6530d 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -113,12 +113,12 @@ function displaySleepHistory() { function loadPage() { getUser(sleep, hydration) - displayUserInfo() + // displayUserInfo() // displayStepGoal() displayWelcomeName() - displayWater() - displaySleep() - displaySleepHistory() + // displayWater() + // displaySleep() + // displaySleepHistory() makeCharts() } From b4014aa2592f1cbb4627659f3f748a247d7c767f Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sat, 10 Dec 2022 15:07:31 -0700 Subject: [PATCH 150/188] add step goal import --- src/charts.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/charts.js b/src/charts.js index 7ff87e856b..8fad721357 100644 --- a/src/charts.js +++ b/src/charts.js @@ -1,14 +1,15 @@ import Chart from 'chart.js/auto'; +// import displayStepGoal from './scripts' // Steps var xValues = ["Your Steps", "Steps Remaining"]; -var yValues = [55, 45]; +// var yValues = displayStepGoal(); var barColors = [ "#b91d47", "#00aba9", ]; const steps = document.getElementById('stepGoal'); -function makeCharts() { +function makeCharts(yValues) { new Chart(steps, { type: "doughnut", data: { From b97192ef2588ef54633b45e19a2db89ffca7c2d6 Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sat, 10 Dec 2022 15:08:11 -0700 Subject: [PATCH 151/188] add display step goal dynamic functioning --- src/scripts.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/scripts.js b/src/scripts.js index e403c6530d..af802c93bc 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -71,7 +71,12 @@ function displayWelcomeName() { } function displayStepGoal() { - stepGoalBox.innerText += ` Your step goal is ${currentUser.userData.dailyStepGoal} steps. The average step goal is ${users.stepGoalAverage()}.` + let currentUserStepGoal = currentUser.userData.dailyStepGoal + let allUsersStepGoal = users.stepGoalAverage() + let result = [currentUserStepGoal, allUsersStepGoal] + console.log(result) + return result + // stepGoalBox.innerText += ` Your step goal is ${currentUser.userData.dailyStepGoal} steps. The average step goal is ${users.stepGoalAverage()}.` } // Functions @@ -119,6 +124,8 @@ function loadPage() { // displayWater() // displaySleep() // displaySleepHistory() - makeCharts() + makeCharts(displayStepGoal()) } +// export default displayStepGoal; + From 2c198f3bc3642c6c6b56942bd81448177c661988 Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Sat, 10 Dec 2022 15:54:21 -0700 Subject: [PATCH 152/188] Add daily hydration chart --- src/charts.js | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/src/charts.js b/src/charts.js index 8fad721357..aa6490cc07 100644 --- a/src/charts.js +++ b/src/charts.js @@ -9,7 +9,7 @@ var barColors = [ "#00aba9", ]; const steps = document.getElementById('stepGoal'); -function makeCharts(yValues) { +function makeStepCharts(yValues) { new Chart(steps, { type: "doughnut", data: { @@ -22,10 +22,35 @@ function makeCharts(yValues) { options: { title: { display: true, - text: "World Wide Wine Production 2018" + text: "Today" } } }); } -export default makeCharts; \ No newline at end of file +var h20ChartKeys = ["Water Today", "H2O Goal"] +const dailyHydration = document.getElementById('dailyHydration') +function makeDailyH20Charts(yValues) { + new Chart(dailyHydration, { + type: "doughnut", + data: { + labels: ["Water Today", "H20 Goal"], + datasets: [{ + backgroundColor: barColors, + data: yValues + }] + }, + options: { + title: { + display: true, + text: "Today" + } + } + }); +} + +function loadCharts(stepYValues, dailyH2OYValues) { + makeStepCharts(stepYValues) + makeDailyH20Charts(dailyH2OYValues) +} +export default loadCharts; From 6295ed9e13a8c01936210830ee96216e701e2720 Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Sat, 10 Dec 2022 15:54:48 -0700 Subject: [PATCH 153/188] Add load charts function to scripts --- src/scripts.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/scripts.js b/src/scripts.js index af802c93bc..0854e62ded 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -1,9 +1,10 @@ // import './images/turing-logo.png' import './css/styles.css'; -import makeCharts from './charts'; +// import makeStepCharts from './charts'; import { getAPIData } from './apiCalls' import User from '../src/User'; import UserRepository from './UserRepository'; +import loadCharts from './charts'; // Global Variables // let one = 1 @@ -94,8 +95,12 @@ function getUserFriends() { } function displayWater() { - hydrationBox.innerText += `Your water intake for today is ${currentUser.getWaterPerDay('2019/06/15')} ounces` - hydrationInfoList.innerHTML += `
  • Your weekly water intake is ${currentUser.getWeeklyConsumption()} ounces
  • ` + let dailyWaterIntake = currentUser.getWaterPerDay('2019/06/15') + let dailyWaterGoal = 96 + let result = [dailyWaterIntake, dailyWaterGoal] + return result + // hydrationBox.innerText += `Your water intake for today is ${currentUser.getWaterPerDay('2019/06/15')} ounces` + // hydrationInfoList.innerHTML += `
  • Your weekly water intake is ${currentUser.getWeeklyConsumption()} ounces
  • ` } @@ -124,7 +129,7 @@ function loadPage() { // displayWater() // displaySleep() // displaySleepHistory() - makeCharts(displayStepGoal()) + loadCharts(displayStepGoal(), displayWater()) } // export default displayStepGoal; From 1ce11fc56a1635c867cc5fa708e8ed49fd8bba76 Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Sat, 10 Dec 2022 16:49:53 -0700 Subject: [PATCH 154/188] Split daily sleep info --- dist/index.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dist/index.html b/dist/index.html index ebe5ea170e..0c600ba80b 100644 --- a/dist/index.html +++ b/dist/index.html @@ -19,6 +19,8 @@

    Welcome

    Daily Sleep

    +

    Sleep Quality

    +

    Step Goal

    From 781d240b6fa81b3ad3bd5f35391d013100bd3d2d Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Sat, 10 Dec 2022 16:50:26 -0700 Subject: [PATCH 155/188] Add dailySleep chart function --- src/charts.js | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/charts.js b/src/charts.js index aa6490cc07..6971424128 100644 --- a/src/charts.js +++ b/src/charts.js @@ -2,7 +2,6 @@ import Chart from 'chart.js/auto'; // import displayStepGoal from './scripts' // Steps -var xValues = ["Your Steps", "Steps Remaining"]; // var yValues = displayStepGoal(); var barColors = [ "#b91d47", @@ -27,8 +26,7 @@ function makeStepCharts(yValues) { } }); } - -var h20ChartKeys = ["Water Today", "H2O Goal"] + const dailyHydration = document.getElementById('dailyHydration') function makeDailyH20Charts(yValues) { new Chart(dailyHydration, { @@ -49,8 +47,30 @@ function makeDailyH20Charts(yValues) { }); } -function loadCharts(stepYValues, dailyH2OYValues) { +const dailySleep = document.getElementById('dailySleep') +function dailySleepChart(yValues) { + new Chart(dailySleep, { + type: "doughnut", + data: { + labels: ["Hours Slept"], + datasets: [{ + backgroundColor: barColors, + data: yValues + }] + }, + options: { + title: { + display: true, + text: "Today" + } + } + }) +} + + +function loadCharts(stepYValues, dailyH2OYValues, yValues) { makeStepCharts(stepYValues) makeDailyH20Charts(dailyH2OYValues) + dailySleepChart(yValues) } export default loadCharts; From 5a3b089f84ed24f0945dfa8aed70e56a21e89200 Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Sat, 10 Dec 2022 16:50:44 -0700 Subject: [PATCH 156/188] Add data to widget on DOM --- src/scripts.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/scripts.js b/src/scripts.js index 0854e62ded..40359b4a1e 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -110,10 +110,13 @@ function displayWater() { // } function displaySleep() { - - sleepInfoList.innerHTML += `
  • Last night you slept ${currentUser.sleepOnSpecificDate('2019/06/15')} hours
  • -
  • The quality of your sleep last night was ${currentUser.sleepQualityOnSpecificDate('2019/06/15')} out of 5
  • -
  • Your weekly sleep pattern: ${currentUser.givenWeekSleepDataByDay()} - ${currentUser.givenWeeksSleepQualityByDay()}
  • ` + let dailySleep = currentUser.sleepOnSpecificDate('2019/06/15') + let maxSleep = 12 + let result = [dailySleep, maxSleep] + return result + // sleepInfoList.innerHTML += `
  • Last night you slept ${currentUser.sleepOnSpecificDate('2019/06/15')} hours
  • + //
  • The quality of your sleep last night was ${currentUser.sleepQualityOnSpecificDate('2019/06/15')} out of 5
  • + //
  • Your weekly sleep pattern: ${currentUser.givenWeekSleepDataByDay()} - ${currentUser.givenWeeksSleepQualityByDay()}
  • ` } function displaySleepHistory() { @@ -129,7 +132,7 @@ function loadPage() { // displayWater() // displaySleep() // displaySleepHistory() - loadCharts(displayStepGoal(), displayWater()) + loadCharts(displayStepGoal(), displayWater(), displaySleep()) } // export default displayStepGoal; From f62b9274ad93b4ef82cd584066bb268ba457fdf3 Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Sat, 10 Dec 2022 17:01:13 -0700 Subject: [PATCH 157/188] Refactor HTML ids --- dist/index.html | 2 +- src/charts.js | 25 ++++++++++++++++++++++--- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/dist/index.html b/dist/index.html index 0c600ba80b..2eac346a93 100644 --- a/dist/index.html +++ b/dist/index.html @@ -19,7 +19,7 @@

    Welcome

    Daily Sleep

    -

    Sleep Quality

    +

    Sleep Quality

    diff --git a/src/charts.js b/src/charts.js index 6971424128..53b1e5a1bb 100644 --- a/src/charts.js +++ b/src/charts.js @@ -67,10 +67,29 @@ function dailySleepChart(yValues) { }) } - -function loadCharts(stepYValues, dailyH2OYValues, yValues) { +const dailySleepQuality = document.getElementById('dailySleepQuality') +function dailySleepQualityChart(yValues) { + new Chart(dailySleepQuality, { + type: "doughnut", + data: { + labels: ["Quality of Sleep"], + datasets: [{ + backgroundColor: barColors, + data: yValues + }] + }, + options: { + title: { + display: true, + text: "Today" + } + } + }) +} +function loadCharts(stepYValues, dailyH2OYValues, sleepYValues, qualityYValues ) { makeStepCharts(stepYValues) makeDailyH20Charts(dailyH2OYValues) - dailySleepChart(yValues) + dailySleepChart(sleepYValues) + dailySleepQualityChart(qualityYValues) } export default loadCharts; From b5d8612c8e8cc55d0a55943f205f58f95aeb2334 Mon Sep 17 00:00:00 2001 From: Ciera DePauw <113853138+cieragrace@users.noreply.github.com> Date: Sat, 10 Dec 2022 17:01:46 -0700 Subject: [PATCH 158/188] Add sleep data to DOM --- src/scripts.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/scripts.js b/src/scripts.js index 40359b4a1e..26ba188924 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -119,6 +119,13 @@ function displaySleep() { //
  • Your weekly sleep pattern: ${currentUser.givenWeekSleepDataByDay()} - ${currentUser.givenWeeksSleepQualityByDay()}
  • ` } +function displaySleepQuality() { + let dailyQuality = currentUser.sleepQualityOnSpecificDate('2019/06/15') + let maxQuality = 5 + let result = [dailyQuality, maxQuality] + return result +} + function displaySleepHistory() { sleepHistoryList.innerHTML += `
  • Overall Sleep Hours: ${currentUser.getAverageDailySleep()} hours
  • Overall Sleep Quality: ${currentUser.getOverallQualityAvg()} out of 5
  • ` @@ -132,7 +139,7 @@ function loadPage() { // displayWater() // displaySleep() // displaySleepHistory() - loadCharts(displayStepGoal(), displayWater(), displaySleep()) + loadCharts(displayStepGoal(), displayWater(), displaySleep(), displaySleepQuality()) } // export default displayStepGoal; From 58f5d23490522050564ee565a042745048e82a70 Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sat, 10 Dec 2022 17:59:38 -0700 Subject: [PATCH 159/188] add avg sleep bar graph --- dist/index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dist/index.html b/dist/index.html index 2eac346a93..e3c3ba0763 100644 --- a/dist/index.html +++ b/dist/index.html @@ -6,6 +6,7 @@ + Fitlit @@ -35,7 +36,7 @@

    Hydration

    Sleep History

    - +

    Weekly Hydration

    From 7720008d9fea9b8cb28476021b1a0704be4d686f Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sat, 10 Dec 2022 18:00:16 -0700 Subject: [PATCH 160/188] add basic sleep info --- src/charts.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/charts.js b/src/charts.js index 53b1e5a1bb..39cb88e867 100644 --- a/src/charts.js +++ b/src/charts.js @@ -86,6 +86,30 @@ function dailySleepQualityChart(yValues) { } }) } + +var xValues = ['Day 1', 'Day 2', 'Day 3', 'Day 4', 'Day 5', 'Day 6', 'Day 7']; + +new Chart("myChart", { + type: "line", + data: { + labels: xValues, + datasets: [{ + data: [860,1140,1060,1060,1070,1110,1330,2210,7830,2478], + borderColor: "red", + fill: false + }, + { + data: [300,700,2000,5000,6000,4000,2000,1000,200,100], + borderColor: "blue", + fill: false + }] + }, + options: { + legend: {display: false} + } +}); + + function loadCharts(stepYValues, dailyH2OYValues, sleepYValues, qualityYValues ) { makeStepCharts(stepYValues) makeDailyH20Charts(dailyH2OYValues) From fdfa61fd4f75c692a3a0de24f31da459c93204fa Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sat, 10 Dec 2022 18:17:31 -0700 Subject: [PATCH 161/188] Add bar graph display --- src/charts.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/charts.js b/src/charts.js index 39cb88e867..477ac87b05 100644 --- a/src/charts.js +++ b/src/charts.js @@ -89,17 +89,19 @@ function dailySleepQualityChart(yValues) { var xValues = ['Day 1', 'Day 2', 'Day 3', 'Day 4', 'Day 5', 'Day 6', 'Day 7']; -new Chart("myChart", { +const sleepHistory = document.getElementById('sleepHistory') +function sleepHistoryBarGraph(userSleepHistory, userQualityHistory) { +new Chart("sleepHistory", { type: "line", data: { labels: xValues, datasets: [{ - data: [860,1140,1060,1060,1070,1110,1330,2210,7830,2478], + data: userSleepHistory, borderColor: "red", fill: false }, { - data: [300,700,2000,5000,6000,4000,2000,1000,200,100], + data: userQualityHistory, borderColor: "blue", fill: false }] @@ -108,12 +110,13 @@ new Chart("myChart", { legend: {display: false} } }); +} - -function loadCharts(stepYValues, dailyH2OYValues, sleepYValues, qualityYValues ) { +function loadCharts(stepYValues, dailyH2OYValues, sleepYValues, qualityYValues, userQualityHistory, userSleepHistory) { makeStepCharts(stepYValues) makeDailyH20Charts(dailyH2OYValues) dailySleepChart(sleepYValues) dailySleepQualityChart(qualityYValues) + sleepHistoryBarGraph(userSleepHistory, userQualityHistory) } export default loadCharts; From 722a830f6fffee4d18a9500350566915c713add7 Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sat, 10 Dec 2022 18:18:01 -0700 Subject: [PATCH 162/188] Add dynamic bar graph --- src/scripts.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/scripts.js b/src/scripts.js index 26ba188924..f989c89220 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -127,8 +127,13 @@ function displaySleepQuality() { } function displaySleepHistory() { - sleepHistoryList.innerHTML += `
  • Overall Sleep Hours: ${currentUser.getAverageDailySleep()} hours
  • -
  • Overall Sleep Quality: ${currentUser.getOverallQualityAvg()} out of 5
  • ` + // sleepHistoryList.innerHTML += `
  • Overall Sleep Hours: ${currentUser.getAverageDailySleep()} hours
  • + //
  • Overall Sleep Quality: ${currentUser.getOverallQualityAvg()} out of 5
  • ` + let avgSleep = currentUser.getAverageDailySleep() + let avgQuality = currentUser.getOverallQualityAvg() + // let maxQuality = 5 + let result = [avgSleep, avgQuality] + return result } function loadPage() { @@ -139,7 +144,7 @@ function loadPage() { // displayWater() // displaySleep() // displaySleepHistory() - loadCharts(displayStepGoal(), displayWater(), displaySleep(), displaySleepQuality()) + loadCharts(displayStepGoal(), displayWater(), displaySleep(), displaySleepQuality(), displaySleepHistory()) } // export default displayStepGoal; From 64d9d1fa798e54e42419724169d37b4d3661bb3e Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sat, 10 Dec 2022 19:02:07 -0700 Subject: [PATCH 163/188] add avg user sleep function --- src/charts.js | 2 +- src/scripts.js | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/charts.js b/src/charts.js index 477ac87b05..2794d5097e 100644 --- a/src/charts.js +++ b/src/charts.js @@ -112,7 +112,7 @@ new Chart("sleepHistory", { }); } -function loadCharts(stepYValues, dailyH2OYValues, sleepYValues, qualityYValues, userQualityHistory, userSleepHistory) { +function loadCharts(stepYValues, dailyH2OYValues, sleepYValues, qualityYValues, userSleepHistory, userQualityHistory) { makeStepCharts(stepYValues) makeDailyH20Charts(dailyH2OYValues) dailySleepChart(sleepYValues) diff --git a/src/scripts.js b/src/scripts.js index f989c89220..2d30783fdc 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -133,9 +133,22 @@ function displaySleepHistory() { let avgQuality = currentUser.getOverallQualityAvg() // let maxQuality = 5 let result = [avgSleep, avgQuality] + console.log('sleep history result', result) return result } +// function displayLast7DaysSleep() { +// let weeklySleepAndDate = currentUser.givenWeekSleepDataByDay() +// let weeklySleep = weeklySleepAndDate.map((current, index) => { +// console.log(current) +// }) +// console.log('weekly sleep', weeklySleep) +// return weeklySleep +// } +// currentUser.givenWeekSleepDataByDay() returns an array of objects +// Each object has a dynamic key of a date and dynamic value of sleep hours +// We need to return/access only the values/hours + function loadPage() { getUser(sleep, hydration) // displayUserInfo() @@ -144,7 +157,7 @@ function loadPage() { // displayWater() // displaySleep() // displaySleepHistory() - loadCharts(displayStepGoal(), displayWater(), displaySleep(), displaySleepQuality(), displaySleepHistory()) + loadCharts(displayStepGoal(), displayWater(), displaySleep(), displaySleepQuality(), displayLast7DaysSleep(), displayLast7DaysQuality()) } // export default displayStepGoal; From fc3125f6de0dfde3311ecb3660825fb1ce7a2e25 Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sun, 11 Dec 2022 09:06:23 -0700 Subject: [PATCH 164/188] Add labels to sleep graph --- src/charts.js | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/src/charts.js b/src/charts.js index 2794d5097e..1cc2b5d23a 100644 --- a/src/charts.js +++ b/src/charts.js @@ -26,7 +26,7 @@ function makeStepCharts(yValues) { } }); } - + const dailyHydration = document.getElementById('dailyHydration') function makeDailyH20Charts(yValues) { new Chart(dailyHydration, { @@ -66,7 +66,7 @@ function dailySleepChart(yValues) { } }) } - + const dailySleepQuality = document.getElementById('dailySleepQuality') function dailySleepQualityChart(yValues) { new Chart(dailySleepQuality, { @@ -91,25 +91,27 @@ var xValues = ['Day 1', 'Day 2', 'Day 3', 'Day 4', 'Day 5', 'Day 6', 'Day 7']; const sleepHistory = document.getElementById('sleepHistory') function sleepHistoryBarGraph(userSleepHistory, userQualityHistory) { -new Chart("sleepHistory", { - type: "line", - data: { - labels: xValues, - datasets: [{ - data: userSleepHistory, - borderColor: "red", - fill: false - }, - { - data: userQualityHistory, - borderColor: "blue", - fill: false - }] - }, - options: { - legend: {display: false} - } -}); + new Chart("sleepHistory", { + type: "line", + data: { + labels: xValues, + datasets: [{ + label: 'Hours Slept', + data: userSleepHistory, + borderColor: "red", + fill: false + }, + { + label: 'Sleep Quality', + data: userQualityHistory, + borderColor: "blue", + fill: false + }] + }, + options: { + legend: { display: false } + } + }); } function loadCharts(stepYValues, dailyH2OYValues, sleepYValues, qualityYValues, userSleepHistory, userQualityHistory) { From c0b6562733bd72147d84e79ab8bd3d839323375b Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sun, 11 Dec 2022 09:06:46 -0700 Subject: [PATCH 165/188] Complete sleep display functions --- src/scripts.js | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/scripts.js b/src/scripts.js index 2d30783fdc..65fe78a52a 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -137,18 +137,25 @@ function displaySleepHistory() { return result } -// function displayLast7DaysSleep() { -// let weeklySleepAndDate = currentUser.givenWeekSleepDataByDay() -// let weeklySleep = weeklySleepAndDate.map((current, index) => { -// console.log(current) -// }) -// console.log('weekly sleep', weeklySleep) -// return weeklySleep -// } +function displayLast7DaysSleep() { + let weeklySleepAndDate = currentUser.givenWeekSleepDataByDay() + let weeklySleep = weeklySleepAndDate.map(current => Object.values(current)[0]) + return weeklySleep + // console.log('weekly sleep', weeklySleep) + // return weeklySleep +} // currentUser.givenWeekSleepDataByDay() returns an array of objects // Each object has a dynamic key of a date and dynamic value of sleep hours // We need to return/access only the values/hours +function displayLast7DaysQuality() { + let weeklyQualityAndDate = currentUser.givenWeeksSleepQualityByDay() + let weeklyQuality = weeklyQualityAndDate.map(current => Object.values(current)[0]) + return weeklyQuality + // console.log('weekly sleep', weeklySleep) + // return weeklySleep +} + function loadPage() { getUser(sleep, hydration) // displayUserInfo() From 6faef16128290784df0ad53f10dc0b7a13d76c8e Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sun, 11 Dec 2022 09:29:49 -0700 Subject: [PATCH 166/188] add unordered list to user info --- dist/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/dist/index.html b/dist/index.html index e3c3ba0763..cbe3ee83fc 100644 --- a/dist/index.html +++ b/dist/index.html @@ -29,6 +29,7 @@

    Step Goal

    Your Info

    +

      Hydration

      From 8b170dd146f0eda8bcf2401ee338f89e6a9679f0 Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sun, 11 Dec 2022 09:30:21 -0700 Subject: [PATCH 167/188] replace displayUserInfo function --- src/scripts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts.js b/src/scripts.js index 65fe78a52a..a8529f030c 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -158,7 +158,7 @@ function displayLast7DaysQuality() { function loadPage() { getUser(sleep, hydration) - // displayUserInfo() + displayUserInfo() // displayStepGoal() displayWelcomeName() // displayWater() From 30d1d02392ea904211582137de43dea74f48efc5 Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sun, 11 Dec 2022 09:41:53 -0700 Subject: [PATCH 168/188] add weekly hydration id --- dist/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/index.html b/dist/index.html index cbe3ee83fc..8a229ec6c0 100644 --- a/dist/index.html +++ b/dist/index.html @@ -41,7 +41,7 @@

      Sleep History

      Weekly Hydration

      - +
      From cd96f2d5b86bb250214d19f7c0dcbd5c13e22819 Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sun, 11 Dec 2022 09:42:26 -0700 Subject: [PATCH 169/188] add weekly hydration function --- src/charts.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/charts.js b/src/charts.js index 1cc2b5d23a..0aa0023ff1 100644 --- a/src/charts.js +++ b/src/charts.js @@ -114,11 +114,33 @@ function sleepHistoryBarGraph(userSleepHistory, userQualityHistory) { }); } -function loadCharts(stepYValues, dailyH2OYValues, sleepYValues, qualityYValues, userSleepHistory, userQualityHistory) { +var xValues = ['Day 1', 'Day 2', 'Day 3', 'Day 4', 'Day 5', 'Day 6', 'Day 7']; + +const hydrationHistory = document.getElementById('weeklyHydration') +function hydrationBarGraph(hydrationByDay) { + new Chart("weeklyHydration", { + type: "line", + data: { + labels: xValues, + datasets: [{ + label: 'Hydration by Day', + data: hydrationByDay, + borderColor: "blue", + fill: false + },] + }, + options: { + legend: { display: false } + } + }); +} + +function loadCharts(stepYValues, dailyH2OYValues, sleepYValues, qualityYValues, userSleepHistory, userQualityHistory, hydrationByDay) { makeStepCharts(stepYValues) makeDailyH20Charts(dailyH2OYValues) dailySleepChart(sleepYValues) dailySleepQualityChart(qualityYValues) sleepHistoryBarGraph(userSleepHistory, userQualityHistory) + hydrationBarGraph(hydrationByDay) } export default loadCharts; From aa195dff9a40f8da1c76c79683c423c2b0f4d066 Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sun, 11 Dec 2022 09:43:01 -0700 Subject: [PATCH 170/188] add weekly hydration page load function to DOM --- src/scripts.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/scripts.js b/src/scripts.js index a8529f030c..3e0c978f0a 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -156,6 +156,12 @@ function displayLast7DaysQuality() { // return weeklySleep } +function displayLast7DaysHydration() { + let weeklyHydration = currentUser.getWeeklyConsumption() + let weeklyWater = weeklyHydration.map(current => Object.values(current)[0]) + return weeklyWater +} + function loadPage() { getUser(sleep, hydration) displayUserInfo() @@ -164,7 +170,7 @@ function loadPage() { // displayWater() // displaySleep() // displaySleepHistory() - loadCharts(displayStepGoal(), displayWater(), displaySleep(), displaySleepQuality(), displayLast7DaysSleep(), displayLast7DaysQuality()) + loadCharts(displayStepGoal(), displayWater(), displaySleep(), displaySleepQuality(), displayLast7DaysSleep(), displayLast7DaysQuality(), displayLast7DaysHydration()) } // export default displayStepGoal; From c8e78f992a8eef471487dcf464121fcbdd9e66de Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sun, 11 Dec 2022 10:07:05 -0700 Subject: [PATCH 171/188] add allTimeSleepHistory function --- src/charts.js | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/charts.js b/src/charts.js index 0aa0023ff1..800956c2a1 100644 --- a/src/charts.js +++ b/src/charts.js @@ -135,12 +135,38 @@ function hydrationBarGraph(hydrationByDay) { }); } -function loadCharts(stepYValues, dailyH2OYValues, sleepYValues, qualityYValues, userSleepHistory, userQualityHistory, hydrationByDay) { +const labels = ['All-Time Avg. Sleep Quality (1-5)', 'All-Time Avg. Sleep Duration'] + +let allTimeSleepData = document.getElementById('allTimeSleepHistory') +function allTimeSleepQuality(allTimeSleep) { + new Chart("allTimeSleepHistory", { + type: "bar", + data: { + labels: labels, + datasets: [{ + label: 'All-Time Sleep History', + data: allTimeSleep, + backgroundColor: [ + 'rgba(153, 102, 255, 0.2)', + 'rgba(201, 203, 207, 0.2)' + ], + borderColor: [ + 'rgb(255, 99, 132)', + 'rgb(255, 159, 64)', + ], + borderWidth: 1 + }] + } + }) +} + +function loadCharts(stepYValues, dailyH2OYValues, sleepYValues, qualityYValues, userSleepHistory, userQualityHistory, hydrationByDay, allTimeSleep) { makeStepCharts(stepYValues) makeDailyH20Charts(dailyH2OYValues) dailySleepChart(sleepYValues) dailySleepQualityChart(qualityYValues) sleepHistoryBarGraph(userSleepHistory, userQualityHistory) hydrationBarGraph(hydrationByDay) + allTimeSleepQuality(allTimeSleep) } export default loadCharts; From 2d3b097ed970dd4bd346d39325c69f67aad816a0 Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sun, 11 Dec 2022 10:08:04 -0700 Subject: [PATCH 172/188] add new canvas for all time sleep data --- dist/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/dist/index.html b/dist/index.html index 8a229ec6c0..1affa91bb0 100644 --- a/dist/index.html +++ b/dist/index.html @@ -38,6 +38,7 @@

      Hydration

      Sleep History

      +

      Weekly Hydration

      From d68a2852a6751f58d7abdb0ccd0e7bc01dd6571a Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sun, 11 Dec 2022 10:35:37 -0700 Subject: [PATCH 173/188] refactor graph display ranges --- src/scripts.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/scripts.js b/src/scripts.js index 3e0c978f0a..220c361383 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -73,7 +73,7 @@ function displayWelcomeName() { function displayStepGoal() { let currentUserStepGoal = currentUser.userData.dailyStepGoal - let allUsersStepGoal = users.stepGoalAverage() + let allUsersStepGoal = users.stepGoalAverage() - currentUserStepGoal let result = [currentUserStepGoal, allUsersStepGoal] console.log(result) return result @@ -96,7 +96,7 @@ function getUserFriends() { function displayWater() { let dailyWaterIntake = currentUser.getWaterPerDay('2019/06/15') - let dailyWaterGoal = 96 + let dailyWaterGoal = 96 - dailyWaterIntake let result = [dailyWaterIntake, dailyWaterGoal] return result // hydrationBox.innerText += `Your water intake for today is ${currentUser.getWaterPerDay('2019/06/15')} ounces` @@ -111,7 +111,7 @@ function displayWater() { function displaySleep() { let dailySleep = currentUser.sleepOnSpecificDate('2019/06/15') - let maxSleep = 12 + let maxSleep = 12 - dailySleep let result = [dailySleep, maxSleep] return result // sleepInfoList.innerHTML += `
    • Last night you slept ${currentUser.sleepOnSpecificDate('2019/06/15')} hours
    • @@ -121,7 +121,7 @@ function displaySleep() { function displaySleepQuality() { let dailyQuality = currentUser.sleepQualityOnSpecificDate('2019/06/15') - let maxQuality = 5 + let maxQuality = 5 - dailyQuality let result = [dailyQuality, maxQuality] return result } @@ -162,6 +162,15 @@ function displayLast7DaysHydration() { return weeklyWater } +function displayAllTimeSleepData() { + let allTimeSleepQualityAvg = currentUser.getOverallQualityAvg() + let allTimeSleepDurationAvg = currentUser.getAverageDailySleep() + console.log(allTimeSleepDurationAvg) + let result = [allTimeSleepQualityAvg, allTimeSleepDurationAvg] + console.log('alltime sleep data', result) + return result +} + function loadPage() { getUser(sleep, hydration) displayUserInfo() @@ -170,7 +179,7 @@ function loadPage() { // displayWater() // displaySleep() // displaySleepHistory() - loadCharts(displayStepGoal(), displayWater(), displaySleep(), displaySleepQuality(), displayLast7DaysSleep(), displayLast7DaysQuality(), displayLast7DaysHydration()) + loadCharts(displayStepGoal(), displayWater(), displaySleep(), displaySleepQuality(), displayLast7DaysSleep(), displayLast7DaysQuality(), displayLast7DaysHydration(), displayAllTimeSleepData()) } // export default displayStepGoal; From 258883f2559e837be2d2ec40148f8533639e7c38 Mon Sep 17 00:00:00 2001 From: Craig Weller Date: Sun, 11 Dec 2022 10:45:44 -0700 Subject: [PATCH 174/188] refactor charts for sleep history function --- src/charts.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/charts.js b/src/charts.js index 800956c2a1..02a4d22a4d 100644 --- a/src/charts.js +++ b/src/charts.js @@ -144,11 +144,11 @@ function allTimeSleepQuality(allTimeSleep) { data: { labels: labels, datasets: [{ - label: 'All-Time Sleep History', + label: 'Sleep History', data: allTimeSleep, backgroundColor: [ - 'rgba(153, 102, 255, 0.2)', - 'rgba(201, 203, 207, 0.2)' + 'blue', + 'red' ], borderColor: [ 'rgb(255, 99, 132)', From aca6330a59058d5869a63b1b9ef36836080f7cb2 Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sun, 11 Dec 2022 11:08:00 -0700 Subject: [PATCH 175/188] Delete all scripts console logs --- src/scripts.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/scripts.js b/src/scripts.js index 220c361383..dff91ac53a 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -75,7 +75,6 @@ function displayStepGoal() { let currentUserStepGoal = currentUser.userData.dailyStepGoal let allUsersStepGoal = users.stepGoalAverage() - currentUserStepGoal let result = [currentUserStepGoal, allUsersStepGoal] - console.log(result) return result // stepGoalBox.innerText += ` Your step goal is ${currentUser.userData.dailyStepGoal} steps. The average step goal is ${users.stepGoalAverage()}.` } @@ -133,7 +132,6 @@ function displaySleepHistory() { let avgQuality = currentUser.getOverallQualityAvg() // let maxQuality = 5 let result = [avgSleep, avgQuality] - console.log('sleep history result', result) return result } @@ -165,9 +163,7 @@ function displayLast7DaysHydration() { function displayAllTimeSleepData() { let allTimeSleepQualityAvg = currentUser.getOverallQualityAvg() let allTimeSleepDurationAvg = currentUser.getAverageDailySleep() - console.log(allTimeSleepDurationAvg) let result = [allTimeSleepQualityAvg, allTimeSleepDurationAvg] - console.log('alltime sleep data', result) return result } From 8c2ea16d667e6df0532553ad7e43cf80161f4987 Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sun, 11 Dec 2022 11:16:37 -0700 Subject: [PATCH 176/188] Delete all comments on scripts.js --- src/scripts.js | 163 +++++++++++++++---------------------------------- 1 file changed, 49 insertions(+), 114 deletions(-) diff --git a/src/scripts.js b/src/scripts.js index dff91ac53a..14ce34d48f 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -1,64 +1,35 @@ -// import './images/turing-logo.png' import './css/styles.css'; -// import makeStepCharts from './charts'; -import { getAPIData } from './apiCalls' +import { getAPIData } from './apiCalls'; import User from '../src/User'; import UserRepository from './UserRepository'; import loadCharts from './charts'; // Global Variables -// let one = 1 -let users -let sleep -let hydration -let currentUser - -// const userRepository = new UserRepository(userData) -// -// console.log(userRepository) +let users; +let sleep; +let hydration; +let currentUser; //Query Selectors -let sleepBox = document.querySelector('.zero') -let stepGoalBox = document.querySelector('#step-text') -let infoBox = document.querySelector('.two') -//let activityBox = document.querySelector('.three') -let sleepHistoryBox = document.querySelector('.four') -let hydrationBox = document.querySelector('.three') -let activityTrackerTitle = document.querySelector('h1') -let userInfoList = document.querySelector("#userInfoList") -let hydrationInfoList = document.querySelector("#hydrationInfoList") -let sleepInfoList = document.querySelector("#sleepInfoList") -let sleepHistoryList = document.querySelector("#sleepHistoryList") +let activityTrackerTitle = document.querySelector('h1'); +let userInfoList = document.querySelector("#userInfoList"); // Event Listeners -window.addEventListener('load', getAllData) -// window.addEventListener('load', displayUserInfo) -// infoBox.addEventListener('click', ) -// hydrationBox.addEventListener('click', ) -// window.addEventListener('load', stepGoalDisplay) -// activityBox.addEventListener('click', ) -// friendsBox.addEventListener('click', ) -// sleepBox.addEventListener('click', ) -// window.addEventListener('load', displayWelcomeName) - +window.addEventListener('load', getAllData); //Event Handlers function getAllData() { Promise.all([getAPIData('users'), getAPIData('sleep'), getAPIData('hydration')]) .then((data) => { - users = new UserRepository(data[0]) - sleep = data[1] - hydration = data[2] - loadPage() - // console.log('hydration', hydration) - // console.log('users', users) - // console.log('currentUser', currentUser) + users = new UserRepository(data[0]); + sleep = data[1]; + hydration = data[2]; + loadPage(); }) .catch(err => console.log('To err is human', err)) } function displayUserInfo() { - // getAllData() userInfoList.innerHTML += `
    • ${currentUser.userData.name}
    • ${currentUser.userData.address}
    • ${currentUser.userData.email}
    • @@ -68,15 +39,14 @@ function displayUserInfo() { } function displayWelcomeName() { - activityTrackerTitle.innerText += ` ${currentUser.getFirstName()}` + activityTrackerTitle.innerText += ` ${currentUser.getFirstName()}`; } function displayStepGoal() { - let currentUserStepGoal = currentUser.userData.dailyStepGoal - let allUsersStepGoal = users.stepGoalAverage() - currentUserStepGoal - let result = [currentUserStepGoal, allUsersStepGoal] - return result - // stepGoalBox.innerText += ` Your step goal is ${currentUser.userData.dailyStepGoal} steps. The average step goal is ${users.stepGoalAverage()}.` + let currentUserStepGoal = currentUser.userData.dailyStepGoal; + let allUsersStepGoal = users.stepGoalAverage() - currentUserStepGoal; + let result = [currentUserStepGoal, allUsersStepGoal]; + return result; } // Functions @@ -88,95 +58,60 @@ function getUser(sleep, hydration) { function getUserFriends() { let friendsArray = currentUser.userData.friends.map(friend => { - return users.getData(friend).name + return users.getData(friend).name; }) - return friendsArray.join(', ') + return friendsArray.join(', '); } function displayWater() { - let dailyWaterIntake = currentUser.getWaterPerDay('2019/06/15') - let dailyWaterGoal = 96 - dailyWaterIntake - let result = [dailyWaterIntake, dailyWaterGoal] - return result - // hydrationBox.innerText += `Your water intake for today is ${currentUser.getWaterPerDay('2019/06/15')} ounces` - // hydrationInfoList.innerHTML += `
    • Your weekly water intake is ${currentUser.getWeeklyConsumption()} ounces
    • ` - + let dailyWaterIntake = currentUser.getWaterPerDay('2019/06/15'); + let dailyWaterGoal = 96 - dailyWaterIntake; + let result = [dailyWaterIntake, dailyWaterGoal]; + return result; } -// function showOverallSleep() { -// currentUser.sleepOnSpecificDate() -// currentUser.sleepQualityOnSpecificDate() -// } - function displaySleep() { - let dailySleep = currentUser.sleepOnSpecificDate('2019/06/15') - let maxSleep = 12 - dailySleep - let result = [dailySleep, maxSleep] - return result - // sleepInfoList.innerHTML += `
    • Last night you slept ${currentUser.sleepOnSpecificDate('2019/06/15')} hours
    • - //
    • The quality of your sleep last night was ${currentUser.sleepQualityOnSpecificDate('2019/06/15')} out of 5
    • - //
    • Your weekly sleep pattern: ${currentUser.givenWeekSleepDataByDay()} - ${currentUser.givenWeeksSleepQualityByDay()}
    • ` + let dailySleep = currentUser.sleepOnSpecificDate('2019/06/15'); + let maxSleep = 12 - dailySleep; + let result = [dailySleep, maxSleep]; + return result; } function displaySleepQuality() { - let dailyQuality = currentUser.sleepQualityOnSpecificDate('2019/06/15') - let maxQuality = 5 - dailyQuality - let result = [dailyQuality, maxQuality] - return result -} - -function displaySleepHistory() { - // sleepHistoryList.innerHTML += `
    • Overall Sleep Hours: ${currentUser.getAverageDailySleep()} hours
    • - //
    • Overall Sleep Quality: ${currentUser.getOverallQualityAvg()} out of 5
    • ` - let avgSleep = currentUser.getAverageDailySleep() - let avgQuality = currentUser.getOverallQualityAvg() - // let maxQuality = 5 - let result = [avgSleep, avgQuality] - return result + let dailyQuality = currentUser.sleepQualityOnSpecificDate('2019/06/15'); + let maxQuality = 5 - dailyQuality; + let result = [dailyQuality, maxQuality]; + return result; } function displayLast7DaysSleep() { - let weeklySleepAndDate = currentUser.givenWeekSleepDataByDay() - let weeklySleep = weeklySleepAndDate.map(current => Object.values(current)[0]) - return weeklySleep - // console.log('weekly sleep', weeklySleep) - // return weeklySleep + let weeklySleepAndDate = currentUser.givenWeekSleepDataByDay(); + let weeklySleep = weeklySleepAndDate.map(current => Object.values(current)[0]); + return weeklySleep; } -// currentUser.givenWeekSleepDataByDay() returns an array of objects -// Each object has a dynamic key of a date and dynamic value of sleep hours -// We need to return/access only the values/hours function displayLast7DaysQuality() { - let weeklyQualityAndDate = currentUser.givenWeeksSleepQualityByDay() - let weeklyQuality = weeklyQualityAndDate.map(current => Object.values(current)[0]) - return weeklyQuality - // console.log('weekly sleep', weeklySleep) - // return weeklySleep + let weeklyQualityAndDate = currentUser.givenWeeksSleepQualityByDay(); + let weeklyQuality = weeklyQualityAndDate.map(current => Object.values(current)[0]); + return weeklyQuality; } function displayLast7DaysHydration() { - let weeklyHydration = currentUser.getWeeklyConsumption() - let weeklyWater = weeklyHydration.map(current => Object.values(current)[0]) - return weeklyWater + let weeklyHydration = currentUser.getWeeklyConsumption(); + let weeklyWater = weeklyHydration.map(current => Object.values(current)[0]); + return weeklyWater; } function displayAllTimeSleepData() { - let allTimeSleepQualityAvg = currentUser.getOverallQualityAvg() - let allTimeSleepDurationAvg = currentUser.getAverageDailySleep() - let result = [allTimeSleepQualityAvg, allTimeSleepDurationAvg] - return result + let allTimeSleepQualityAvg = currentUser.getOverallQualityAvg(); + let allTimeSleepDurationAvg = currentUser.getAverageDailySleep(); + let result = [allTimeSleepQualityAvg, allTimeSleepDurationAvg]; + return result; } function loadPage() { - getUser(sleep, hydration) - displayUserInfo() - // displayStepGoal() - displayWelcomeName() - // displayWater() - // displaySleep() - // displaySleepHistory() - loadCharts(displayStepGoal(), displayWater(), displaySleep(), displaySleepQuality(), displayLast7DaysSleep(), displayLast7DaysQuality(), displayLast7DaysHydration(), displayAllTimeSleepData()) -} - -// export default displayStepGoal; - + getUser(sleep, hydration); + displayUserInfo(); + displayWelcomeName(); + loadCharts(displayStepGoal(), displayWater(), displaySleep(), displaySleepQuality(), displayLast7DaysSleep(), displayLast7DaysQuality(), displayLast7DaysHydration(), displayAllTimeSleepData()); +} \ No newline at end of file From 8de4136b05f4e40f81647c037649dc00a7d9432b Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sun, 11 Dec 2022 11:35:04 -0700 Subject: [PATCH 177/188] Refactor scripts.js functions --- src/scripts.js | 56 ++++++++++++++++++++++---------------------------- 1 file changed, 25 insertions(+), 31 deletions(-) diff --git a/src/scripts.js b/src/scripts.js index 14ce34d48f..c5875c9642 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -43,10 +43,7 @@ function displayWelcomeName() { } function displayStepGoal() { - let currentUserStepGoal = currentUser.userData.dailyStepGoal; - let allUsersStepGoal = users.stepGoalAverage() - currentUserStepGoal; - let result = [currentUserStepGoal, allUsersStepGoal]; - return result; + return [currentUser.userData.dailyStepGoal, (users.stepGoalAverage() - currentUser.userData.dailyStepGoal)]; } // Functions @@ -57,61 +54,58 @@ function getUser(sleep, hydration) { } function getUserFriends() { - let friendsArray = currentUser.userData.friends.map(friend => { - return users.getData(friend).name; - }) - return friendsArray.join(', '); + return currentUser.userData.friends + .map(friend => users.getData(friend).name) + .join(', ') } function displayWater() { let dailyWaterIntake = currentUser.getWaterPerDay('2019/06/15'); - let dailyWaterGoal = 96 - dailyWaterIntake; - let result = [dailyWaterIntake, dailyWaterGoal]; - return result; + return [dailyWaterIntake, 96 - dailyWaterIntake]; } function displaySleep() { let dailySleep = currentUser.sleepOnSpecificDate('2019/06/15'); - let maxSleep = 12 - dailySleep; - let result = [dailySleep, maxSleep]; - return result; + return [dailySleep, 12 - dailySleep]; } function displaySleepQuality() { let dailyQuality = currentUser.sleepQualityOnSpecificDate('2019/06/15'); - let maxQuality = 5 - dailyQuality; - let result = [dailyQuality, maxQuality]; - return result; + return [dailyQuality, 5 - dailyQuality]; } function displayLast7DaysSleep() { - let weeklySleepAndDate = currentUser.givenWeekSleepDataByDay(); - let weeklySleep = weeklySleepAndDate.map(current => Object.values(current)[0]); - return weeklySleep; + return currentUser + .givenWeekSleepDataByDay() + .map(current => Object.values(current)[0]) } function displayLast7DaysQuality() { - let weeklyQualityAndDate = currentUser.givenWeeksSleepQualityByDay(); - let weeklyQuality = weeklyQualityAndDate.map(current => Object.values(current)[0]); - return weeklyQuality; + return currentUser + .givenWeeksSleepQualityByDay() + .map(current => Object.values(current)[0]) } function displayLast7DaysHydration() { - let weeklyHydration = currentUser.getWeeklyConsumption(); - let weeklyWater = weeklyHydration.map(current => Object.values(current)[0]); - return weeklyWater; + return currentUser + .getWeeklyConsumption() + .map(current => Object.values(current)[0]) } function displayAllTimeSleepData() { - let allTimeSleepQualityAvg = currentUser.getOverallQualityAvg(); - let allTimeSleepDurationAvg = currentUser.getAverageDailySleep(); - let result = [allTimeSleepQualityAvg, allTimeSleepDurationAvg]; - return result; + return [currentUser.getOverallQualityAvg(), currentUser.getAverageDailySleep()]; } function loadPage() { getUser(sleep, hydration); displayUserInfo(); displayWelcomeName(); - loadCharts(displayStepGoal(), displayWater(), displaySleep(), displaySleepQuality(), displayLast7DaysSleep(), displayLast7DaysQuality(), displayLast7DaysHydration(), displayAllTimeSleepData()); + loadCharts(displayStepGoal(), + displayWater(), + displaySleep(), + displaySleepQuality(), + displayLast7DaysSleep(), + displayLast7DaysQuality(), + displayLast7DaysHydration(), + displayAllTimeSleepData()); } \ No newline at end of file From f1167c99045fec1a7b48ad83b399df52028d1cfc Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sun, 11 Dec 2022 11:56:13 -0700 Subject: [PATCH 178/188] Refactor charts.js functions --- src/charts.js | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/src/charts.js b/src/charts.js index 02a4d22a4d..607704c334 100644 --- a/src/charts.js +++ b/src/charts.js @@ -3,13 +3,17 @@ import Chart from 'chart.js/auto'; // Steps // var yValues = displayStepGoal(); -var barColors = [ +const barColors = [ "#b91d47", "#00aba9", ]; -const steps = document.getElementById('stepGoal'); + +const xValues = ['Day 1', 'Day 2', 'Day 3', 'Day 4', 'Day 5', 'Day 6', 'Day 7']; +const labels = ['All-Time Avg. Sleep Quality (1-5)', 'All-Time Avg. Sleep Duration']; + +//const steps = document.getElementById('stepGoal'); function makeStepCharts(yValues) { - new Chart(steps, { + new Chart('stepGoal', { type: "doughnut", data: { labels: ["Your Steps", "Steps Remaining"], @@ -27,9 +31,9 @@ function makeStepCharts(yValues) { }); } -const dailyHydration = document.getElementById('dailyHydration') +//const dailyHydration = document.getElementById('dailyHydration') function makeDailyH20Charts(yValues) { - new Chart(dailyHydration, { + new Chart('dailyHydration', { type: "doughnut", data: { labels: ["Water Today", "H20 Goal"], @@ -47,9 +51,9 @@ function makeDailyH20Charts(yValues) { }); } -const dailySleep = document.getElementById('dailySleep') +//const dailySleep = document.getElementById('dailySleep') function dailySleepChart(yValues) { - new Chart(dailySleep, { + new Chart('dailySleep', { type: "doughnut", data: { labels: ["Hours Slept"], @@ -67,9 +71,9 @@ function dailySleepChart(yValues) { }) } -const dailySleepQuality = document.getElementById('dailySleepQuality') +//const dailySleepQuality = document.getElementById('dailySleepQuality') function dailySleepQualityChart(yValues) { - new Chart(dailySleepQuality, { + new Chart('dailySleepQuality', { type: "doughnut", data: { labels: ["Quality of Sleep"], @@ -87,11 +91,11 @@ function dailySleepQualityChart(yValues) { }) } -var xValues = ['Day 1', 'Day 2', 'Day 3', 'Day 4', 'Day 5', 'Day 6', 'Day 7']; -const sleepHistory = document.getElementById('sleepHistory') + +//const sleepHistory = document.getElementById('sleepHistory') function sleepHistoryBarGraph(userSleepHistory, userQualityHistory) { - new Chart("sleepHistory", { + new Chart('sleepHistory', { type: "line", data: { labels: xValues, @@ -114,11 +118,11 @@ function sleepHistoryBarGraph(userSleepHistory, userQualityHistory) { }); } -var xValues = ['Day 1', 'Day 2', 'Day 3', 'Day 4', 'Day 5', 'Day 6', 'Day 7']; +//var xValues = ['Day 1', 'Day 2', 'Day 3', 'Day 4', 'Day 5', 'Day 6', 'Day 7']; -const hydrationHistory = document.getElementById('weeklyHydration') +//const hydrationHistory = document.getElementById('weeklyHydration') function hydrationBarGraph(hydrationByDay) { - new Chart("weeklyHydration", { + new Chart('weeklyHydration', { type: "line", data: { labels: xValues, @@ -135,11 +139,11 @@ function hydrationBarGraph(hydrationByDay) { }); } -const labels = ['All-Time Avg. Sleep Quality (1-5)', 'All-Time Avg. Sleep Duration'] -let allTimeSleepData = document.getElementById('allTimeSleepHistory') + +//let allTimeSleepData = document.getElementById('allTimeSleepHistory') function allTimeSleepQuality(allTimeSleep) { - new Chart("allTimeSleepHistory", { + new Chart('allTimeSleepHistory', { type: "bar", data: { labels: labels, @@ -169,4 +173,5 @@ function loadCharts(stepYValues, dailyH2OYValues, sleepYValues, qualityYValues, hydrationBarGraph(hydrationByDay) allTimeSleepQuality(allTimeSleep) } -export default loadCharts; + +export default loadCharts; \ No newline at end of file From 4ae64a35cb99395d926b4570a748e3bf8a8f601c Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sun, 11 Dec 2022 11:59:08 -0700 Subject: [PATCH 179/188] Delete all charts.js comments --- src/charts.js | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/src/charts.js b/src/charts.js index 607704c334..9e43f7612a 100644 --- a/src/charts.js +++ b/src/charts.js @@ -1,17 +1,11 @@ import Chart from 'chart.js/auto'; -// import displayStepGoal from './scripts' - -// Steps -// var yValues = displayStepGoal(); -const barColors = [ - "#b91d47", - "#00aba9", -]; +//Global Variables +const barColors = ["#b91d47", "#00aba9",]; const xValues = ['Day 1', 'Day 2', 'Day 3', 'Day 4', 'Day 5', 'Day 6', 'Day 7']; const labels = ['All-Time Avg. Sleep Quality (1-5)', 'All-Time Avg. Sleep Duration']; -//const steps = document.getElementById('stepGoal'); +//Global Functions function makeStepCharts(yValues) { new Chart('stepGoal', { type: "doughnut", @@ -31,7 +25,6 @@ function makeStepCharts(yValues) { }); } -//const dailyHydration = document.getElementById('dailyHydration') function makeDailyH20Charts(yValues) { new Chart('dailyHydration', { type: "doughnut", @@ -51,7 +44,6 @@ function makeDailyH20Charts(yValues) { }); } -//const dailySleep = document.getElementById('dailySleep') function dailySleepChart(yValues) { new Chart('dailySleep', { type: "doughnut", @@ -71,7 +63,6 @@ function dailySleepChart(yValues) { }) } -//const dailySleepQuality = document.getElementById('dailySleepQuality') function dailySleepQualityChart(yValues) { new Chart('dailySleepQuality', { type: "doughnut", @@ -91,9 +82,6 @@ function dailySleepQualityChart(yValues) { }) } - - -//const sleepHistory = document.getElementById('sleepHistory') function sleepHistoryBarGraph(userSleepHistory, userQualityHistory) { new Chart('sleepHistory', { type: "line", @@ -118,9 +106,6 @@ function sleepHistoryBarGraph(userSleepHistory, userQualityHistory) { }); } -//var xValues = ['Day 1', 'Day 2', 'Day 3', 'Day 4', 'Day 5', 'Day 6', 'Day 7']; - -//const hydrationHistory = document.getElementById('weeklyHydration') function hydrationBarGraph(hydrationByDay) { new Chart('weeklyHydration', { type: "line", @@ -139,9 +124,6 @@ function hydrationBarGraph(hydrationByDay) { }); } - - -//let allTimeSleepData = document.getElementById('allTimeSleepHistory') function allTimeSleepQuality(allTimeSleep) { new Chart('allTimeSleepHistory', { type: "bar", @@ -164,7 +146,15 @@ function allTimeSleepQuality(allTimeSleep) { }) } -function loadCharts(stepYValues, dailyH2OYValues, sleepYValues, qualityYValues, userSleepHistory, userQualityHistory, hydrationByDay, allTimeSleep) { +function loadCharts( + stepYValues, + dailyH2OYValues, + sleepYValues, + qualityYValues, + userSleepHistory, + userQualityHistory, + hydrationByDay, + allTimeSleep) { makeStepCharts(stepYValues) makeDailyH20Charts(dailyH2OYValues) dailySleepChart(sleepYValues) From 086ceca3eab9c17c2bbdcb112902e7d847589f3d Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sun, 11 Dec 2022 12:00:39 -0700 Subject: [PATCH 180/188] Delete all User.js console logs --- src/User.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/User.js b/src/User.js index a912b60e0e..06fc9f0e76 100644 --- a/src/User.js +++ b/src/User.js @@ -82,7 +82,6 @@ class User { let dates = this.sleepData.sleepData.filter((user) => { return user.date === date }) - console.log('hi', dates) return dates.reduce((acc, curr) => { if (curr.userID === this.userData.id) { acc = curr.hoursSlept @@ -95,7 +94,6 @@ class User { let dates = this.sleepData.sleepData.filter((user) => { return user.date === date }) - console.log('hi', dates) return dates.reduce((acc, curr) => { if (curr.userID === this.userData.id) { acc = curr.sleepQuality @@ -119,8 +117,6 @@ class User { return both; }) - console.log('hi', filteredSleep) - return filteredSleep; } @@ -139,21 +135,18 @@ class User { return both; }) - console.log('hi', filteredQuality) - return filteredQuality; } averageSleepQuality() { - //console.log("Specific ", specificUserSleepData) let totalQuality = this.sleepData.sleepData.reduce((acc, user) => { acc += user.sleepQuality - console.log(acc) + return acc }, 0) let averageQuality = totalQuality / this.sleepData.sleepData.length - console.log('avg uality', averageQuality) + return Number(averageQuality.toFixed(2)) } From 97b548b7eb095bc3fa46c48b4764b91999f7fb0f Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sun, 11 Dec 2022 12:01:40 -0700 Subject: [PATCH 181/188] Delete all User.js comments --- src/User.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/User.js b/src/User.js index 06fc9f0e76..a4bb7048c0 100644 --- a/src/User.js +++ b/src/User.js @@ -139,19 +139,14 @@ class User { } averageSleepQuality() { - let totalQuality = this.sleepData.sleepData.reduce((acc, user) => { acc += user.sleepQuality - return acc }, 0) let averageQuality = totalQuality / this.sleepData.sleepData.length - return Number(averageQuality.toFixed(2)) } } - -//For a user (identified by their userID), the average number of hours slept per day export default User; \ No newline at end of file From 70674803d2a75ff54b0f2c854d4fe07931837087 Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sun, 11 Dec 2022 12:02:49 -0700 Subject: [PATCH 182/188] Delete all console logs and comments from UserRepository.js --- src/UserRepository.js | 35 ++--------------------------------- 1 file changed, 2 insertions(+), 33 deletions(-) diff --git a/src/UserRepository.js b/src/UserRepository.js index f4e60535af..199e507834 100644 --- a/src/UserRepository.js +++ b/src/UserRepository.js @@ -1,5 +1,4 @@ import User from './User'; -// const data = require('./data/users') class UserRepository { constructor(data) { @@ -8,11 +7,7 @@ class UserRepository { getData(userID) { return this.data.userData.find((currentUser) => currentUser.id === userID) - - let userDataArr = Object.entries(this.data) - console.log(userDataArr) - return userDataArr.find((currentUser) => currentUser.userData.id === userID) -} + } stepGoalAverage() { let sum = this.data.userData.reduce((acc, user) => { @@ -24,30 +19,4 @@ class UserRepository { } } -export default UserRepository; - -// new UserRepository(data); -// A UserRepository holds onto all of the User objects -// It should have a parameter to take in user data - -//parameters: -//data - -//properties: -//this.data or this.userData -> something like that - - - -// It should have methods to determine: - -// Given a user’s ID, what is their user data? - //go through the users - //return the corresponding user object when its found - //now we have access to their info - - -// The average step goal amongst all users - //go through each user - //possibly use reduce method? - //get total daily step goal number - //divide by user count \ No newline at end of file +export default UserRepository; \ No newline at end of file From 2b1362c2f312791e63db59696a1fbaa6912fda19 Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sun, 11 Dec 2022 12:03:53 -0700 Subject: [PATCH 183/188] Delete user repo test comments --- test/UserRepository-test.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/test/UserRepository-test.js b/test/UserRepository-test.js index 006244f7c9..1eff6eefea 100644 --- a/test/UserRepository-test.js +++ b/test/UserRepository-test.js @@ -107,10 +107,4 @@ describe('UserRepository', () => { expect(userRepository.stepGoalAverage()).to.equal(6666) }) -}) - -//test the data being passed in -> test this.data - -//test the output of the get user data method, make sure the id argument works - -//test the output of the average step goals -> make sure the math is solid \ No newline at end of file +}); \ No newline at end of file From b64b6ee30504e04747c3abacfea13f71849a0b42 Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sun, 11 Dec 2022 12:07:14 -0700 Subject: [PATCH 184/188] Change charts.js reds to orange --- src/charts.js | 6 +++--- test/User-test.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/charts.js b/src/charts.js index 9e43f7612a..aeb441fb40 100644 --- a/src/charts.js +++ b/src/charts.js @@ -1,7 +1,7 @@ import Chart from 'chart.js/auto'; //Global Variables -const barColors = ["#b91d47", "#00aba9",]; +const barColors = ["orange", "#00aba9",]; const xValues = ['Day 1', 'Day 2', 'Day 3', 'Day 4', 'Day 5', 'Day 6', 'Day 7']; const labels = ['All-Time Avg. Sleep Quality (1-5)', 'All-Time Avg. Sleep Duration']; @@ -90,7 +90,7 @@ function sleepHistoryBarGraph(userSleepHistory, userQualityHistory) { datasets: [{ label: 'Hours Slept', data: userSleepHistory, - borderColor: "red", + borderColor: "orange", fill: false }, { @@ -134,7 +134,7 @@ function allTimeSleepQuality(allTimeSleep) { data: allTimeSleep, backgroundColor: [ 'blue', - 'red' + 'orange' ], borderColor: [ 'rgb(255, 99, 132)', diff --git a/test/User-test.js b/test/User-test.js index cd938f3b27..9e431c2e7e 100644 --- a/test/User-test.js +++ b/test/User-test.js @@ -343,4 +343,4 @@ describe('User', () => { expect(user1.averageSleepQuality()).to.equal(3.55) }) -}) +}) \ No newline at end of file From b0701de9bd7148cc6d3af0e31210dcb40ffd1800 Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sun, 11 Dec 2022 12:08:14 -0700 Subject: [PATCH 185/188] Delete comments on apiCalls.js --- src/apiCalls.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/apiCalls.js b/src/apiCalls.js index cf0d77fe5e..1aaa7d3c27 100644 --- a/src/apiCalls.js +++ b/src/apiCalls.js @@ -1,13 +1,7 @@ -// Your fetch requests will live here! -// const usersURL = 'https://fitlit-api.herokuapp.com/api/v1/users' -// const sleepURL = 'https://fitlit-api.herokuapp.com/api/v1/sleep' -// const hydrationURL = 'https://fitlit-api.herokuapp.com/api/v1/hydration' - function getAPIData(info) { const fetchedInfo = fetch(`https://fitlit-api.herokuapp.com/api/v1/${info}`) .then((res) => res.json()) return fetchedInfo -} - +} -export {getAPIData} \ No newline at end of file +export { getAPIData } \ No newline at end of file From 470a8bcfdb29f4e0281569a4e10b1adc2474f265 Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sun, 11 Dec 2022 13:03:28 -0700 Subject: [PATCH 186/188] Mostly finish the README --- README.md | 136 +++++++++++++++++++++++------------------------------- 1 file changed, 58 insertions(+), 78 deletions(-) diff --git a/README.md b/README.md index 0ccaeef0f0..360c011918 100644 --- a/README.md +++ b/README.md @@ -1,78 +1,58 @@ -# FitLit Starter Kit - -The details of this project are outline in [this project spec](http://frontend.turing.io/projects/fitlit.html). - -## Setup - -1. Within your group, decide on one person to have the project repository (repo) on their GitHub account. Then, that person should fork this repo - on the top right corner of this page, click the **Fork** button. -1. Both memebers of the group should clone down the _forked_ repo. Since you don't want to name your project "activity-tracker-starter", you can use an optional argument when you run git clone (you replace the [...] with the terminal command arguments): `git clone [remote-address] [what you want to name the repo]` -1. Once you have cloned the repo, change into the directory and install the project dependencies. Run `npm install` to install project dependencies. -1. Run `npm start` in the terminal to see the HTML page (you should see some boilerplate HTML displayed on the page). `Control + C` is the command to stop running the local server. Closing the terminal without stopping the server first could allow the server to continue to run in the background and cause problems. This command is not specific to Webpack; make note of it for future use. -1. Make sure both members of your team are collaborators on the forked repo. -1. Do not run `npm audit fix --force`. This will update to the latest version of packages. We need to be using `webpack-dev-server@3.11.2` which is not the latest version. If you start to run into Webpack errors, first check that all group members are using the correct version. - -## Testing - -There is no boilerplate for testing in this starter-kit repo. You will need to set this up yourself. However, if you ran `npm install`, then the tooling you need to start testing is already installed (`mocha` and `chai`). - - -## Data Model - -**Users** - -``` -[ - { - "id": [number], - "name": [string], - "address": [string], - "email": [string], - "strideLength": [number - feet], - "dailyStepGoal": [number - steps], - "friends": [array - one-way connection to other user(s)] - }, - ...more user data -] -``` - -**Activity** - -``` -[ - { - "userID": [number], - "date": [string YYYY/MM/DD], - "numSteps": [number - steps], - "minutesActive": [number - minutes], - "flightsOfStairs": [number - flights] - }, - ...more activity data -] -``` - -**Hydration** - -``` -[ - { - "userID": [number], - "date": [string YYYY/MM/DD], - "numOunces": [number - ounces] - }, - ...more hydration data -] -``` - -**Sleep** - -``` -[ - { - "userID": [number], - "date": [string YYYY/MM/DD], - "hoursSlept": [number - hours], - "sleepQuality": [number - unitless] - }, - ...more sleep data -] -``` +# Fit-Lit + +### Abstract: +[//]: <> (Briefly describe what you built and its features. What problem is the app solving? How does this application solve that problem?) +Here we built a fitness dashboard to display a random users info. This includes their hydration, sleep, and step activity along with their personal info. + +### Installation Instructions: +[//]: <> (What steps does a person have to take to get your app cloned down and running?) +1. Fork this repo - on the top right corner of this page, click the **Fork** button. +2. Clone down the _forked_ repo. Since you don't want to name your project "activity-tracker-starter", you can use an optional argument when you run git clone (you replace the [...] with the terminal command arguments): `git clone [remote-address] [what you want to name the repo]` +3. Once you have cloned the repo, change into the directory and install the project dependencies. Run `npm install` to install project dependencies. +4. Run `npm start` in the terminal to see the HTML page. `Control + C` is the command to stop running the local server. Closing the terminal without stopping the server first could allow the server to continue to run in the background and cause problems. This command is not specific to Webpack; make note of it for future use. +5. Do not run `npm audit fix --force`. This will update to the latest version of packages. We need to be using `webpack-dev-server@3.11.2` which is not the latest version. If you start to run into Webpack errors, first check that all group members are using the correct version. + +### Preview of App: +[//]: <> (Provide ONE gif or screenshot of your application - choose the "coolest" piece of functionality to show off.) +![IdeaBox SS](https://user-images.githubusercontent.com/67208858/200420479-a7c3cd6c-da16-4ff5-8f36-1e14df3d3411.jpg) + +### Context: +[//]: <> (Give some context for the project here. How long did you have to work on it? How far into the Turing program are you?) +We were given approximately 11 days to work on this project. We spent about 50 hours from start to finish. We are on Week 3 of Mod 2. + +### Contributors: +[//]: <> (Who worked on this application? Link to their GitHubs.) +- Craig Weller: + https://github.com/crgweller + https://www.linkedin.com/in/craig-weller/ +- Anna Peterson: + https://github.com/jsahim + https://www.linkedin.com/in/jeffrey-sahim/ +- Ciera DePauw: + https://github.com/cieragrace + https://www.linkedin.com/in/karimal-rashdan/ +- Keenan Southall: + https://github.com/keenans1 + https://www.linkedin.com/in/keenan-southall/ + + +### Learning Goals: +[//]: <> (What were the learning goals of this project? What tech did you work with?) +- Gain an understanding of how to write clean HTML and CSS to match a provided comp +- Understand what it looks like to have a separate data model (using classes) and DOM display +- Incorporate & iterate over arrays in order to filter what is being displayed +- Craft code with clean style, using small functions that show trends toward DRYness and SRP +- Work with an API along with fetch calls and promises +- We worked with JavaScript, HTML, CSS, Git/GitHub workflow, API + +### Wins + Challenges: +[//]: <> (What are 2-3 wins you have from this project? What were some challenges you faced - and how did you get over them?) + +#### Wins +- We got through all 4 iterations +- We had good communication and maintained a positive work environment +- We navigated working together and adapted to different team enironments (splitting off into pairs, working all together, etc...) + +#### Challenges +- We utilised our mentors/peers help when we were unable to come up with a solution +- We all have different schedules, and had to adjust to family/friends/health \ No newline at end of file From aeb9958fb6bda2845c0b4a3f1386cfa6f54f02ba Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sun, 11 Dec 2022 13:04:41 -0700 Subject: [PATCH 187/188] Update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 360c011918..82c2697561 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ We were given approximately 11 days to work on this project. We spent about 50 https://www.linkedin.com/in/craig-weller/ - Anna Peterson: https://github.com/jsahim - https://www.linkedin.com/in/jeffrey-sahim/ + https://www.linkedin.com/in/ - Ciera DePauw: https://github.com/cieragrace https://www.linkedin.com/in/karimal-rashdan/ From 24f270da3e3223a80ac7548a611d955571354663 Mon Sep 17 00:00:00 2001 From: Keenan Southall Date: Sun, 11 Dec 2022 13:05:57 -0700 Subject: [PATCH 188/188] Update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 82c2697561..ba167908d3 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ We were given approximately 11 days to work on this project. We spent about 50 https://www.linkedin.com/in/craig-weller/ - Anna Peterson: https://github.com/jsahim - https://www.linkedin.com/in/ + https://www.linkedin.com/in - Ciera DePauw: https://github.com/cieragrace https://www.linkedin.com/in/karimal-rashdan/