Open roizner opened 2 months ago
Thank you for opening this issue!
🔔 @thomaslombart @AnishDe12020 @kud @casassg @Princeyadav05 @jfkisafk you might want to have a look.
Could you share some screenshots to see the difference between the tasks in Raycast and Todoist?
For Today tasks in Todoist app (the desired order):
in Raycast:
For sub-tasks in Todoist app (the desired order):
in Raycast:
Here's the code we have related to sorting today tasks in the extension:
export function getTasksForTodayOrUpcomingView(tasks: Task[], userId: string) {
const filteredTasks = tasks.filter((t) => {
if (!t.due) {
return false;
}
if (t.responsible_uid && t.responsible_uid !== userId) {
return false;
}
return true;
});
// Sorts tasks based on the following criteria, in order:
// 1. Due date type (datetime due dates appear first)
// 2. Due date and time (earliest first)
// 3. Priority (highest first)
// 4. Day order (lowest first)
return filteredTasks.sort((a, b) => {
if (!a.due || !b.due) {
return 0;
}
const aIsExactTime = isExactTimeTask(a);
const bIsExactTime = isExactTimeTask(b);
if (aIsExactTime !== bIsExactTime) {
return bIsExactTime ? 1 : -1;
}
const bDue = new Date(b.due.date);
const aDue = new Date(a.due.date);
if (aDue.getTime() !== bDue.getTime()) {
return aDue.getTime() - bDue.getTime();
}
if (a.priority !== b.priority) {
return b.priority - a.priority;
}
return a.day_order - b.day_order;
});
}
day_order
being "the order of the task inside the Today or Next 7 days view (a number, where the smallest value would place the task at the top)." according to Todoist's docs. I don't see how the code could go wrong in your case, so maybe there's a bug in Todoist's APIs 🤔
The problem I see in Today ordering seems to be about recurrent tasks. Todoist shows them on the top in my case, Raycast shows them on the bottom.
Still, if a task is recurring, the day_order
should probably be reflected in both Todoist's UI and API, so I don't think we can do much here apart from contacting their support.
This issue has been automatically marked as stale because it did not have any recent activity.
It will be closed if no further activity occurs in the next 10 days to keep our backlog clean 😊
Extension
https://www.raycast.com/doist/todoist
Raycast Version
1.81.2
macOS Version
14.6.1
Description
The order of the tasks (with Default sorting) in lists is incorrect, i.e. it's not the same as in Todoist app.
Steps To Reproduce
Current Behaviour
The tasks are in some random order.
Expected Behaviour
The tasks should be in the same order as in Todoist.