Skip to content

Commit

Permalink
notifications: fix availability delay
Browse files Browse the repository at this point in the history
* The delay for availability notification is set in minutes in the ui/data
but must be passed in seconds to the dispatcher.
* Closes rero#3467.

Co-Authored-by: Pascal Repond <pascal.repond@rero.ch>
  • Loading branch information
PascalRepond committed Oct 17, 2023
1 parent 36fe99e commit 1a9fef4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions rero_ils/modules/notifications/subclasses/availability.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
#
# RERO ILS
# Copyright (C) 2019-2022 RERO
# Copyright (C) 2019-2022 UCLouvain
# Copyright (C) 2019-2023 RERO
# Copyright (C) 2019-2023 UCLouvain
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
Expand Down Expand Up @@ -92,10 +92,11 @@ def get_notification_context(cls, notifications=None):
'delay': 0
}
# Availability notification could be sent with a delay. We need to find
# this delay into the library notifications settings.
# this delay into the library notifications settings and convert it
# from minutes to seconds.
for setting in library.get('notification_settings', []):
if setting['type'] == NotificationType.AVAILABILITY:
context['delay'] = setting.get('delay', 0)
context['delay'] = setting.get('delay', 0)*60
# Add metadata for any ``notification.loan`` of the notifications list
item_dumper = ItemNotificationDumper()
for notification in notifications:
Expand Down

0 comments on commit 1a9fef4

Please sign in to comment.