diff --git a/packages/jspsych/src/timeline/Trial.ts b/packages/jspsych/src/timeline/Trial.ts index 8a7b059db7..5afc7c826c 100644 --- a/packages/jspsych/src/timeline/Trial.ts +++ b/packages/jspsych/src/timeline/Trial.ts @@ -37,11 +37,21 @@ export class Trial extends TimelineNode { this.pluginClass = this.getParameterValue("type", { evaluateFunctions: false }); this.pluginInfo = this.pluginClass["info"]; - if (!("version" in this.pluginInfo) || !("data" in this.pluginInfo)) { + if (!("version" in this.pluginInfo) && !("data" in this.pluginInfo)) { console.warn( this.pluginInfo["name"], "is missing the 'version' and 'data' fields. Please update plugin as 'version' and 'data' will be required in v9." ); + } else if (!("version" in this.pluginInfo)) { + console.warn( + this.pluginInfo["name"], + "is missing the 'version' field. Please update plugin as 'version' will be required in v9." + ); + } else if (!("data" in this.pluginInfo)) { + console.warn( + this.pluginInfo["name"], + "is missing the 'data' field. Please update plugin as 'data' will be required in v9." + ); } } @@ -192,7 +202,7 @@ export class Trial extends TimelineNode { ...result, trial_type: this.pluginInfo.name, trial_index: this.index, - version: this.pluginInfo["version"] ? null : this.pluginInfo["version"], + version: this.pluginInfo["version"] ? this.pluginInfo["version"] : null, }; // Add timeline variables to the result according to the `save_timeline_variables` parameter