Compare commits
	
		
			36 Commits
		
	
	
		
			0388bb3641
			...
			402b265cdc
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 402b265cdc | |||
| cb53ade476 | |||
| c73f91afe2 | |||
| eb6c9931df | |||
| 6deb3b4f3b | |||
| abf5ba1952 | |||
| 8bdaf5c1b9 | |||
| 0dc6a1d8c7 | |||
| a32b996b13 | |||
| 750ab3d85d | |||
| 8dcac00c34 | |||
| ec359b924e | |||
| d79b734f2f | |||
| 35b203cc31 | |||
| 078a1601fa | |||
| 2584ec7c14 | |||
| b1c6a289fa | |||
| 09eb639175 | |||
| cf834cadaf | |||
| 11eff2d940 | |||
| 48f4fc60ae | |||
| 1ee6e95c05 | |||
| 27643697a7 | |||
| 913e8a63b3 | |||
| f5933d0b62 | |||
| e4bee8268f | |||
| 165d1e0f24 | |||
| f66d597061 | |||
| 4f2ade7423 | |||
| db9c779dae | |||
| d1a64d6538 | |||
| 2c1e992147 | |||
| a440a9fe3c | |||
| f832bd2a9d | |||
| b24da075b8 | |||
| fe9da6064d | 
| @@ -6,6 +6,7 @@ import boto3 | |||||||
| import json | import json | ||||||
| from json import JSONEncoder | from json import JSONEncoder | ||||||
| import logging | import logging | ||||||
|  | import re | ||||||
| from zoneinfo import ZoneInfo | from zoneinfo import ZoneInfo | ||||||
| logging.basicConfig(level=logging.INFO) | logging.basicConfig(level=logging.INFO) | ||||||
| class libaccount(dict): | class libaccount(dict): | ||||||
| @@ -17,7 +18,7 @@ class libaccount(dict): | |||||||
|     def toJson(self): |     def toJson(self): | ||||||
|         return json.dumps(self,default=lambda o: o.__dict__) |         return json.dumps(self,default=lambda o: o.__dict__) | ||||||
| class book(): | class book(): | ||||||
|     def __init__(self,itemid,renewalcount,checkoutdate,duedate,vendor,resourceid,title,materialtype,coverurl,person,authsession,renewresult,overdue,isbn): |     def __init__(self,itemid,renewalcount,checkoutdate,duedate,vendor,resourceid,title,materialtype,coverurl,person,authsession,renewresult,overdue,isbn,isill): | ||||||
|         self.id=itemid |         self.id=itemid | ||||||
|         self.renewalcount=renewalcount |         self.renewalcount=renewalcount | ||||||
|         self.checkoutdate=checkoutdate |         self.checkoutdate=checkoutdate | ||||||
| @@ -32,6 +33,7 @@ class book(): | |||||||
|         self.renewresult=renewresult |         self.renewresult=renewresult | ||||||
|         self.overdue=overdue |         self.overdue=overdue | ||||||
|         self.isbn=isbn |         self.isbn=isbn | ||||||
|  |         self.isill=isill | ||||||
|         #self.ill=ill |         #self.ill=ill | ||||||
|     def print(self): |     def print(self): | ||||||
|         print(self.person, self.id, self.title, self.checkoutdate, self.renewalcount, self.duedate, self.materialtype,self.renewresult, self.isbn) |         print(self.person, self.id, self.title, self.checkoutdate, self.renewalcount, self.duedate, self.materialtype,self.renewresult, self.isbn) | ||||||
| @@ -137,6 +139,8 @@ for myaccount in accounts: | |||||||
|                 myisbn = mybook['resource']['coverUrl']['small'].split('=')[1].split("/")[0] |                 myisbn = mybook['resource']['coverUrl']['small'].split('=')[1].split("/")[0] | ||||||
|             except: |             except: | ||||||
|                 myisbn='' |                 myisbn='' | ||||||
|  |                 if re.match("*ILL",mybook['resource']['title']): | ||||||
|  |                     isill=True | ||||||
|             try: |             try: | ||||||
|                 mycoverurl = mybook['resource']['coverUrl']['small'] |                 mycoverurl = mybook['resource']['coverUrl']['small'] | ||||||
|             except: |             except: | ||||||
| @@ -165,7 +169,8 @@ for myaccount in accounts: | |||||||
|                     session, |                     session, | ||||||
|                     'None', |                     'None', | ||||||
|                     overdue, |                     overdue, | ||||||
|                     myisbn |                     myisbn, | ||||||
|  |                     isill | ||||||
|                     ) |                     ) | ||||||
|                 if thisbook.materialtype in mediatypes: |                 if thisbook.materialtype in mediatypes: | ||||||
|                     pass |                     pass | ||||||
| @@ -210,6 +215,20 @@ for account in accounts: | |||||||
|         returntable += "<tr><td>" + account.name + td + str(accountcount) + "</td></tr>" |         returntable += "<tr><td>" + account.name + td + str(accountcount) + "</td></tr>" | ||||||
| totalcheckedout = len(allbooks) | totalcheckedout = len(allbooks) | ||||||
| returntable += "<tr><td><b>Total" + td + str(totalcheckedout) + "</b></td></tr>" + tableend + "<BR>" | 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())] | 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: | if len(duesoon) >=1: | ||||||
|     returntable += tablestart + '<colgroup><col/><col/></colgroup><tr><th>Type'+ th +'Count</th></tr>' |     returntable += tablestart + '<colgroup><col/><col/></colgroup><tr><th>Type'+ th +'Count</th></tr>' | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user