updated: gamification model

parent ae107536
...@@ -90,7 +90,7 @@ def add_points_earns(id): ...@@ -90,7 +90,7 @@ def add_points_earns(id):
"userID": user_earns} "userID": user_earns}
dbResponse = db.CropData.insert_one(earnsData) dbResponse = db.CropData.insert_one(earnsData)
return Response( return Response(
response= json.dumps({"message": "user points entered"}), response= json.dumps({"message": "user points entered", "earns": earns}),
status=200, status=200,
) )
...@@ -104,6 +104,34 @@ def add_points_earns(id): ...@@ -104,6 +104,34 @@ def add_points_earns(id):
) )
@app.route("/getVal/<id>", methods=["GET"])
@check_for_token
def get_earn_val(id):
request.headers
id = session['Auth']['_id']
try:
dbResponse = db.CropData.find({"userID._id": ObjectId(id)},)
mongores = list(dbResponse)
print(mongores)
# data = list(db.users.find())
for user in mongores:
user["earns"] = str(user["earns"])
print(user["earns"])
return Response(
response= json.dumps({"message":user["earns"]}),
status=200,
)
except Exception as Ex:
print("**********")
print(Ex)
# @app.route("/getUsers", methods=["GET"]) # @app.route("/getUsers", methods=["GET"])
# def get_some_users(): # def get_some_users():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment