Task System: - Tasks auto-created when KDS marks order Ready (status 3) - Duplicate task prevention via TaskOrderID check - Task completion now marks associated order as Completed (status 4) - Fixed isNull() check for TaskCompletedOn (use len() instead) - Added TaskOrderID to task queries for order linking Worker APIs: - api/workers/myBusinesses.cfm with GROUP BY to prevent duplicates - api/tasks/listMine.cfm for worker's claimed tasks with filters - api/tasks/complete.cfm updates both task and order status - api/tasks/accept.cfm for claiming tasks KDS/Portal: - KDS only shows orders with status < 4 - Portal dashboard improvements Admin/Debug: - Debug endpoints for tasks and businesses - Test data reset endpoint 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
35 lines
966 B
Text
35 lines
966 B
Text
<cfsetting showdebugoutput="false">
|
|
<cfsetting enablecfoutputonly="true">
|
|
<cfcontent type="application/json; charset=utf-8">
|
|
|
|
<cftry>
|
|
<cfset qAll = queryExecute("
|
|
SELECT TaskID, TaskClaimedByUserID, TaskCompletedOn, TaskOrderID,
|
|
CASE WHEN TaskCompletedOn IS NULL THEN 'YES_NULL' ELSE 'NOT_NULL' END AS IsNull
|
|
FROM Tasks
|
|
ORDER BY TaskID DESC
|
|
", [], { datasource = "payfrit" })>
|
|
|
|
<cfset tasks = []>
|
|
<cfloop query="qAll">
|
|
<cfset arrayAppend(tasks, {
|
|
"TaskID": qAll.TaskID,
|
|
"TaskClaimedByUserID": qAll.TaskClaimedByUserID,
|
|
"TaskOrderID": qAll.TaskOrderID,
|
|
"TaskCompletedOn": len(trim(qAll.TaskCompletedOn)) ? toString(qAll.TaskCompletedOn) : "",
|
|
"IsNull": qAll.IsNull
|
|
})>
|
|
</cfloop>
|
|
|
|
<cfoutput>#serializeJSON({
|
|
"OK": true,
|
|
"TASKS": tasks
|
|
})#</cfoutput>
|
|
|
|
<cfcatch>
|
|
<cfoutput>#serializeJSON({
|
|
"OK": false,
|
|
"ERROR": cfcatch.message
|
|
})#</cfoutput>
|
|
</cfcatch>
|
|
</cftry>
|