adde queery
This commit is contained in:
@@ -647,12 +647,16 @@ def recent_actions(current_user):
|
|||||||
# RECENT_ACTIONS = "SELECT * FROM members_actions WHERE member_id = " + user_id + " ORDER by id DESC LIMIT 4"
|
# RECENT_ACTIONS = "SELECT * FROM members_actions WHERE member_id = " + user_id + " ORDER by id DESC LIMIT 4"
|
||||||
# RECENT_ACTIONS = "SELECT * FROM members_actions WHERE member_id::text = %s ORDER by id DESC LIMIT 4"
|
# RECENT_ACTIONS = "SELECT * FROM members_actions WHERE member_id::text = %s ORDER by id DESC LIMIT 4"
|
||||||
# print(user_id)
|
# print(user_id)
|
||||||
RECENT_ACTIONS = f"SELECT * FROM members_actions WHERE member_id = {user_id} ORDER by id DESC LIMIT 4"
|
RECENT_ACTIONS = f"SELECT id AS no,action_label AS description,added AS date,status FROM members_actions WHERE member_id = {user_id} ORDER by id DESC LIMIT 4"
|
||||||
actionVal = (user_id)
|
actionVal = (user_id)
|
||||||
with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor:
|
with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor:
|
||||||
cursor.execute(RECENT_ACTIONS)
|
cursor.execute(RECENT_ACTIONS)
|
||||||
recent_actions = cursor.fetchall()
|
recent_actions = cursor.fetchall()
|
||||||
print(recent_actions)
|
print(recent_actions)
|
||||||
|
actionJS = json.dumps( [dict(ix) for ix in recent_actions] )
|
||||||
|
#print(productJS)
|
||||||
|
#print(productJS)
|
||||||
|
array3 = json.loads(actionJS)
|
||||||
|
|
||||||
action_data = {
|
action_data = {
|
||||||
"recent_actions" : recent_actions,
|
"recent_actions" : recent_actions,
|
||||||
@@ -667,7 +671,7 @@ def recent_actions(current_user):
|
|||||||
{"no": "3", "description": "Web Traffic Analysis" , "date": "10-12-2010 11:30 AM", "status": 'verifying'},
|
{"no": "3", "description": "Web Traffic Analysis" , "date": "10-12-2010 11:30 AM", "status": 'verifying'},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
return jsonify(action_data=action_data, recent_actions=recent_actions)
|
return jsonify(action_data=action_data, recent_actions=array3)
|
||||||
|
|
||||||
@app.route("/panel/account/products/url")
|
@app.route("/panel/account/products/url")
|
||||||
@token_required
|
@token_required
|
||||||
|
|||||||
Reference in New Issue
Block a user