akarri2001 / Notion-and-Google-Calendar-2-Way-Sync

2 Way Sync Between Notion Database and Google Calendar
GNU General Public License v3.0
352 stars 50 forks source link

Existing tasks will be duplicated if there are more than 100 tasks in Notion's database #8

Closed JulyFaraway closed 2 years ago

JulyFaraway commented 3 years ago

Thanks again for the great code.

Now, when I was running this code, it sometimes generated duplicate tasks in the database. Apparently, there is a problem with the procedure in Part 4 that looks for calendar events that don't exist in Notion.

my_page = notion.databases.query( **{ "database_id": database_id, "filter": { "property": GCalEventId_Notion_Name, "text": { "is_not_empty": True } } }, )

In the Notion API, query responses are limited to 100 at a time. If there are more than 101 tasks, the IDs contained in the 101st task will not be used for comparison. Therefore, the program will overlook the IDs that should already be there, so it will add a new column of Notion.

I can't think of a solution right away, so I'll post it in an issue.

akarri2001 commented 3 years ago

Hey! Thanks for bringing this up, I actually didn't know that the query responses were so limited! The only solution that I could think of is basically exporting the Notion Dashboard to a CSV file using multiple calls of the API and then using the CSV to put everything into the Google Calendar, but that'll be a whole another project.