Datetime in "signals.event.session_block_updated" is not updated

I am hooking into the “signals.event.session_block_updated” signal to update some services on our site.
When I drag and drop my Session block in the Timetable, the datetime value I get in the hook is still set to the old value and not to the current date/time slot it was dropped in.
Is this by design?
The “signals.event.times_changed” signal for SessionBlock correctly has the date/time value though.
Here is how things look:


self.connect(signals.event.session_block_updated, self._session_block_updated)
self.connect(signals.event.times_changed, self._event_time_changed, sender=SessionBlock)

my hooks:

def _session_block_updated(self, session_block, **kwargs):
        d = session_block.start_dt.astimezone(session_block.event.tzinfo)
        print('FROM: "signals.event.session_block_updated", datetime: ', d)
def _event_time_changed(self, sender, obj, **kwargs):
        event = obj
        d = event.start_dt.astimezone(event.event.tzinfo)
        print('FROM "signals.event.times_changed", datetime: ', d)
        print(sender, '_event_time_changed SENDER') 

I get this in the logs (notice the times difference by 30 minutes: 12:00 being the correct current time ):

| 2023-10-31 15:48:59,672  INFO     f7f89298f79d4f1c  indico.rh                 GET /event/56/manage/timetable/entry/99/info [IP=] [PID=5427]
| 2023-10-31 15:49:01,809  INFO     6ef644238b9e42a6  indico.rh                 POST /event/56/manage/timetable/entry/99/edit/datetime [IP=] [PID=5433]
| FROM: "signals.event.session_block_updated", datetime:  2023-10-30 **12:30:00-04:00**
| 2023-10-31 15:49:02,402  INFO     6ef644238b9e42a6    Session block <SessionBlock(21): "My session block."> modified by <User(12, "My name">
| FROM "signals.event.times_changed", datetime:  2023-10-30 **12:00:00-04:00**
| <class ''> _event_time_changed SENDER


This is expected. Since time changes may cause time changes for other elements, they are grouped together and use this separate signal.

I suggest having a look at the signal handling in our livesync plugin - basically we record the kind of changes we care about, and then when the request has been fully processed, trigger whatever action is needed.

Thanks for the fast response. I will take a look at the the plugin you suggest.
I need to listen to both signals to update changes to the title and date time (we are creating/updating Jira tickets)
But I am only updating those Jira tickets once! So basically it’s the data from the first hook that I use to update Jira and in this case it’s the data from the “block_updated” which has the wrong date/time

My suggestion will do exactly what you need :slight_smile: