$def with (loans, action, pagecount=None, pageindex=None, stats=None) $ pdf_count = len([pdf for pdf in loans if pdf['resource_type'] == 'pdf']) $ epub_count = len([epub for epub in loans if epub['resource_type'] == 'epub']) $ bookreader_count = len([bookreader for bookreader in loans if bookreader['resource_type'] == 'bookreader']) $ total = pdf_count + epub_count + bookreader_count + 0.0 $ pdf_percent = "%d" % percentage(pdf_count, total) $ epub_percent = "%d" % percentage(epub_count, total) $ bookreader_percent = "%d" % percentage(bookreader_count, total)
Note: ACS4 loan status for ePub and PDF is updated hourly and also on demand (when a user looks at a borrow page or their own loans). You can refresh the status of a loan (synchronize with ACS4 server) by clicking on "refresh". BookReader loan status is always current.
$# could do user checking here $if True:
$else: THIS PAGE ISN'T UPDATING LIVE.