zacharytamas / android-often Goto Github PK
View Code? Open in Web Editor NEWMy Habits App.
My Habits App.
_id (Number)
habit (Number)
- ID of a Habit (#2) this occurrence is related to.completedAt (Datetime, Nullable)
- Time this occurrence was performed. NULL
if not done yet.dueAt (Datetime)
- Time this occurrence must be completed by to maintain their performance streak. (We know they missed their streak if the current time is greater than dueAt
and completedAt
is NULL
or after dueAt
)availableAt (Datetime)
- Time this occurrence became available for completion. This is used when querying so you can have an occurrence that is scheduled but not available. When a Habit is completed another HabitOccurrence for the next time is created and is scheduled using this field.note (Text)
- A note the user may have left about this particular completion. Examples include: their weight (assuming the Habit is to weigh themselves), brief summary of their gym visit._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 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.public void completeHabit()
- Looks up the current outstanding HabitOccurrence
, marks it complete, schedules the next Occurrence, and updates the reference.Add ability to export user habit completion statistics to JSON.
Habit.queueDueReminder()
queues up an Android notification to remind the user 30 minutes before a Habit is due.
Currently Habits are due at the end of the day they became available (if they have due dates at all). Add flexibility so that Habits can be due at a certain time of day.
Habit.getNextDueAt()
returns a Date
of the next time this Habit is due.
The nextAvailableAt()
method should return the next time the Habit is available, relative to now or a date passed in.
Create the Adapter
for using in the ListView
for the "Today" Activity, which is used to provide all the data needed for showing a list of Habits Due and Available.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.