@@ -564,7 +564,9 @@ def get_next_booking(self, system_id):
564
564
"""Wrapper for `get_booking()` with 'booking_type' set to 'next'."""
565
565
return self .get_booking (system_id , "next" )
566
566
567
- def get_running_sheet (self , core_facility_ref , date , ignore_uncached_users = False ):
567
+ def get_running_sheet (
568
+ self , core_facility_ref , date , ignore_uncached_users = False , localisation = ""
569
+ ):
568
570
"""Get the running sheet for a specific day on the given facility.
569
571
570
572
The so-called "running-sheet" consists of all bookings / reservations of
@@ -585,6 +587,9 @@ def get_running_sheet(self, core_facility_ref, date, ignore_uncached_users=False
585
587
ignore_uncached_users : bool, optional
586
588
If set to `True` any booking for a user that is not present in the instance
587
589
attribute `fullname_mapping` will be ignored in the resulting list.
590
+ localisation : str, optional
591
+ If given, the runningsheet will be limited to systems where the
592
+ `localisation` (~"room") field matches the given value.
588
593
589
594
Returns
590
595
-------
@@ -628,8 +633,19 @@ def get_running_sheet(self, core_facility_ref, date, ignore_uncached_users=False
628
633
f"Booking for user '{ self .fullname_mapping [full ]} ' ({ full } ) found"
629
634
)
630
635
system_name = entry ["Object" ]
631
- system_ids = self .get_systems_matching ("" , [system_name ])
632
- if len (system_ids ) != 1 :
636
+ # FIXME: add a test with one system name being a subset of another system
637
+ # (this will result in more than one result and should be fixed e.g. by
638
+ # adding an optional parameter "exact" to get_systems_matching() or
639
+ # similar)
640
+ system_ids = self .get_systems_matching (localisation , [system_name ])
641
+ if len (system_ids ) < 1 :
642
+ if localisation :
643
+ log .debug (f"Given criteria return zero systems for [{ system_name } ]" )
644
+ else :
645
+ log .warning (f"No systems matching criteria for [{ system_name } ]" )
646
+ continue
647
+
648
+ if len (system_ids ) > 1 :
633
649
# NOTE: more than one result should not happen as PPMS doesn't allow for
634
650
# multiple systems having the same name - no result might happen though!
635
651
log .error ("Ignoring booking for unknown system [{}]" , system_name )
0 commit comments