Skip to content

Instantly share code, notes, and snippets.

@jpweist
Last active October 8, 2019 21:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpweist/f0199959d3dd5cbc684e60578f5a5381 to your computer and use it in GitHub Desktop.
Save jpweist/f0199959d3dd5cbc684e60578f5a5381 to your computer and use it in GitHub Desktop.
FitLit project
// UserRepository responsable for all users data, calculate users step goal
class UserRepository {
constructor(data) {
this.allUsers = data
}
findUserData(userID) {
return userID's data
}
calculateUsersStepGoal() {
average of all users step goals
user.dailyStepGoal * all / all
}
// User is responsable for the individual user data, returns first name with id
class User {
constructor(userData) {
this.id = userData.id
this.name = userData.name
this.address = userData.address
this.email = userData.email
this.StrideLength = userData.StrideLength
this.friends = userData.friends
}
returnFirstName() {
return this.name
}
}
// Hydration is responsable for hydreation data and daily weekly hydration
class Hydration {
constructor(hydrationData) {
this.userID = hydreationData.userID
this.date = hydrationData.date
this.numOunces = hydrationData.numOunces
}
findDailyHydration() {
take in today date for day only
}
findWeeklyHydration() {
take in todays date and plus 7 for week
}
(on DOM) {
A display to show how much water they have consumed today (these displays are often called “widgets” in the FE tech world)
A display to show much water they have consumed each day over the course of the latest week
}
}
// Sleep is resposable for sleep data: daly, weekly
class Sleep {
constructor(userID) {
this.userData = userID
}
calculateSleepDayAverage() {
this.userData.hoursSlept (calculate sleep average for that day)
}
averageSleepQualityAllTime() {
this.userData.sleepQuality
}
findDailySleepDate() {
this.userData.hoursSlept (time on that date)
}
calculateWeeklyHoursSlept() {
this.userData.hoursSlept (week 7 days)
}
findSleepQualityWeekly() {
this.userData.sleepQuality (week 7 days)
}
allUserSleepQuality() {
all users sleep quality average
}
sleepOverSevenHours() {
average a sleep quality greater than 3 for a given week (7 days)
}
sleptMostDay(date) {
find the users who slept the most number of hours (one or more if they tied)
}
sleptLeastDay() {
which uses slept the least today
}
(Dashboard Items) {
user, their sleep data for the latest day (hours slept and quality of sleep)
user, their sleep data over the course of the latest week (hours slept and quality of sleep)
user, their all-time average sleep quality and all-time average number of hours slept
}
// Activity will calculate the activity for the user
class Activity {
constructor(userID) {
this.id = userID.id
this.date = userID.date
this.numSteps = 3577;
this.minutesActive = 100;
flightsOfStairs = 1;
}
calculateMilesWalked() {
return calculated miles walked
}
calculateMinutesActive() {
return minutes Active
}
calculateStepGoalReached() {
step goal for a given day
}
calculateExceededGoal() {
For a user, find all the days where they exceeded their step goal
}
calculateStairGoal() {
For a user, find their all-time stair climbing record
}
stairsClimbed() {
stairs climbed for a specified date
}
stepsDate() {
steps taken for a specific date
}
minutesActive() {
minutes active for a specific date
}
leastActive() {
least active date for all users
}
}
// ActivityRepository will average activity for the group
class ActivityRepository {
constructor() {
this.userData = data.id
}
calculateAverageSteps() {
step average for everyone
}
calculateAverageStairs() {
stair average for everyone
}
}
(Dashboard) {
user, the number of steps for the latest day
user, the number minutes active for the latest day
user, the distance they have walked (in miles) for the latest day based on their step count
number of steps, minutes active, and flights of stairs climbed compares to all users for the latest day
user, a weekly view of their step count, flights of stairs climbed, and minutes active
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment