alfred-workflow-todoist icon indicating copy to clipboard operation
alfred-workflow-todoist copied to clipboard

Sort by due date

Open mattfysh opened this issue 8 years ago • 8 comments

Great workflow, love that I can add a new todo in <1 sec now! Quick question on the todos list... is there something I can type or configure to see only overdue + today's tasks? Right now when I type todos I'll see a list of (somewhat) arbitrarily-sorted items. Thanks! 😃

mattfysh avatar Nov 27 '16 03:11 mattfysh

nice-to-have: also sort by priority

mattfysh avatar Nov 27 '16 03:11 mattfysh

Hi! Is this still something that would interest you?

moranje avatar May 27 '17 21:05 moranje

I second this and might be able to take a crack at it.

stphnlwlsh avatar Jun 15 '17 01:06 stphnlwlsh

I am working on this myself, but in doing so I refactored a lot of the js code. Now is a bad time to jump into this.

moranje avatar Jun 15 '17 02:06 moranje

I am postponing this feature until next release. Time contrains and all. Thanks for understanding.

Martien

moranje avatar Jun 25 '17 07:06 moranje

Any news on this? :)

Just added a quick dirty fix to calls.js file by replacing the getTasksCapped function with this one:

/**
 * Get a capped list of tasks from Todoist.
 *
 * @author moranje <[email protected]>
 * @since  2016-07-03
 * @return {Object}
 */
function getTasksCapped() {
  var list = [];

  todoist.getTasks( settings.token, function( data ) {
    if ( !Array.isArray( data.items ) ) return error( data );

    data.items.sort(function(a, b){
      return new Date(a.due_date_utc) - new Date(b.due_date_utc);
    })

    data.items.map(function(item) {
      let date = new Date(item.due_date_utc)
      let miliseconds24hours = 1000 * 1 * 60 * 60 * 24

      if(date - Date.now() <= miliseconds24hours) {
        item.content += " (Today)"
      }

      return item
    })

    data.items.forEach( function( task, index ) {
      if ( index < settings.max_items ) {
        list.push( task );
      }
    } );

    return echo( optionList( list ) );
  } );
}

Sorting by due date and appeding (today) for the tasks that due in that day.

carlosflorencio avatar Jan 14 '18 14:01 carlosflorencio

Yeah I have much of the rewritten code finished but I haven't had any time to squash the last bugs and update the test suite between a home make-over, work and my parental duties. I don't have a lot of time to allocate in January. Thanks for helping out.

M

moranje avatar Jan 14 '18 15:01 moranje

:tada: This issue has been resolved in version 6.0.0-alpha.8 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

moranje avatar Feb 16 '20 22:02 moranje