Insert missing

This commit is contained in:
CHIEFSOFT\ameye
2025-01-10 10:53:18 -05:00
parent 3f12f6935b
commit 7bcf5ef491
+31 -5
View File
@@ -141,6 +141,9 @@ def hello_world():
@app.route("/test/products")
def test_product():
myproudct = myproduct_detail(1 , 'A000001')
print(myproudct)
products_data = {
"last_update": datetime.datetime.utcnow(),
"products": [
@@ -162,8 +165,8 @@ def test_product():
productJS = json.dumps( [dict(ix) for ix in products_list] )
print(productJS)
array3 = json.loads(productJS)
return jsonify(products_data=products_data, products_list=array3)
#return jsonify(products_data=products_data, products_list=array3)
return jsonify(myproudct=myproudct)
# GLOBAL_AVG = """SELECT * FROM members WHERE id > 0;"""
#
# result = pd.read_sql(GLOBAL_AVG, engine)
@@ -726,7 +729,6 @@ def myproduct(current_user):
"subscription_text" : "Start with your goals in mind and then work possible.ith yand Goals. If the plan doesnt support the vision then change it!",
"promotion_text": "Start Free Today !",
"price_text" : "90 days free and 3.95/Month",
}
return jsonify(myproduct_data=myproduct_data)
@@ -757,7 +759,7 @@ def subscription_start(current_user):
return jsonify({'status': "INVALID",'message': 'Error - Invalid product'}), 403
member_id = current_user['user']['member_id']
INSERT_NEW_PRODUCT ="INSERT INTO members_products (member_id ,product_id,status) VALUES (%s, %s)"
INSERT_NEW_PRODUCT ="INSERT INTO members_products (member_id ,product_id,status) VALUES (%s, %s, %s)"
val_insert = (member_id, product_id,6)
with connection:
with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor:
@@ -767,4 +769,28 @@ def subscription_start(current_user):
myproduct_data = []
return jsonify(myproduct_data=myproduct_data)
return jsonify(myproduct_data=myproduct_data)
def myproduct_detail(member_id ,product_id):
FIND_PRODUCT= "SELECT uid,product_id,name,description,banner,status FROM products WHERE product_id='"+product_id+"'"
with connection:
with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor:
cursor.execute(FIND_PRODUCT)
product = cursor.fetchall()
# print(product[0]["uid"])
product_found = count = len( product )
myproduct_data = {
"myproduct_uid":"",
"status": product[0]["status"],
"product_id": product[0]["product_id"],
"product_uid": product[0]["uid"],
"banner": product[0]["banner"],
"product_name": product[0]["name"],
"description": "Product Description - Commitment is something that comes from understanding that everything has its price and then having the willingness to pay that price. This is important because nobody wants to put significant effort into something, only to find out after the fact that the price was too high.The price is something not necessarily defined as financial. It could be time, effort, sacrifice, money or perhaps, something else.",
"title": product[0]["description"],
"subscription_text" : "Start with your goals in mind and then work possible.ith yand Goals. If the plan doesnt support the vision then change it!",
"promotion_text": "Start Free Today !",
"price_text" : "90 days free and 3.95/Month",
}
return myproduct_data;