loan uodates

This commit is contained in:
CHIEFSOFT\ameye
2025-02-18 09:20:16 -05:00
parent 298582054d
commit a335f2c273
2 changed files with 5 additions and 3 deletions
+2 -1
View File
@@ -82,6 +82,7 @@ CREATE TABLE loan_apply (
bvn VARCHAR(12) NOT NULL, bvn VARCHAR(12) NOT NULL,
amount INT DEFAULT 0, amount INT DEFAULT 0,
added timestamp without time zone DEFAULT now(), added timestamp without time zone DEFAULT now(),
status INT DEFAULT 1,
verified timestamp verified timestamp
); );
ALTER TABLE ONLY loan_apply ALTER TABLE ONLY loan_apply
@@ -105,7 +106,7 @@ ALTER TABLE ONLY loans
--- ALTER TABLE loan_apply ADD verified timestamp; --- ALTER TABLE loan_apply ADD verified timestamp;
--- ALTER TABLE loan_apply ADD status INT DEFAULT 1;
{"cid": "425611f2-c692-4404-b93d-76ca7a5ce00", "description": "100,000 Naira for 30 Days" , "active" : 1 }, {"cid": "425611f2-c692-4404-b93d-76ca7a5ce00", "description": "100,000 Naira for 30 Days" , "active" : 1 },
{"cid": "425611f2-c692-4404-b93d-76ca7a5ce01", "description": "300,000 Naira for 60 Days" , "active" : 1 }, {"cid": "425611f2-c692-4404-b93d-76ca7a5ce01", "description": "300,000 Naira for 60 Days" , "active" : 1 },
+3 -2
View File
@@ -292,8 +292,9 @@ def salary_loanapply2():
amount = data["amount"] amount = data["amount"]
if loan != '' and bvn != '' and amount > 0 : if loan != '' and bvn != '' and amount > 0 :
loan_read = load_offer(loan,bvn) loan_read = load_offer(loan,bvn)
UPDATE_LOAN ="UPDATE loan_apply SET status=3 WHERE bvn = '" + bvn + "' AND status = 1 "
INSERT_LOAN ="INSERT INTO loan_apply (loan, bvn, amount) VALUES(%s, %s, %s)" INSERT_LOAN ="INSERT INTO loan_apply (loan, bvn, amount) VALUES(%s, %s, %s)"
SELECT_LOAN ="SELECT uid FROM loan_apply WHERE loan = '" + loan + "' AND bvn = '" + bvn + "' ORDER BY id DESC LIMIT 1" SELECT_LOAN ="SELECT uid FROM loan_apply WHERE loan = '" + loan + "' AND bvn = '" + bvn + "' AND status = 1 ORDER BY id DESC LIMIT 1"
new_data = (loan,bvn, amount) new_data = (loan,bvn, amount)
with connection: with connection:
with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor: with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor:
@@ -352,7 +353,7 @@ def salary_verifloan2():
account_found = count = len( account ) account_found = count = len( account )
print("10000-a") print("10000-a")
if account_found == 1 : if account_found == 1 :
UPDATE_APPLICATION = "UPDATE loan_apply SET verified = now() WHERE uid::text = '" + loan_application_id + "' " UPDATE_APPLICATION = "UPDATE loan_apply SET verified = now(),status=5 WHERE uid::text = '" + loan_application_id + "' AND status = 1"
print(UPDATE_APPLICATION) print(UPDATE_APPLICATION)
with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor: with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor:
cursor.execute(UPDATE_APPLICATION) cursor.execute(UPDATE_APPLICATION)