Bug 291531 - Akonadi Google Calendar: recurring events don't appear, duplicate events
Summary: Akonadi Google Calendar: recurring events don't appear, duplicate events
Status: RESOLVED FIXED
Alias: None
Product: libkgapi
Classification: Frameworks and Libraries
Component: calendar (other bugs)
Version First Reported In: GIT
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Daniel Vrátil
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-14 17:13 UTC by Unknown
Modified: 2012-04-12 20:21 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
.xsession-errors output (32.03 KB, application/octet-stream)
2012-01-18 14:22 UTC, Unknown
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Unknown 2012-01-14 17:13:18 UTC
Version:           GIT (using KDE 4.7.4) 
OS:                Linux

after adding the akonadi "google calendar" resource and connecting to a google calendar:

1. Events created in Google Calendar - the website:
I am unable to view previously created / "old" recurring events in Kontact/Calendar. However, if I create a new (recurring) event now (on the Google Calendar website), it does appear in Kontact/Calendar. This leads me to conclude that there must be some kind of difference between how the recurring events are stored in Google Calendar (the website). All non-recurring events are shown fine in Kontact.

2. Events created in Kontact / Calendar:
When creating a new non-recurring event in Kontact, It appears fine in Google Calendar (the website). However, when doing a folder refresh in Kontact (right-click the calendar in Kontact, and click 'update calendar folder'), that same event suddenly appears twice in Kontact (and just once in Google Calendar as its supposed to). This does not happen for recurring events created in Kontact.

remarks:
- This is a fresh install of Arch Linux with KDE 4.7.4. Creating a new user or deleting / recreating the .kde4 folder seems pointless so I haven't tried it yet.
- The recurring events that don't appear in (1), do seem to be loaded in the akonadi resource. Opening the "Akonadi Console" -> browser tab -> select the calendar resource, brings up a complete list of both recurring and non-recurring events with their remote ID.
-I'm using just one calendar: just the remote google calendar. No local calendars.


Reproducible: Always

Steps to Reproduce:
(1):
- create a resource for Google Calendar and connect to a calendar,
- Open Kontact -> Calendar,
- right-click on the calendar and click 'update calendar folder'
- Result: Only the non-recurring events appear, not the recurring ones.
- Open the Google Calendar website
- Create a new recurring event
- Go back to Kontact and do a folder refresh,
- Result: the new recurring event appears fine.

(2):
- create a resource for Google Calendar and connect to a calendar,
- Open Kontact -> Calendar,
- create a new non-recurring event in Kontact,
- right-click on the calendar and click 'update calendar folder',
- Result: the newly created event appears to be duplicated in Kontact, but not in Google Calendar (the website).
- Create a new recurring event in Kontact,
- right-click on the calendar and click 'update calendar folder',
- Result: recurring event appears fine (just once) in both Kontact and Google Calendar.



Actual Results:  
(1): old recurring events don't appear
(2): duplicates appear from created (non-recurring) events in Kontact

Expected Results:  
(1): old recurring events appear
(2): no duplicates appear

- This is a fresh install of Arch Linux with KDE 4.7.4. Creating a new user or deleting / recreating the .kde4 folder seems pointless so I haven't tried it yet.
- The recurring events that don't appear in (1), do seem to be loaded in the akonadi resource. Opening the "Akonadi Console" -> browser tab -> select the calendar resource, brings up a complete list of both recurring and non-recurring events with their remote ID.
Comment 1 Daniel Vrátil 2012-01-17 21:11:39 UTC
Hi,

thanks for taking time to report this. 

Could you please tell me when the "old" recurrent events were created? My oldest event in Google calendar is about year old, which is probably not "old" enough.

Could you please also provide more debug info? Following steps describe what to do:

1) recompile Akonadi Google with -DDEBUG_RAWDATA=TRUE CMake switch. This will make libkgoogle to log the raw replies it receives/sends to Google
2) make sure akonadi_googlecalendar_resource debugging is enabled in KDebugDialog
3) restart Akonadi (akonadictl restart)
4) open Akonadi Console
5) in Agents tab, right click the Google Calendar resource and select Configure -> Configure Remotely
6) delete the value of "LastSync" property (this will force the resource to fetch all events in the calendar again), Save, Close
7) right click the resource again and select Synchronize -> Synchronize All
8) when calendar is synchronized, open .xsession-errors log file and try to grep for one of the recurrent events that are not displayed in the KOrganizer (by some specific name, title etc.). If you find it, please post here some part of the reply (the row with the result + a few rows above and below it). If you don't find it, report as well. libkgoogle might just not be fetching events that are "too old".

I hope it's not too complex :) Thanks.

Regarding the second issue, it seems to be still appearing though I have fixed it already a few times, I'll take a look on it later :) 

PS: Next time please split it to two bugs, it's easier to trace progress on both individually, thanks.
Comment 2 Unknown 2012-01-17 23:28:35 UTC
as for your comment about filing 2 bugs: yeah, you're right, I was lazy, just say it. :-) Anyway, it turns out I was testing with a wrong (older) version, so you can forget all about (2).. no more duplicates with akonadi-google-git-20120117.

(1) still occurs, I will try the steps you mentioned within a day.
Comment 3 Unknown 2012-01-18 13:05:59 UTC
(1): About the "old" recurring events: turns out it has nothing to do with the age of those events. It's happening with recurring events that last a full day (f.i. birthdays). If I create those in Google Calendar, they don't appear in Kontact. However, if I create that same kind of event in Kontact, it appears fine in both Kontact and Google Calendar. 

So, there's a difference between the full day,recurring events created in Google Calendar,  and those created in Kontact. So I figured that this difference should appear in Akonadi Console as well. Weird thing is, that the event created in Kontact creates two new Akonadi ID's: one *without* a remote ID, and one *with* a remote ID. Here's the output of the three akonadi id's:

- Recurring (yearly), full day event, created in Google Calendar:
BEGIN:VCALENDAR
PRODID:-//K Desktop Environment//NONSGML libkcal 3.2//EN
VERSION:2.0
BEGIN:VEVENT
CREATED:20120118T124508Z
ORGANIZER;
ATTENDEE;
 ROLE=
DTSTAMP:20120118T124305Z
UID:14egv2qftt2rma8pi90g2lj8hc
LAST-MODIFIED:20120118T124305Z
SUMMARY:recurring\, full day event\, created in GC
STATUS:CONFIRMED
RRULE:FREQ=YEARLY
TRANSP:OPAQUE
BEGIN:VALARM
DESCRIPTION:
ACTION:DISPLAY
TRIGGER;VALUE=DURATION:-PT10M
X-KDE-KCALCORE-ENABLED:TRUE
END:VALARM
END:VEVENT

END:VCALENDAR

- Recurring (yearly), full day event, created in Kontact (no remote ID):
BEGIN:VCALENDAR
PRODID:-//K Desktop Environment//NONSGML libkcal 3.2//EN
VERSION:2.0
BEGIN:VEVENT
CREATED:20120118T125800Z
ORGANIZER;CN="no (valid) identities found":MAILTO:invalid@email.address
DTSTAMP:20120118T124818Z
UID:6d8fa2c9-11a4-4523-896a-64704285f95f
LAST-MODIFIED:20120118T124818Z
SUMMARY:recurring\, full day event\, created in Kontact
RRULE:FREQ=YEARLY;BYMONTHDAY=24;BYMONTH=1
DTSTART;VALUE=DATE:20120124
DTEND;VALUE=DATE:20120125
TRANSP:OPAQUE
END:VEVENT

END:VCALENDAR

- Recurring (yearly), full day event, created in Kontact (with remote ID):
BEGIN:VCALENDAR
PRODID:-//K Desktop Environment//NONSGML libkcal 3.2//EN
VERSION:2.0
BEGIN:VEVENT
CREATED:20120118T125834Z
ORGANIZER;
ATTENDEE;
 ROLE=
DTSTAMP:20120118T124923Z
UID:tcr62rh0spm60vhqbu6rcj8dac
LAST-MODIFIED:20120118T124923Z
SUMMARY:recurring\, full day event\, created in Kontact
STATUS:CONFIRMED
RRULE:FREQ=YEARLY;BYMONTHDAY=24;BYMONTH=1
TRANSP:OPAQUE
END:VEVENT

END:VCALENDAR

I hope this will give you a clue as to what's going on. With a bit of luck, you can reproduce it yourself easily. If not, I can still follow the instructions in your last message.. just say so if I should. 

As for (2): hm, seems I was too quick to tell you that this problem is solved. After creating a non-recurring event in Kontact, it will appear duplicated in Kontact after a restart of Akonadi. This doesn't happen if the event is created in Google Calendar. But let's concentrate on (1) here, i will file a new bug for (2).
Comment 4 Unknown 2012-01-18 14:22:23 UTC
Created attachment 67967 [details]
.xsession-errors output
Comment 5 Unknown 2012-01-18 14:25:50 UTC
Followed the steps you described anyway. .xsession-errors attached above. To compile with the cmake switch, I adapted the PKGBUILD (arch Linux) as follows:

build() {
  cd "$srcdir"
  msg "Connecting to GIT server...."

  if [ -d $_gitname ] ; then
    cd $_gitname && git pull origin
    msg "The local files are updated."
  else
    git clone $_gitroot $_gitname
  fi

  msg "GIT checkout done or server timeout"
  msg "Starting make..."

  rm -rf "$srcdir/build"
  mkdir "$srcdir/build"
  cd "$srcdir/build"

  cmake ../${_gitname} \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` \
    -DDEBUG_RAWDATA=TRUE
  make
}

I hope this is correct.. I think it compiled fine.
Comment 6 Daniel Vrátil 2012-01-18 14:38:46 UTC
Looks great, I'll analyze it, hopefully till the end of the week. Thank you very much.
Comment 7 Unknown 2012-01-30 18:54:24 UTC
By the way, this is a regression. Not sure if this is any help, but git commit 
294e6430bb9bd10286c14acd23a1fa29d748c62d
was still working. (that is: recurring all-day events appear fine). Not sure where it went wrong after that, I don't know how to easily compile a different git commit (yet ;-)).

A possible cause could be:

commit 21498f8a94eb680af38bbb5783270f0f7599accf
Date:   Tue Sep 6 18:09:21 2011 +0200

    Fix length of all-day events (bug #281455)
    
    Google defines single-day all-day event as 2011-05-20 - 2011-05-21,
    but in KDE we define such event as 2011-05-20 - 2011-05-20 + allDay
    property.
Comment 8 Unknown 2012-01-30 22:57:56 UTC
the DTSTART and DTEND properties are missing. So only this part of the code in calendar.cpp is actually entered:

    } else if (rec.left(5) == "RRULE") {
      ICalFormat format;
      RecurrenceRule *recurrenceRule = object->recurrence()->defaultRRule(true);
      format.fromString(recurrenceRule, rec.mid(6));

As far as I can tell, object->setDtStart(dtStart) and object->setDtEnd(dtEnd) and object->setAllDay will never be set. The missing DTSTART and DTEND properties should be there, because in the older git checkout mentioned above, they are there. So, my guess is that they are never retrieved...?
Comment 9 Daniel Vrátil 2012-03-04 14:22:24 UTC
Hi,

the issue with all-day recurrent events not displaying is now fixed in git master.

Fixed by commits master/499623dad6ccd4f06e816e74d9f643f028d359c5 and master/7920e66708817ea5cfdeb7ffb68dd0153c05d8c1.

The problem with duplicate events was reported to be already resolved (comment #2)
Comment 10 bernard.nysten 2012-03-28 17:42:37 UTC
You say it's solved but I still have the problem, old and new recurrent events created in Google calandar don't appear in Korganizer...
Comment 11 Daniel Vrátil 2012-04-12 20:21:32 UTC
Could you please try to reproduce the issue with Akonadi Google 0.3? Thanks