-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(models): add Completion model and update Tracker with it
- Loading branch information
Showing
3 changed files
with
45 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* A Completions is a measure of an action accomplished in order to fulfill a Tracker. | ||
* | ||
* @interface Completion | ||
* @member {number} quantity amount of something (= unit) measured (ex: 10) | ||
* @member {string} unit individual thing to measure (ex: "squats") | ||
*/ | ||
export default interface Completion { | ||
quantity: number; | ||
unit: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,32 @@ | ||
import Completion from './Completion'; | ||
import TrackerEntry from './TrackerEntry'; | ||
import TrackerStatus from './TrackerStatus'; | ||
|
||
/** | ||
* A Tracker describes an objective which needs to be accomplished on a daily basis. | ||
* To keep tracker of the objective, the trackers references TrackerEntries. | ||
* | ||
* @interface Tracker | ||
* @member {string} id a v4 uuid | ||
* @member {string} beginDate when the completions start (can be in the past or the future) | ||
* @member {string?} dateHidden when not undefined, specify which day the tracker is ignored. The next day, it's automatically set to "undefined". | ||
* @member {number?} duration number of days the tracker is active since beginDate | ||
* @member {string} endDate when the Tracker is over | ||
* @member {TrackerEntry[]} entries TrackerEntries related to this Tracker | ||
* @member {string} name | ||
* @member {number?} remainingDays computed attribute describing the number of days before the tracker is over | ||
* @member {Completion[]} requiredCompletions objectives to complete the tracker | ||
* @member {TrackerStatus} status @see TrackerStatus | ||
*/ | ||
export default interface Tracker { | ||
id: string; // uuid v4 | ||
id: string; | ||
beginDate: string; | ||
dateHidden?: string; | ||
defaultQuantity?: number; | ||
duration?: number; | ||
endDate?: string; | ||
entries: TrackerEntry[]; | ||
name: string; | ||
remainingDays?: number; | ||
requiredCompletions: Completion[]; | ||
status: TrackerStatus; | ||
unit?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,17 @@ | ||
import Completion from './Completion'; | ||
|
||
/** | ||
* A TrackerEntry is multiple Completions achieved on a precise date | ||
* | ||
* @interface TrackerEntry | ||
* @member {string} id a v4 uuid | ||
* @member {Completion[]} completions actions done, can't be empty | ||
* @member {string} date when the entry was completed | ||
* @member {string} trackerId Tracker the entry is attached to | ||
*/ | ||
export default interface TrackerEntry { | ||
id: string; // uuid v4 | ||
id: string; | ||
completions: Completion[]; | ||
date: string; | ||
quantity: number; | ||
trackerId: string; | ||
} |