scottquach / Canvas-Assignments-Transfer-For-Todoist

Transfer your school assignments from Canvas to Todoist
MIT License
41 stars 19 forks source link

Add option to ignore due time #44

Closed afroemming closed 9 months ago

afroemming commented 9 months ago

Rationale

Some teachers set the due dates of their assignments to 11:59pm, which doesn't translate well when Todoist is integrated with a calendar.

Proposed changes

  1. Add new advanced config. option "ignore-time", which when true will have the program push only the due dates set in canvas, ignoring the exact time.

I plan to implement this and submit a pull request.

stacksjb commented 9 months ago

Hi @afroemming !

Help me understand this more - are you saying that the due date time doesn't come through correctly?

I'm trying to understand why you would prefer to ignore the due time. To me, that seems to defeat the purpose because if something is due anytime earlier in the day (say 3pm), todoist would just show it as due on that day. I have several teachers that set for due at 11:59pm and it seems to come through correctly for me.

Also, can you confirm your todoist timezone is set correctly?

afroemming commented 9 months ago

In Todoist itself, everything is fine.

Really, this would be a workaround for an annoyance w/ Todoist/ Google Calendar integration. That integration forces an arbitrary duration in the events it creates in GCal for tasks in Todoist with no duration, which, for assignments due at the end of the day, makes them spill over two days, which is confusing/ annoying looking at Google Calendar. This change would make that specific flow cleaner by making the tasks in Todoist be pulled in GCal as all day events over a single day.

Albeit, the specific time would be thrown away, but the other approach I can think of (offsetting the due time sent to Todoist such that the events that will be created in GCal would end at the due time) seems kinda icky in that what would be in Todoist would be a slight lie.

stacksjb commented 9 months ago

What is your default Todoist calendar duration? Setting that to 0m might fix it (or we could add a duration to them explicitly?)

Todoist has deprecated the duration feature though; the intent is to use the new duration built into Todoist. Has this showed up more recently?

stacksjb commented 9 months ago

What settings do you have under your Google Calendar connection?

TBH, Todoist has admitted that their integration is a bit of a kludge and decided to focus more on the calendaring view built into Todoist (I generally use the Todoist calendar subscription).

You can set the option for "Todoist tasks without a start time and duration or all-day Google Calendar events should not sync", but that might mean they don't show up.

When I look at my events, they show up at the end of the day despite the 15m duration and don't show up on the next day; if you were to just sync the day without the time they would then show up as an all-day event (which means that, depending on your Todoist/Calendar sync settings, they wouldn't sync at all in my use case).

image

stacksjb commented 9 months ago

n. That integration forces an arbitrary duration in the events it creates in GCal for tasks in Todoist with no duration, which, for assignments due at the end of the day, makes them spill over two days, which is confusing/ annoying looking at Google Calendar.

I don't see that in my Google Calendar (see screenshot), but could easily be addressed by forcing the duration to 0m. This might require more work though compared to historically since Todoist now requires Duration as part of task creation object and has deprecated the [time] format.

afroemming commented 9 months ago

Oh you're right, it does look fine in GCal. In my case, I guess it's actually from the additional layer of how the calendar event is displayed in Outlook, connected to my GCal.

Screenshot 2024-01-23 165356

Also, here's the integration settings I have set: image

afroemming commented 9 months ago

Anyways, the change is suggested would be pretty simple: core of it would just be to make it possible to switch out due_* for a different field name and strip the assignment due time to 10 chars so it's just a date.

I could submit such changes very quickly if it were legal to modify this program. . . .

stacksjb commented 9 months ago

It's absolutely legal (I agree the license needs to be updated - I'll send a PR through once I confirm with @scottquach - And of course, you are absolutely welcome to fork and use the code however you wish!), I'm just trying to determine the best way of addressing it.

I just don't think I'm comfortable with stripping due times from the tasks, because the due timestamp is used in comparison of updating, so then they won't match, which would break update logic as well. I think the typical use case is going to be to expect that to be correct.

I think a better method would be to set the duration of the tasks to 0m, so that they transfer through without the 15 minute chunk. Can you test updating a task with the 0 minute duration and see if that addresses your issue?

The syntax is "For [duration]", so "for 0 minutes" (the other method of [0m] will still work currently as well)

It's certainly unfortunate Outlook doesn't give you an option to customize how that is displayed! Not a problem specific to Todoist or otherwise.

afroemming commented 9 months ago

I'm not sure that's permitted: the api docs say "duration" must be > 0.

stacksjb commented 9 months ago

I just tested in the Todoist client and it took a duration of 0 minutes - that said 1 minute should work too!

afroemming commented 9 months ago

because the due timestamp is used in comparison of updating, so then they won't match, which would break update logic as well

It actually doesn't if you do it in the right place! The version I have on my computer now can seamlessly switch between stripping and not if you go in and edit the config between runs.

afroemming commented 9 months ago

I just tested in the Todoist client and it took a duration of 0 minutes - that said 1 minute should work too!

It works now, but I'm not sure I'd trust it will stay that way.

afroemming commented 9 months ago

It actually doesn't if you do it in the right place! The version I have on my computer now can seamlessly switch between stripping and not if you go in and edit the config between runs.

see https://github.com/afroemming/Canvas-Assignments-Transfer-For-Todoist/tree/ignore-time

afroemming commented 9 months ago

I think a better method would be to set the duration of the tasks to 0m, so that they transfer through without the 15 minute chunk. Can you test updating a task with the 0 minute duration and see if that addresses your issue?

The syntax is "For [duration]", so "for 0 minutes" (the other method of [0m] will still work currently as well)

At least for me, in the todoist web ui this doesn't work

image image

stacksjb commented 9 months ago

That looks correct to me, it highlighted, did you save? I tested and it worked from my perspective. (You could also try 1 minute).

The Todoist->Google Calendar Sync does take some time to refresh; you would probably have to force refresh it. It can be rather delayed and/or buggy - this is a well known issue by Todoist. I personally wouldn't recommend relying on it or using it - a better option is to subscribe to your Todoist list as a calendar subscription, so you're pulling directly from Todoist.

stacksjb commented 9 months ago

I'm glad a code tweak works for you, and you're welcome to change the code for your use.

That said, I'm not interested in pulling it in this suggested change. 1) I would consider this a hack to work around Outlook and the buggy Google Calendar integration with Todoist (which is already known and admitted by Todoist) - not an issue with dates as they are in Canvas & Todoist 2) Due within Todoist should match when they are accurately due, they shouldn't be modified from the authoritative source (for example, an earlier request to modify due dates to earlier time was also rejected, https://github.com/scottquach/Canvas-Assignments-Transfer-For-Todoist/issues/14, with the suggestion that you can just create a filter in Todoist for "Due tomorrow" if you want them to be worked a day early)

That said, this current commit is several behind some other updates I have made, and my long term goal is to make some updates to this to integrate with several of the other new Todoist features and additional Canvas APIs (as well as probably rewrite to utilize the Canvas library instead of directly), so I will keep this in mind for the backlog.

stacksjb commented 9 months ago

I just tested in the Todoist client and it took a duration of 0 minutes - that said 1 minute should work too!

It works now, but I'm not sure I'd trust it will stay that way.

Did you ever confirm if the duration tweak works? I think that would be easy for me to add if that's an option.