Expiring Reservations

A reservation for an item should expire if a member who had reserved the item failed to borrow the item within a certain time frame after the item became available (see requirements). The system, therefore, needs to check “offered” reservations regularly to see if any of them have expired and if so, change their status to "Expired".

The feature of the Configuration Tool that allows checking something at regular time intervals is called “Scheduling” (see also Scheduling ). Basically you define rules that specify how often checks are being made. The check itself has to be defined as a process. In our case we need to define a process that will check the “offered” reservations and change their status if necessary. This process will be regularly called by the scheduling rules.

So we start by defining the ExpireReservations process that does not require any input and has the following actions:

FIND Reservation WHERE 
 Reservation.Status='Offered' 
 AND 
 DAY_DIFFERENCE(Reservation.ItemOfferedOn,CURRENT_DATE)>6
Reservation.Status = 'Expired' 

The first action finds all reservations in the “Offered” state that have been offered more than 6 days before the day when the check is being made. The second action changes the status of the reservation to “Expired”. Note that Aware IM will automatically change the state of all reservations found by the previous action. If no reservations were found Aware IM will do nothing.

Now that we have defined the process we need to define when this process is going to be called. We right click on the “Scheduling” node in the Elements Tree and select “New” from the pop-up menu. We then click on the icon to add a new scheduling rule. We add the name of the rule and the rule entry appears in the list of rules. We can now use the Standard View to add the rule itself. We select the “Daily” radio button and specify the time of the day when the system will start the process, for example 01:00. Then we select the ExpireReservations as the process that the system will run. We can now click on the “Save” button to save the changes.

  • Last modified: 2022/09/13 18:15