Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post hydration data it7 #412

Open
wants to merge 108 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
170e063
initial commit
jmartin777 Mar 27, 2023
b831f13
Initial Commit
CapCinematic Mar 27, 2023
b0a8c0d
html skeleton
CapCinematic Mar 27, 2023
95b2f48
User data model working successful
jmartin777 Mar 28, 2023
a6a4e9b
Merge pull request #1 from jmartin777/userclass
cadechaney Mar 28, 2023
0dbe5c6
Create pull_request_template.md
sdtrachsel Mar 28, 2023
47e88f0
Add user tests
sdtrachsel Mar 28, 2023
468719a
Add Sleep Class code
sdtrachsel Mar 28, 2023
381887a
Merge pull request #2 from jmartin777/test/user
CapCinematic Mar 28, 2023
df6b537
Merge branch 'main' into feat-html-skeleton
cadechaney Mar 28, 2023
3decd34
Feat user class methods using user data
jmartin777 Mar 28, 2023
40b62bc
Merge pull request #4 from jmartin777/userclass
CapCinematic Mar 28, 2023
979504e
Merge branch 'main' into feat-html-skeleton
cadechaney Mar 28, 2023
72378c4
Merge pull request #3 from jmartin777/feat-html-skeleton
cadechaney Mar 28, 2023
6be5e67
Complete Sleep class code
sdtrachsel Mar 28, 2023
9e2e0f0
Intial Commit
CapCinematic Mar 28, 2023
35dd6d5
check for avg/specific oz
CapCinematic Mar 28, 2023
f6d9467
finish checking for class functionality
CapCinematic Mar 28, 2023
3e323e9
add webpack testing info
CapCinematic Mar 29, 2023
ee4b64c
add function for calculating a week
CapCinematic Mar 29, 2023
cd2cbf9
Start hydration test
cadechaney Mar 29, 2023
524cecf
Add passing first test non dynamically
cadechaney Mar 29, 2023
063a05e
Add hard coded date for specific day test
cadechaney Mar 29, 2023
45b253c
Add week long test
cadechaney Mar 29, 2023
b51f5c6
Complete sleep code and test refinement. All tests pass
sdtrachsel Mar 29, 2023
8b110af
Merge pull request #5 from jmartin777/feat/sleep
cadechaney Mar 29, 2023
02b46b5
Merge branch 'main' into feat/test-hydration
CapCinematic Mar 29, 2023
c7a6c48
Test user class
jmartin777 Mar 29, 2023
c99e2f1
Merge pull request #6 from jmartin777/feat/test-hydration
sdtrachsel Mar 29, 2023
bca8d45
Merge branch 'main' into userclass_testing_and_dashboard
CapCinematic Mar 29, 2023
0514579
Merge pull request #7 from jmartin777/userclass_testing_and_dashboard
cadechaney Mar 29, 2023
9e1b9b3
add api and fetch functionality
CapCinematic Mar 29, 2023
98b32eb
add full functionality for accessing data
CapCinematic Mar 29, 2023
c7973e2
Merge pull request #8 from jmartin777/feat-api-calls
cadechaney Mar 29, 2023
151f627
Add most recent day sleep hours to page
sdtrachsel Mar 30, 2023
1b680e2
Feat load user info on DOM
jmartin777 Mar 30, 2023
3f46201
Merge pull request #9 from jmartin777/User_class_dashboard
cadechaney Mar 30, 2023
64906f0
Add sleep stuff
sdtrachsel Mar 30, 2023
77dda26
Fix Sleep class and Sleep-test for more info on week detail and api sort
sdtrachsel Mar 31, 2023
8d29939
Refactored user class and user tests
jmartin777 Mar 31, 2023
5181e20
Merge branch 'main' into feat/displaycardss
cadechaney Mar 31, 2023
9e0fbdd
Merge pull request #11 from jmartin777/feat/displaycardss
cadechaney Mar 31, 2023
e4984a2
Refactor hydration class and updated DOM
cadechaney Mar 31, 2023
011587a
Add welcome message to DOM
cadechaney Mar 31, 2023
4dc1cf9
Merge pull request #12 from jmartin777/User_class_dashboard
cadechaney Mar 31, 2023
6b48127
Merge pull request #13 from jmartin777/feat/hydration-dashboard
jmartin777 Mar 31, 2023
21c954c
add seven day card
CapCinematic Mar 31, 2023
627920e
Refactored the user class
jmartin777 Mar 31, 2023
28a9a84
better display for 7 days
CapCinematic Mar 31, 2023
0c4c6a6
symantics on data
CapCinematic Mar 31, 2023
dfdeff1
Merge pull request #14 from jmartin777/Refactoring
cadechaney Mar 31, 2023
60ecde8
Merge pull request #15 from jmartin777/feat-sevdayCard
jmartin777 Mar 31, 2023
4b29e0c
Started css styling on the dom
jmartin777 Apr 1, 2023
04956c6
Merge pull request #16 from jmartin777/CSS_styling
CapCinematic Apr 1, 2023
e9a2869
Add Activity class and test file
sdtrachsel Apr 1, 2023
35cc94b
Add basic activity test
sdtrachsel Apr 1, 2023
070b092
Merge pull request #17 from jmartin777/test/Activity
cadechaney Apr 1, 2023
e77e405
Created activity class constructor
jmartin777 Apr 1, 2023
e6ec46a
Feat activity methods
jmartin777 Apr 1, 2023
c646764
Merge pull request #18 from jmartin777/Activity_class_constructor
cadechaney Apr 1, 2023
04742ca
Finish up Activity class test
sdtrachsel Apr 1, 2023
1da5dc6
Complete Activity clas. All tests pass
sdtrachsel Apr 1, 2023
181e627
Merge pull request #19 from jmartin777/test/Activity2
cadechaney Apr 1, 2023
39c547d
Add sleep card summary
sdtrachsel Apr 1, 2023
cf8568b
Refactored the User card in CSS
jmartin777 Apr 1, 2023
f279181
Add sleep week cards
sdtrachsel Apr 1, 2023
4c0d79d
Merge pull request #20 from jmartin777/CSS_styling_prt2
CapCinematic Apr 1, 2023
e69c31d
Add activity card & minor error fixes
sdtrachsel Apr 1, 2023
ad4eed3
Merge branch 'main' into feat/dashboardcards
CapCinematic Apr 1, 2023
4e875b3
Merge pull request #21 from jmartin777/feat/dashboardcards
CapCinematic Apr 1, 2023
9abe86f
Pushing to switch drv/nav
sdtrachsel Apr 1, 2023
5ff437e
Arrange the page display
cadechaney Apr 1, 2023
e7147ce
Merge pull request #22 from jmartin777/feat/cardstyling
jmartin777 Apr 1, 2023
3b02226
CSS styling on DOM
jmartin777 Apr 1, 2023
268f4ac
Added CSS styling that matches the sizes of widgets
jmartin777 Apr 1, 2023
177460b
Merge pull request #23 from jmartin777/CSS_styling_prt3
CapCinematic Apr 2, 2023
6cd27c7
add logos and icons
CapCinematic Apr 2, 2023
2e78e3c
Merge pull request #24 from jmartin777/feat-logos
cadechaney Apr 2, 2023
173f5a7
Add css styling to header3
cadechaney Apr 2, 2023
227a6c7
Refactor Activity test to include new methods and correct method naming
sdtrachsel Apr 2, 2023
d6cf8e7
Finish up Activity test refactor and cleaning up Activity class
sdtrachsel Apr 2, 2023
b8ad72b
Refactor Sleep test and clean, clean up sleep class
sdtrachsel Apr 2, 2023
5e54467
Finish activtity tests
sdtrachsel Apr 2, 2023
8e27edf
Update script file to new Activity method names
sdtrachsel Apr 2, 2023
4771807
Update Acvity and Sleep classes and tests to better match rubric
sdtrachsel Apr 2, 2023
51c8e3a
Updates for class method changes
sdtrachsel Apr 2, 2023
72474ad
Add phtots to DOM and browser organization
cadechaney Apr 2, 2023
a757295
Merge pull request #25 from jmartin777/feat/CSS-DOM
jmartin777 Apr 2, 2023
6b93c46
Merge branch 'main' into tests/refactor
CapCinematic Apr 3, 2023
a014a30
Merge pull request #26 from jmartin777/tests/refactor
cadechaney Apr 3, 2023
fea264f
add a new readme
CapCinematic Apr 3, 2023
3fc9d25
Merge pull request #27 from jmartin777/feat-README-Update
cadechaney Apr 3, 2023
28bfec4
add gitfit picture
CapCinematic Apr 4, 2023
258c725
Merge pull request #28 from jmartin777/feat-README-Update
CapCinematic Apr 4, 2023
5733f55
Update README.md
CapCinematic Apr 4, 2023
4c383c8
refactored first name method in user class
cadechaney Apr 11, 2023
86fc8db
remove improper tag elements
cadechaney Apr 11, 2023
9b8913f
change responses in activity class to pass test
cadechaney Apr 11, 2023
3015202
refactor activity test to make the beforeEach cleaner
cadechaney Apr 11, 2023
1067eb8
refactored sleep test data to be its own file
cadechaney Apr 11, 2023
d587dc2
refactor hydration test to have data separate
cadechaney Apr 11, 2023
dce8547
delete empty file
cadechaney Apr 11, 2023
eb696ea
Merge pull request #29 from jmartin777/rafact/day-one-part2
jmartin777 Apr 12, 2023
27cee4e
POST hydration request
jmartin777 Apr 12, 2023
0bd518d
POST hydration data successful
jmartin777 Apr 12, 2023
8673a47
Post hydration dom manipulation
jmartin777 Apr 12, 2023
4c001bd
POST hydration data setup
jmartin777 Apr 13, 2023
98a5a62
Post Hydration data refactor
jmartin777 Apr 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Complete Activity clas. All tests pass
sdtrachsel committed Apr 1, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 1da5dc6b71fc3e44374f2a10a75eefee15bdb890
55 changes: 23 additions & 32 deletions src/Activity.js
Original file line number Diff line number Diff line change
@@ -1,46 +1,37 @@
class Activity {
constructor(userData) {
this.userData = userData;
// console.log('activity user',userData)
constructor(userDetail, allActivityData) {
this.userId = userDetail.id
this.strideLength = userDetail.strideLength
this.dailyStepGoal = userDetail.dailyStepGoal
this.activityLogs = allActivityData.activityData.filter( data => data.userID === this.userId);
}

calculateMiles(date) {
const selectedDay = this.activityLogs.find(log => log.date === date);
const miles = (selectedDay.numSteps * this.strideLength) / 5280;

return Math.round(miles * 10) / 10;
}

findUserByActivityByDate(userId, userData) {
let userActivity = this.userData.activityData.find((activity) => activity.userId === userId && activity.date === userData.date)
return userActivity
}


calculateMiles(userActivity, strideLength) {
const miles = (userActivity.numSteps * strideLength) / 5280
return miles
calculateActiveMinutes(date) {
const dayLog = this.activityLogs.find((log) => {
return log.date === date;
})

return dayLog.minutesActive;
}

calculateActiveMinutes(userActivity) {
return userActivity.minutesActive

}

// calculateTotalSteps(userActivity) {
// return userActivity.numSteps.reduce((acc, curr) => {

checkStepGoalReached(date) {
const dayDetail = this.activityLogs.find(log => log.date === date);
const stepGoal = this.dailyStepGoal;

checkWeeklyGoal(userActivity, dailyStepGoal) {
if(userActivity.numSteps < dailyStepGoal) {
"False: goal not met"
if(stepGoal <= dayDetail.numSteps){
return `Good Job! ${dayDetail.numSteps} meets your goal!`
} else {
return `Good job! ${userActivity.numSteps} meets your goal!`
}
}
return `Not quite! ${stepGoal - dayDetail.numSteps} steps to go!`
}
};
}

export default Activity

// {userID":1,
// "date":"2023/03/24",
// "numSteps":7362,
// "minutesActive":261,
// "flightsOfStairs":26 },
export default Activity
18 changes: 9 additions & 9 deletions test/Activity-test.js
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ describe('Activity', () => {
]
};

testUserInfo = new user({
testUserInfo = {
"id": 1,
"name": "Trystan Gorczany",
"address": "9484 Lucas Flat, West Kittymouth WA 67504",
@@ -35,7 +35,7 @@ describe('Activity', () => {
46,
11
]
});
};

testUser = new Activity(testUserInfo, activityLogs)
});
@@ -48,19 +48,19 @@ describe('Activity', () => {
expect(testUser).to.be.an.instanceof(Activity);
});

it.skip('should store a users id', function () {
it('should store a users id', function () {
expect(testUser.userId).to.equal(1);
});

it.skip('should store a users stride length', function () {
it('should store a users stride length', function () {
expect(testUser.strideLength).to.equal(4);
});

it.skip('should store a users daily step goal', function () {
it('should store a users daily step goal', function () {
expect(testUser.dailyStepGoal).to.equal(7000);
});

it.skip('should store a users activity logs', function () {
it('should store a users activity logs', function () {
expect(testUser.activityLogs).to.deep.equal([
{ "userID": 1, "date": "2023/03/24", "numSteps": 7362, "minutesActive": 250, "flightsOfStairs": 26 },
{ "userID": 1, "date": "2023/03/23", "numSteps": 6502, "minutesActive": 275, "flightsOfStairs": 23 },
@@ -74,16 +74,16 @@ describe('Activity', () => {



it.skip('should find the miles per day when given a date', function () {
it('should find the miles per day when given a date', function () {
expect(testUser.calculateMiles('2023/03/22')).to.be.equal(4.2);
expect(testUser.calculateMiles('2023/03/18')).to.be.equal(2.7);
})

it.skip('should find the active minuts by day', function () {
it('should find the active minuts by day', function () {
expect(testUser.calculateActiveMinutes('2023/03/21')).to.be.equal(211);
});

it.skip('should find if they reached the step goal for a specific day', function () {
it('should find if they reached the step goal for a specific day', function () {
expect(testUser.checkStepGoalReached('2023/03/18')).to.be.equal('Not quite! 3495 steps to go!');
expect(testUser.checkStepGoalReached('2023/03/24')).to.be.equal(`Good Job! 7362 meets your goal!`);
});