mirror of
https://github.com/soconnor0919/hristudio.git
synced 2026-03-24 03:37:51 -04:00
feat: introduce conditional steps and branching logic to the experiment wizard and designer, along with new core and WoZ plugins.
This commit is contained in:
@@ -1543,7 +1543,8 @@ export const experimentsRouter = createTRPCRouter({
|
||||
description: step.description,
|
||||
order: step.orderIndex,
|
||||
duration: step.durationEstimate,
|
||||
parameters: step.conditions as Record<string, unknown>,
|
||||
parameters: {} as Record<string, unknown>, // No standard parameters on Step, only Conditions
|
||||
conditions: step.conditions as Record<string, unknown>, // Correctly map conditions
|
||||
parentId: undefined, // Not supported in current schema
|
||||
children: [], // TODO: implement hierarchical steps if needed
|
||||
actions: step.actions.map((action) => ({
|
||||
|
||||
@@ -1046,6 +1046,19 @@ export const trialsRouter = createTRPCRouter({
|
||||
createdBy: ctx.session.user.id,
|
||||
});
|
||||
|
||||
// Update execution variables if data provided
|
||||
if (input.data) {
|
||||
const executionEngine = getExecutionEngine();
|
||||
Object.entries(input.data).forEach(([key, value]) => {
|
||||
executionEngine.setVariable(input.trialId, key, value);
|
||||
});
|
||||
|
||||
// Also set a generic "last_wizard_response" if response field exists
|
||||
if ('response' in input.data) {
|
||||
executionEngine.setVariable(input.trialId, "last_wizard_response", input.data.response);
|
||||
}
|
||||
}
|
||||
|
||||
return { success: true };
|
||||
}),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user