You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
required (Boolean) - Whether this habit is required to be done on time in order to maintain a performance streak. If false, for example, it’s okay to miss performing the habit on-time. Brushing Your Teeth is likely required to do daily, but if you miss getting your car washed by a day or two it’s not a big deal.
startAt (Date) - Date the habit should start being managed. This is useful if you are adding habits which don’t occur yet, such as pre-scheduling to have your car washed.
repeatType (Number) - An integer constant value referring to the type of repeat this is. At 1.0 this is just either Periodically (every X days/weeks) or Regularly (every Monday)
repeatUnit (Number, Nullable) - A number constant representing unit the habit repeats according to, such as Day, Week, or Month. Nullable because in the case of a “Regularly” habit where it happens a certain weekday, this value isn’t needed.
repeatScalar (Number, Nullable) - A number to be used as the scalar value when determining the habit’s repeat. For example, if the habit repeats every 4 days, this value would be 4. Nullable because in the case of a “Regularly” habit where it happens a certain weekday, this value isn’t needed.
repeatWeekdays (Number, Nullable) - A bitmasked number representing the days of week this Habit occurs on. Ideally this would be an 8-bit number type, depending on the database’s types. The mask takes just 7 bits so anything more is a waste of space.
lastCompletedAt (Datetime) - Date this habit was last completed. This is just for performance and is just a cached value from the most recent HabitOccurrence model.
currentOccurrence (ForeignKey) - HabitOccurrence model for the current occurrence of this habit, for O(1) lookup.
Methods
public void completeHabit() - Looks up the current outstanding HabitOccurrence, marks it complete, schedules the next Occurrence, and updates the reference.
The text was updated successfully, but these errors were encountered:
Schema
_id (Number)
title (Text)
- Title of the habit.createdAt (Datetime)
- Time this habit was added.required (Boolean)
- Whether this habit is required to be done on time in order to maintain a performance streak. If false, for example, it’s okay to miss performing the habit on-time. Brushing Your Teeth is likely required to do daily, but if you miss getting your car washed by a day or two it’s not a big deal.startAt (Date)
- Date the habit should start being managed. This is useful if you are adding habits which don’t occur yet, such as pre-scheduling to have your car washed.repeatType (Number)
- An integer constant value referring to the type of repeat this is. At 1.0 this is just either Periodically (every X days/weeks) or Regularly (every Monday)repeatUnit (Number, Nullable)
- A number constant representing unit the habit repeats according to, such as Day, Week, or Month.Nullable
because in the case of a “Regularly” habit where it happens a certain weekday, this value isn’t needed.repeatScalar (Number, Nullable)
- A number to be used as the scalar value when determining the habit’s repeat. For example, if the habit repeats every 4 days, this value would be4
.Nullable
because in the case of a “Regularly” habit where it happens a certain weekday, this value isn’t needed.repeatWeekdays (Number, Nullable)
- A bitmasked number representing the days of week this Habit occurs on. Ideally this would be an 8-bit number type, depending on the database’s types. The mask takes just 7 bits so anything more is a waste of space.lastCompletedAt (Datetime)
- Date this habit was last completed. This is just for performance and is just a cached value from the most recent HabitOccurrence model.currentOccurrence (ForeignKey)
-HabitOccurrence
model for the current occurrence of this habit, for O(1) lookup.Methods
public void completeHabit()
- Looks up the current outstandingHabitOccurrence
, marks it complete, schedules the next Occurrence, and updates the reference.The text was updated successfully, but these errors were encountered: