Skip to content

Commit

Permalink
Fixed version number displaying and updated error messages to be more…
Browse files Browse the repository at this point in the history
… description
  • Loading branch information
vzhang03 committed Jun 25, 2024
1 parent bd0e164 commit b294640
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/jspsych/src/timeline/Trial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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."
);
}
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b294640

Please sign in to comment.