Skip to content

Commit

Permalink
return undefined in getResult when record_data is false
Browse files Browse the repository at this point in the history
  • Loading branch information
jodeleeuw committed Nov 10, 2023
1 parent e3b2acc commit 33c97c2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/jspsych/src/timeline/Trial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,16 @@ export class Trial extends TimelineNode {
* Returns the result object of this trial or `undefined` if the result is not yet known.
*/
public getResult() {
if (this.getParameterValue("record_data") === false) {
return undefined;
}
return this.result;
}

public getResults() {
if (this.getParameterValue("record_data") === false) {
return [];
}
return this.result ? [this.result] : [];
}

Expand Down

0 comments on commit 33c97c2

Please sign in to comment.