mirror of
https://dev.azure.com/globalhealthx/EMR/_git/helix-engage-server
synced 2026-05-18 20:08:19 +00:00
fix: extract datetime from slot selection ID before booking
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
scheduledAt was passed as raw "slot:{id}:{datetime}" — platform rejected
it. Added extract_datetime expression to pull the ISO datetime from the
third segment. Updated flow JSON with SetVariableBlock after slot input.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -25,10 +25,16 @@ export class FlowVariableService {
|
||||
evaluateExpression(expression: string, value: string, variables: Record<string, any>): any {
|
||||
switch (expression) {
|
||||
case 'extract_id': {
|
||||
// Extract UUID from "doc:{uuid}:{name}" or "dept:{name}" or "slot:{id}:{datetime}"
|
||||
// Extract second segment: "doc:{uuid}:{name}" → uuid, "dept:{name}" → name
|
||||
const parts = value.split(':');
|
||||
return parts.length >= 2 ? parts[1] : value;
|
||||
}
|
||||
case 'extract_datetime': {
|
||||
// Extract datetime from "slot:{doctorId}:{datetime}" → "2026-04-21T14:00:00"
|
||||
const parts = value.split(':');
|
||||
// Rejoin from index 2 onwards (datetime contains colons: 2026-04-21T14:00:00)
|
||||
return parts.length >= 3 ? parts.slice(2).join(':') : value;
|
||||
}
|
||||
case 'date_tomorrow': {
|
||||
const d = new Date(Date.now() + 86400000);
|
||||
return d.toISOString().split('T')[0];
|
||||
|
||||
Reference in New Issue
Block a user