From 362e57c77070122bb31d89814eab8a13b768891e Mon Sep 17 00:00:00 2001 From: Dan Hamik Date: Tue, 26 Nov 2024 00:09:58 -0600 Subject: [PATCH] adding section for per person count --- libnotices.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/libnotices.py b/libnotices.py index 10c2078..abf4def 100644 --- a/libnotices.py +++ b/libnotices.py @@ -141,6 +141,10 @@ for myaccount in accounts: mycoverurl = mybook['resource']['coverUrl']['small'] except: mycoverurl = '' + try: + myresourceid=mybook['resource']['id'] + except: + myresourceid='' duedate = datetime.datetime.strptime(mybook['dueDate'].split('T')[0],'%Y-%m-%d').date() if datetime.date.today() > duedate: overdue=True @@ -153,7 +157,7 @@ for myaccount in accounts: datetime.datetime.strptime(mybook['checkOutDate'].split('T')[0],'%Y-%m-%d').date(), duedate, mybook['vendor'], - mybook['resource']['id'], + myresourceid, mybook['resource']['title'], mybook['resource']['materialType'], mycoverurl, @@ -199,9 +203,14 @@ returntable += """
td="" th="" #returntable = 'Click to return to main list' +returntable += tablestart + 'Name'+ th +'Count' +for account in accounts: + accountcount = sum(b.person == account.person for b in allbooks) + if accountcount >0: + returntable += "" + account.person + td + str(accountcount) + "" 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 + 'Name'+ th +'Count' + returntable += tablestart + 'Type'+ th +'Count' for type in mediatypes: typecount = sum(b.materialtype == type for b in duesoon) if typecount>0: @@ -217,7 +226,7 @@ returnlist = [d for d in allbooks if (d.renewalcount == 3)] if len(returnlist) == 0: pass else: - returntable += tablestart + 'Name'+ th +'Count' + returntable += tablestart + 'Type'+ th +'Count' for type in mediatypes: typecount = sum(b.materialtype == type for b in returnlist) if typecount>0: @@ -233,7 +242,7 @@ returnlist = [d for d in allbooks if (d.renewalcount == 2)] if len(returnlist) == 0: pass else: - returntable += tablestart + 'Name'+ th +'Count' + returntable += tablestart + 'Type'+ th +'Count' for type in mediatypes: typecount = sum(b.materialtype == type for b in returnlist) if typecount>0: @@ -249,7 +258,7 @@ returnlist = [d for d in allbooks if (d.renewalcount == 1)] if len(returnlist) == 0: pass else: - returntable += tablestart + 'Name'+ th +'Count' + returntable += tablestart + 'Type'+ th +'Count' for type in mediatypes: typecount = sum(b.materialtype == type for b in returnlist) if typecount>0: @@ -265,7 +274,7 @@ returnlist = [d for d in allbooks if (d.renewalcount == 0)] if len(returnlist) == 0: pass else: - returntable += tablestart + 'Name'+ th +'Count' + returntable += tablestart + 'Type'+ th +'Count' for type in mediatypes: typecount = sum(b.materialtype == type for b in returnlist) if typecount>0: -- 2.47.1