Clean up
This commit is contained in:
+20
-21
@@ -109,7 +109,7 @@ def salary_demousers():
|
||||
# VARCHAR(125),
|
||||
# VARCHAR(6),
|
||||
|
||||
SQL_INSERT = "INSERT INTO demo_bank_accounts (name, salary_account, mobile, bvn, email, pin) VALUES(%s,%s,%s,%s,%s,%s)"
|
||||
# SQL_INSERT = "INSERT INTO demo_bank_accounts (name, salary_account, mobile, bvn, email, pin) VALUES(%s,%s,%s,%s,%s,%s)"
|
||||
|
||||
# for i in range(900):
|
||||
# new_data = (
|
||||
@@ -129,37 +129,36 @@ def salary_demousers():
|
||||
# print(names.get_full_name())
|
||||
|
||||
SELECT_DEMO_ENTRY = f"SELECT id,uid, name,offers,salary_account,current_loans,mobile,bvn, email, pin, added::text FROM demo_bank_accounts ORDER BY id ASC"
|
||||
print(SELECT_DEMO_ENTRY)
|
||||
# print(SELECT_DEMO_ENTRY)
|
||||
with connection:
|
||||
with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor:
|
||||
cursor.execute(SELECT_DEMO_ENTRY)
|
||||
select_demoS = cursor.fetchall()
|
||||
|
||||
print(select_demoS)
|
||||
# print(select_demoS)
|
||||
demo_data = json.dumps( [dict(ix) for ix in select_demoS] )
|
||||
print(demo_data)
|
||||
# print(demo_data)
|
||||
|
||||
sample_range = random.randint(2, 5)
|
||||
for x in range(sample_range):
|
||||
calDate = datetime.datetime.utcnow() + datetime.timedelta(minutes=180 * random.randint(1, 20))
|
||||
new_l = {
|
||||
"uid":"425611f2-c692-4404-b93d-76ca7a5ce7"+str(x),
|
||||
"name": names.get_full_name() ,
|
||||
"added": calDate,
|
||||
"offers":random.randint(1, 4),
|
||||
"mobile": '801-000-'+str( random.randint(1000, 9999) ) ,
|
||||
"bvn": '8315000'+str( random.randint(1000, 9999) ),
|
||||
"email": 'demo+'+ names.get_first_name() +'@chiefsoft.net' ,
|
||||
"current_loans" : [],
|
||||
"pin": random.randint(1100, 9999) ,
|
||||
"salary_account": random.randint(0, 1)
|
||||
}
|
||||
dList.append(new_l)
|
||||
# sample_range = random.randint(2, 5)
|
||||
# for x in range(sample_range):
|
||||
# calDate = datetime.datetime.utcnow() + datetime.timedelta(minutes=180 * random.randint(1, 20))
|
||||
# new_l = {
|
||||
# "uid":"425611f2-c692-4404-b93d-76ca7a5ce7"+str(x),
|
||||
# "name": names.get_full_name() ,
|
||||
# "added": calDate,
|
||||
# "offers":random.randint(1, 4),
|
||||
# "mobile": '801-000-'+str( random.randint(1000, 9999) ) ,
|
||||
# "bvn": '8315000'+str( random.randint(1000, 9999) ),
|
||||
# "email": 'demo+'+ names.get_first_name() +'@chiefsoft.net' ,
|
||||
# "current_loans" : [],
|
||||
# "pin": random.randint(1100, 9999) ,
|
||||
# "salary_account": random.randint(0, 1)
|
||||
# }
|
||||
# dList.append(new_l)
|
||||
|
||||
demo_data = {
|
||||
"last_update": datetime.datetime.utcnow(),
|
||||
"offers":products(),
|
||||
"list_old" : dList,
|
||||
"list" : json.loads( demo_data)
|
||||
}
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user