Forum OpenACS Development: Re: Calendar pkg: call_item and acs_activity

Collapse
Posted by Gustaf Neumann on

I've looked into the problem. Iuri is right, there is a problem of acs_activities not being reclaimed. However, the situation is tricky and depends on some details, especially with recurrences.

  • calendar entries with recurrences: when a calender entry is created, which contains recurrences, technically the calendar entry generates multiple cal_items (and acs_events) all pointing to a single activity_id. A user has the option to delete each of these cal_items separately, only when the last of these cal_items is deleted, the activity_id (and the recurrence_id) could be deleted.

  • calendar entries without recurrences: when the cal_item is deleted, the activity_id could be deleted as well.

The problem is that neither the activity_id nor the the recurrence_id are deleted, even when they could. For more details, see the new test case i have added to the code repository just now.

As a consequence of this, orphan acs_activities (and potentially recurrences) might be kept in the system. When only calendar created acs_activities and recurrences, the following two queries should return 0.

select count(*) from acs_activities where activity_id in (select activity_id from acs_activities except select activity_id from acs_events);
select count(*) from recurrences where recurrence_id in (select recurrence_id from recurrences except select recurrence_id from acs_events);

i'll prepare a patch and commit it in the near future.