Compare commits

..

No commits in common. "402b265cdc61aa46d76b3006a8b86fb467d02852" and "0388bb36413c938dd06ec60f8c907676454a7c8d" have entirely different histories.

View File

@ -6,7 +6,6 @@ import boto3
import json
from json import JSONEncoder
import logging
import re
from zoneinfo import ZoneInfo
logging.basicConfig(level=logging.INFO)
class libaccount(dict):
@ -18,7 +17,7 @@ class libaccount(dict):
def toJson(self):
return json.dumps(self,default=lambda o: o.__dict__)
class book():
def __init__(self,itemid,renewalcount,checkoutdate,duedate,vendor,resourceid,title,materialtype,coverurl,person,authsession,renewresult,overdue,isbn,isill):
def __init__(self,itemid,renewalcount,checkoutdate,duedate,vendor,resourceid,title,materialtype,coverurl,person,authsession,renewresult,overdue,isbn):
self.id=itemid
self.renewalcount=renewalcount
self.checkoutdate=checkoutdate
@ -33,7 +32,6 @@ class book():
self.renewresult=renewresult
self.overdue=overdue
self.isbn=isbn
self.isill=isill
#self.ill=ill
def print(self):
print(self.person, self.id, self.title, self.checkoutdate, self.renewalcount, self.duedate, self.materialtype,self.renewresult, self.isbn)
@ -138,9 +136,7 @@ for myaccount in accounts:
try:
myisbn = mybook['resource']['coverUrl']['small'].split('=')[1].split("/")[0]
except:
myisbn=''
if re.match("*ILL",mybook['resource']['title']):
isill=True
myisbn=''
try:
mycoverurl = mybook['resource']['coverUrl']['small']
except:
@ -169,8 +165,7 @@ for myaccount in accounts:
session,
'None',
overdue,
myisbn,
isill
myisbn
)
if thisbook.materialtype in mediatypes:
pass
@ -215,20 +210,6 @@ for account in accounts:
returntable += "<tr><td>" + account.name + td + str(accountcount) + "</td></tr>"
totalcheckedout = len(allbooks)
returntable += "<tr><td><b>Total" + td + str(totalcheckedout) + "</b></td></tr>" + tableend + "<BR>"
ills = [d for d in allbooks if (d.isill==True)]
if len(ills) >=1:
returntable += tablestart + '<colgroup><col/><col/></colgroup><tr><th>Type'+ th +'Count</th></tr>'
for type in mediatypes:
typecount = sum(b.materialtype == type for b in ills)
if typecount>0:
returntable += "<tr><td>" + type + td + str(typecount) + "</td></tr>"
totalreturnbooks = len(ills)
returntable += "<tr><td><b>" + "Total" + td + str(totalreturnbooks) + "</b></td></tr>"
returntable += tableend + "<br>"
returntable += tablestart + "<colgroup><col/><col/><col/><col/><col/><col/><col/><col/></colgroup><tr><th>Name"+th+"Type"+th+"Times Renewed"+ th + "Renewal Status" + th+"Checked Out"+th+"Due Date"+th+"Title" + th + "ISBN" + th + "Thumbnail</th></tr>"
for item in ills:
returntable += "<TR><TD>" + item.person + td + item.materialtype + td + str(item.renewalcount) + td + str(item.renewresult)+ td + str(item.checkoutdate) + td + str(item.duedate) + td + item.title + td + item.isbn + td +'<img src="'+ item.coverurl+'">' +"</td></tr>\n"
returntable += tableend + "<BR>"
duesoon = [d for d in allbooks if (d.duedate < datetime.date.today() + datetime.timedelta(days=10)) and not (str(d.renewresult).lower() == 'None'.lower())]
if len(duesoon) >=1:
returntable += tablestart + '<colgroup><col/><col/></colgroup><tr><th>Type'+ th +'Count</th></tr>'