/**
 * Higher-order function that produces a filter to removes tasks
 * if they are completed and showCOmpleted option is false
 */
function filterCompleted (showCompleted) {
    return function (todo) {
        if (showCompleted) {
          return true;
        }

        if (todo.get("completed")) {
            return false;
        }

        return true;
    };
}

function orderTasks(task1, task2) {
    if ( !task1.get("completed") && task2.get("completed")) {
        return -1;
    } else if (task1.get("completed") && !task2.get("completed")) {
        return 1;
    }

    return task1.get("text").localeCompare(task2.get("text"));
}

function isTaskType(type) {
    return function (item) {
        return item && item.get("type") === type;
    };
}

var isHabit = isTaskType("habit"),
    isDaily = isTaskType("daily"),
    isTodo = isTaskType("todo");

export default {
    filterCompleted,
    orderTasks,
    isHabit,
    isDaily,
    isTodo
};

@@ -397,24 +397,137 @@
 1, task2) %7B%0A
+    if (task1.get(%22type%22) === %22habit%22) %7B%0A      return task1.get(%22text%22).localeCompare(task2.get(%22text%22));%0A    %7D%0A%0A
     if ( !ta

fix task compare function