From 00d7277139c31d841e2c1699543d85a0266b1340 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Tue, 21 Jan 2025 11:51:15 -0500 Subject: [PATCH] calendar data --- services/web/project/__init__.py | 38 +++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/services/web/project/__init__.py b/services/web/project/__init__.py index b8b4b32..af1791a 100644 --- a/services/web/project/__init__.py +++ b/services/web/project/__init__.py @@ -138,6 +138,26 @@ def hello_world(): return jsonify(action_data="sent", select_pending=array3) +@app.route("/test/calendar") +def test_calen(): + dList = [] + sample_range = random.randint(20, 60) + 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), "description": "Calendar Random Item on " + str(x) , "added": calDate, "category":random.randint(1, 4) } + dList.append(new_l) + + calendar_data = { + "last_update": datetime.datetime.utcnow(), + "category": [ + {"cid": "1", "description": "category 01" }, + {"cid": "2", "description": "category 02" }, + {"cid": "3", "description": "category 03" }, + {"cid": "4", "description": "category 04" }, + ], + "list" : dList + } + return jsonify(calendar_data=calendar_data) @app.route("/test/products") def test_product(): @@ -648,7 +668,14 @@ def recent_bar(current_user): @token_required def calendar_data(current_user): # let send 60 days of data in only - cache heavy - bar_data = { + dList = [] + sample_range = random.randint(20, 60) + 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), "description": "Calendar Random Item on " + str(x) , "added": calDate, "category":random.randint(1, 4) } + dList.append(new_l) + + calendar_data = { "last_update": datetime.datetime.utcnow(), "category": [ {"cid": "1", "description": "category 01" }, @@ -656,14 +683,9 @@ def calendar_data(current_user): {"cid": "3", "description": "category 03" }, {"cid": "4", "description": "category 04" }, ], - "list": [ - {"id": "1", "description": "Contacts" , "last_update": "10-10-2010 11:00 AM", "value": random.randint(0, 10) , "data_span":'Last 2 months'}, - {"id": "2", "description": "Site Traffic" , "last_update": "10-10-2010 11:30 AM", "value": random.randint(0, 10), "data_span":'Past 12 hours'}, - {"id": "3", "description": "Appointments" , "last_update": "10-12-2010 11:30 AM", "value": random.randint(0, 10), "data_span":'Last 14 days'}, - {"id": "4", "description": "Purchases" , "last_update": "10-12-2010 11:30 AM", "value": random.randint(0, 10), "data_span":'Last 3 months'}, - ] + "list" : dList } - return jsonify(bar_data=bar_data) + return jsonify(bar_data=calendar_data) @app.route("/panel/account/actions")