Giter VIP home page Giter VIP logo

android-often's People

Contributors

zacharytamas avatar

Watchers

 avatar  avatar  avatar

android-often's Issues

Create HabitOccurrence model

Schema

  • _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.

Habit.completeHabit()

Depends on #7, #8, #10

Marks the Habit as complete. The process is such:

  1. Set lastCompletedAt property to now.
  2. Set availableAt property using Habit.getNextAvailableAt()
  3. Set dueAt property using Habit.getNextDueAt()
  4. Create HabitOccurrence instance for this completion

Create Habit model

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 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.

Habit.queueDueReminder()

Habit.queueDueReminder() queues up an Android notification to remind the user 30 minutes before a Habit is due.

Allow Habits to be due at a specific time

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.

Create TodayAdapter

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.