Constructor
new User(data)
Creates a user object
Parameters:
| Name | Type | Description |
|---|---|---|
data |
User | Object |
Members
_id :string
Unique ID for the user
Type:
- string
claUnit :number
User's current overall unit in CLA (1-based). There are 26 total units, including Unit 1 (Warmup) and Unit 26 (Wrapup).
Type:
- number
fullName :string
User's full name
Type:
- string
lastUnits
Array of the last overall claUnit for each stage, from warmup (index 0) through the end of CLA
name :string
User's common name
Type:
- string
photoFilename :string
Filename of a picture of the user
Type:
- string
Methods
(static) getClaStage(claUnit) → {Object}
Given a claUnit (overall unit number), computes:
- the unit within the stage. This number resets to 1 when a user moves to a new stage.
- the stage number
- the CLAStage enum string that corresponds to the stage number
Parameters:
| Name | Type | Description |
|---|---|---|
claUnit |
number |
Returns:
- Type
- Object
(static) getClaStageEnum(stageNum) → {CLAStage|string}
converts a CLA stage number, which is its index into this.lastUnits, to its CLAStage enum value
Parameters:
| Name | Type | Description |
|---|---|---|
stageNum |
number |
Returns:
- Type
- CLAStage | string
(static) getClaStageNumber(userClaStage) → {number}
convert the CLAStage enum value to its stage number, which is its index into this.lastUnits
Parameters:
| Name | Type | Description |
|---|---|---|
userClaStage |
CLAStage |
Returns:
- Type
- number
(static) getMaxStageUnit(stageEnum) → {number}
Gets the maximum stage unit (not the overall cla unit) for the stage specified by the enum. The minimum is always 1 for every stage.
Parameters:
| Name | Type | Description |
|---|---|---|
stageEnum |
CLAStage | string |
Returns:
- Type
- number
(static) getOverallClaUnit(stageEnum, stageUnit) → {number}
convert a stage enum and unit within that stage to the overall claUnit
Parameters:
| Name | Type | Description |
|---|---|---|
stageEnum |
CLAStage | string | |
stageUnit |
number |
Returns:
- Type
- number
(static) unitsForStage(claStage) → {Array.<number>}
for a given stage enum value, returns an array of all unit numbers in that stage
Parameters:
| Name | Type | Description |
|---|---|---|
claStage |
CLAStage |
Returns:
- Type
- Array.<number>
set(data) → {User}
Creates an updated user object
Parameters:
| Name | Type | Description |
|---|---|---|
data |
User | Object |
Returns:
- Type
- User