Also show overdue tasks in current view

This commit is contained in:
raimund-schluessler 2014-11-09 19:53:04 +01:00
parent c841fa03bb
commit 2bff5aa24f
2 changed files with 7 additions and 5 deletions

View file

@ -120,7 +120,7 @@ angular.module('Tasks').factory 'TasksModel',
when 'all' when 'all'
return task.completed == false return task.completed == false
when 'current' when 'current'
return (task.completed == false && @current(task.start)) return (task.completed == false && @current(task.start, task.due))
when 'starred' when 'starred'
return (task.completed == false && task.starred == true) return (task.completed == false && task.starred == true)
when 'today' when 'today'
@ -180,9 +180,11 @@ angular.module('Tasks').factory 'TasksModel',
moment(due, "YYYYMMDDTHHmmss"). moment(due, "YYYYMMDDTHHmmss").
diff(moment().startOf('day'), 'days', true) < 7) diff(moment().startOf('day'), 'days', true) < 7)
current: (start) -> current: (start, due) ->
return (!moment(start, "YYYYMMDDTHHmmss").isValid() || return (!moment(start, "YYYYMMDDTHHmmss").isValid() ||
moment(start, "YYYYMMDDTHHmmss"). moment(start, "YYYYMMDDTHHmmss").
diff(moment(), 'days', true) < 0 ||
moment(due, "YYYYMMDDTHHmmss").
diff(moment(), 'days', true) < 0) diff(moment(), 'days', true) < 0)
changeCalendarId: (taskID, calendarID) -> changeCalendarId: (taskID, calendarID) ->

View file

@ -2257,7 +2257,7 @@
case 'all': case 'all':
return task.completed === false; return task.completed === false;
case 'current': case 'current':
return task.completed === false && this.current(task.start); return task.completed === false && this.current(task.start, task.due);
case 'starred': case 'starred':
return task.completed === false && task.starred === true; return task.completed === false && task.starred === true;
case 'today': case 'today':
@ -2349,8 +2349,8 @@
return moment(due, "YYYYMMDDTHHmmss").isValid() && moment(due, "YYYYMMDDTHHmmss").diff(moment().startOf('day'), 'days', true) < 7; return moment(due, "YYYYMMDDTHHmmss").isValid() && moment(due, "YYYYMMDDTHHmmss").diff(moment().startOf('day'), 'days', true) < 7;
}; };
TasksModel.prototype.current = function(start) { TasksModel.prototype.current = function(start, due) {
return !moment(start, "YYYYMMDDTHHmmss").isValid() || moment(start, "YYYYMMDDTHHmmss").diff(moment(), 'days', true) < 0; return !moment(start, "YYYYMMDDTHHmmss").isValid() || moment(start, "YYYYMMDDTHHmmss").diff(moment(), 'days', true) < 0 || moment(due, "YYYYMMDDTHHmmss").diff(moment(), 'days', true) < 0;
}; };
TasksModel.prototype.changeCalendarId = function(taskID, calendarID) { TasksModel.prototype.changeCalendarId = function(taskID, calendarID) {