Update app.py
Browse files
app.py
CHANGED
|
@@ -75,7 +75,7 @@ async def create_task(request: Request):
|
|
| 75 |
print(f"End Date: {end_date}")
|
| 76 |
|
| 77 |
|
| 78 |
-
web_app_url = "https://script.google.com/macros/s/
|
| 79 |
params = {
|
| 80 |
"mode": "extended",
|
| 81 |
"taskType": task_type,
|
|
@@ -281,6 +281,7 @@ async def task_update(request: Request):
|
|
| 281 |
tag_name = tag.get("name")
|
| 282 |
if tag_name and tag_name.lower() == "missed due date":
|
| 283 |
|
|
|
|
| 284 |
# Fetch task details
|
| 285 |
task_details = get_task_details(task_id) # Function to fetch task details
|
| 286 |
print(f"Task details: {task_details}")
|
|
@@ -288,6 +289,29 @@ async def task_update(request: Request):
|
|
| 288 |
# Extract assignee usernames
|
| 289 |
print(assignee_usernames)
|
| 290 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 291 |
# Get due date
|
| 292 |
due_date_timestamp = task_details.get("due_date")
|
| 293 |
due_date = datetime.utcfromtimestamp(int(due_date_timestamp) / 1000).strftime('%Y-%m-%d') if due_date_timestamp else "Unknown Due Date"
|
|
|
|
| 75 |
print(f"End Date: {end_date}")
|
| 76 |
|
| 77 |
|
| 78 |
+
web_app_url = "https://script.google.com/macros/s/AKfycbxAF_YXKonRWoPo7MurkeC3UbUqZyNsPT85SE9AukuJAaG6mTzwtn7N-PVo4j-Qv2LP/exec"
|
| 79 |
params = {
|
| 80 |
"mode": "extended",
|
| 81 |
"taskType": task_type,
|
|
|
|
| 281 |
tag_name = tag.get("name")
|
| 282 |
if tag_name and tag_name.lower() == "missed due date":
|
| 283 |
|
| 284 |
+
# Step 1: Prepare data
|
| 285 |
# Fetch task details
|
| 286 |
task_details = get_task_details(task_id) # Function to fetch task details
|
| 287 |
print(f"Task details: {task_details}")
|
|
|
|
| 289 |
# Extract assignee usernames
|
| 290 |
print(assignee_usernames)
|
| 291 |
|
| 292 |
+
# Extract space id
|
| 293 |
+
space_id = task_details.get("space", {}).get("id")
|
| 294 |
+
|
| 295 |
+
# Step 2: Prepare the request
|
| 296 |
+
url = "https://script.google.com/macros/s/AKfycbxAF_YXKonRWoPo7MurkeC3UbUqZyNsPT85SE9AukuJAaG6mTzwtn7N-PVo4j-Qv2LP/exec"
|
| 297 |
+
params = {
|
| 298 |
+
"mode": "notify",
|
| 299 |
+
"spaceId": space_id,
|
| 300 |
+
}
|
| 301 |
+
# Add assignee parameters one by one (e.g., assignees=123&assignees=456)
|
| 302 |
+
for assignee_id in assignee_ids:
|
| 303 |
+
params.setdefault("assignees", []).append(str(assignee_id))
|
| 304 |
+
|
| 305 |
+
# Step 3: Make the request
|
| 306 |
+
response = requests.get(url, params=params)
|
| 307 |
+
|
| 308 |
+
# Step 4: Parse and print result
|
| 309 |
+
if response.ok:
|
| 310 |
+
notify_map = response.json()
|
| 311 |
+
print("Notify Map:", notify_map)
|
| 312 |
+
else:
|
| 313 |
+
print("Failed to fetch data:", response.status_code, response.text)
|
| 314 |
+
|
| 315 |
# Get due date
|
| 316 |
due_date_timestamp = task_details.get("due_date")
|
| 317 |
due_date = datetime.utcfromtimestamp(int(due_date_timestamp) / 1000).strftime('%Y-%m-%d') if due_date_timestamp else "Unknown Due Date"
|