Constructor
new user(id, data)
- Source:
class representing an user
Parameters:
Name | Type | Description | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id |
number | user id |
|||||||||||||||||||||
data |
object | contain user data Properties
|
Methods
getActivity() → {object}
- Source:
provides user activity
Example
return { day: '2020-07-01', kilogram: 80, calories: 240 }
Returns:
data in JSON format
- Type
- object
getAverageSessions() → {object}
- Source:
provides user average sessions
Example
return { day: 1, sessionLength: 30 }
Returns:
session - data in JSON format
- Type
- object
getCalorieCount() → {number}
- Source:
provides user calorie count
Returns:
calorie count
- Type
- number
getCarbohydrateCount() → {number}
- Source:
provides user carbohydrate count
Returns:
carbohydrate count
- Type
- number
getFirstName() → {string}
- Source:
provides user first name
Returns:
user first name
- Type
- string
getLipidCount() → {number}
- Source:
provides user lipid count
Returns:
lipid count
- Type
- number
getPerformances() → {object|number|object|array}
- Source:
provides user performances
Returns:
-
performances - data in JSON format
- Type
- object
-
performances.id - user id
- Type
- number
-
performances.kind - { 1: 'cardio, 2: 'energy', 3: 'endurance', 4: 'strength', 5: 'speed', 6: 'intensity'}
- Type
- object
-
performances.data - [ {value: 80, kind: 1}, ... ]
- Type
- array
getProteinCount() → {number}
- Source:
provides user protein count
Returns:
protein count
- Type
- number
getScore() → {number}
- Source:
provides user score
Example
return 0.25
Returns:
- score
- Type
- number
setData(data)
- Source:
modify the value of attributes activity, averageSessions, keyData, mainData, performances, todayScore
Parameters:
Name | Type | Description |
---|---|---|
data |
object | contain user data |
setId(id)
- Source:
modify the value of the id attribute
Parameters:
Name | Type | Description |
---|---|---|
id |
number | user id |