Improve search db
This commit is contained in:
parent
34008046b2
commit
65b03dadb2
@ -44,6 +44,7 @@ class Application:
|
||||
if type(application) is Application:
|
||||
table.add_row([application.reference, application.dateScraped, application.dateDecided, application.decision, application.caseOfficer, application.num_documents, application.description])
|
||||
table.align = "l"
|
||||
table.max_width["Description"] = 200
|
||||
print(table)
|
||||
|
||||
def __init__(self, cursor: Cursor, reference: str):
|
||||
|
||||
@ -1,16 +1,15 @@
|
||||
from application import Application
|
||||
|
||||
import sqlite3
|
||||
import sys
|
||||
|
||||
where_clause = ' '.join(sys.argv[1:])
|
||||
|
||||
with sqlite3.connect("./database.db") as connection:
|
||||
cursor = connection.cursor()
|
||||
applications = []
|
||||
|
||||
print("This week's Application decisions:")
|
||||
cursor.execute("SELECT reference FROM applications WHERE dateScraped >= '2025-06-23' ORDER BY dateDecided DESC")
|
||||
|
||||
# print("Chris' Applications:")
|
||||
# cursor.execute("SELECT reference FROM applications WHERE caseOfficer = 'Christopher Masters' ORDER BY dateDecided DESC")
|
||||
cursor.execute(f"SELECT reference FROM applications {where_clause} ORDER BY dateScraped DESC, dateDecided DESC")
|
||||
|
||||
for (application_ref,) in cursor.fetchall():
|
||||
applications.append(Application(cursor, application_ref))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user