@@ -346,22 +346,22 @@ def _check_notifications(message: dict, murfey_db: Session) -> None:
346346 select (DataCollection , ProcessingJob , AutoProcProgram )
347347 .where (ProcessingJob .dc_id == DataCollection .id )
348348 .where (AutoProcProgram .pj_id == ProcessingJob .id )
349- .where (AutoProcProgram == message ["program_id" ])
349+ .where (AutoProcProgram . id == message ["program_id" ])
350350 ).all ()
351351 dcgid = data_collection_hierarchy [0 ][0 ].dcg_id
352352 notification_parameters = murfey_db .exec (
353353 select (NotificationParameter ).where (NotificationParameter .dcg_id == dcgid )
354354 ).all ()
355355 failures = []
356356 for param in notification_parameters :
357+ param_value_to_drop = None
357358 if message .get (param .name ) is not None :
358359 param_values = murfey_db .exec (
359360 select (NotificationValue ).where (
360361 NotificationValue .notification_parameter_id == param .id
361362 )
362363 ).all ()
363364 param_values .sort (ley = lambda x : x .index )
364- param_value_to_drop = None
365365 if len (param_values ) >= 25 :
366366 param_value_to_drop = param_values [0 ]
367367 param_values = param_values [1 :]
@@ -391,7 +391,7 @@ def _check_notifications(message: dict, murfey_db: Session) -> None:
391391 if param_value_to_drop is not None :
392392 murfey_db .delete (param_value_to_drop )
393393 murfey_db .add (param_values [- 1 ])
394- murfey_db .add (notification_parameters )
394+ murfey_db .add_all (notification_parameters )
395395 murfey_db .commit ()
396396 murfey_db .close ()
397397 if failures :
0 commit comments