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 01/98] 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 02/98] 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 03/98] 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 04/98] 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 05/98] 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 06/98] 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 07/98] 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 08/98] 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 09/98] 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 10/98] 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 11/98] 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 12/98] 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 13/98] 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 14/98] 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 15/98] 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 16/98] 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 17/98] 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 18/98] 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 19/98] 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 20/98] 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 21/98] 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 22/98] 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 23/98] 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 24/98] 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 25/98] 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 26/98] 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 27/98] 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 28/98] 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 29/98] 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 30/98] 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 31/98] 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 32/98] 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 33/98] 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 34/98] 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 35/98] 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 36/98] 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 37/98] 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 38/98] 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 39/98] 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 40/98] 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 41/98] 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 42/98] 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 43/98] 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 44/98] 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 45/98] 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 46/98] 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 47/98] 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 48/98] 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 49/98] 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 50/98] 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 51/98] 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 52/98] 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 53/98] 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 54/98] 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 55/98] 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 56/98] 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 57/98] 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 58/98] 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 59/98] 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 60/98] 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 61/98] 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 62/98] 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 63/98] 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 64/98] 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 65/98] 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 66/98] 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 67/98] 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 68/98] 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 69/98] 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 70/98] 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 71/98] 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 72/98] 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 73/98] 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 74/98] 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 75/98] 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 76/98] 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 77/98] 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 78/98] 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 79/98] 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 80/98] 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 81/98] 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 82/98] 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 83/98] 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 84/98] 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 85/98] 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 86/98] 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 87/98] 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 88/98] 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 89/98] 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 90/98] 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 91/98] 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 92/98] 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 93/98] 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 94/98] 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 95/98] 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 96/98] 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 97/98] 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 98/98] 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 +})