Survey routine won't run

Hi,

I’ve created a survey through pavlovia (set it to running on the dashboard), in my .psyexp through the builder I have a added a survey routine and for now cannot get it to run online (i.e., the routine is simply not run/ as if it were skipped, although it is there in the .js code).

I have tried:

  • Linking to the survey ID
  • Using the survey .json file directly

In either case, once my experiment folder is synced to the online repo and available to pilot through pavlovia’s dashboard, the experiment runs fine (I’ve tried running it through pavlovia directly or a localhost), but no sign of the surveys.

More info:

  • Survey is set to running
  • Experiment currently set to piloting
  • Psychopy version 2023.2.2 (I have tried using the latest 2024.1.1 but this seems to mess with the .psyexp file, where the builder will try for a seemingly infinite time to generate the .js script)
  • My impression is that my task is rather large and possibly inefficient in some instances, it still runs fine though
  • My survey is also quite large perhaps (10+ pages)?

Below is the .js code pertaining to this survey routine (local .json file version of it):

flowScheduler.add(QuestionnairesRoutineBegin());
flowScheduler.add(QuestionnairesRoutineEachFrame());
flowScheduler.add(QuestionnairesRoutineEnd());

[...]

    {'name': 'Questionnaires/survey_760bc43f-e2d4-4f7f-bb98-9592fe00f032.json', 'path': 'Questionnaires/survey_760bc43f-e2d4-4f7f-bb98-9592fe00f032.json'},

[...]

var Questionnaires;
var QuestionnairesClock;
function QuestionnairesRoutineBegin(snapshot) {
  return async function () {
    TrialHandler.fromSnapshot(snapshot); // ensure that .thisN vals are up to date
    
    //--- Prepare to start Routine 'Questionnaires' ---
    t = 0;
    frameN = -1;
    continueRoutine = true; // until we're told otherwise
    //--- Starting Routine 'Questionnaires' ---
    Questionnaires = new visual.Survey({
        win: psychoJS.window,
        name: 'Questionnaires',
        model: 'Questionnaires/survey_760bc43f-e2d4-4f7f-bb98-9592fe00f032.json',
    });
    QuestionnairesClock = new util.Clock();
    Questionnaires.setAutoDraw(true);
    Questionnaires.status = PsychoJS.Status.STARTED;
    Questionnaires.isFinished = false;
    Questionnaires.tStart = t;  // (not accounting for frame time here)
    Questionnaires.frameNStart = frameN;  // exact frame index
    return Scheduler.Event.NEXT;
  }
}


function QuestionnairesRoutineEachFrame() {
  return async function () {
    t = QuestionnairesClock.getTime();
    frameN = frameN + 1;  // number of completed frames (so 0 is the first frame)
    // if Questionnaires is completed, move on
    if (Questionnaires.isFinished) {
      Questionnaires.setAutoDraw(false);
      Questionnaires.status = PsychoJS.Status.FINISHED;
      // survey routines are not non-slip safe, so reset the non-slip timer
      routineTimer.reset();
      return Scheduler.Event.NEXT;
    }
    // check for quit (typically the Esc key)
    if (psychoJS.experiment.experimentEnded || psychoJS.eventManager.getKeys({keyList:['escape']}).length > 0) {
      return quitPsychoJS('The [Escape] key was pressed. Goodbye!', false);
    }
    return Scheduler.Event.FLIP_REPEAT;
  }
}


function QuestionnairesRoutineEnd(snapshot) {
  return async function () {
    //--- Ending Routine 'Questionnaires' ---
    // get data from Questionnaires
    const QuestionnairesResponse =  Questionnaires.getResponse();
    function addRecursively(resp, name) {
        if (resp.constructor === Object) {
            // if resp is an object, add each part as a column
            for (let subquestion in resp) {
                addRecursively(resp[subquestion], `${name}.${subquestion}`);
            }
        } else {
            psychoJS.experiment.addData(name, resp);
        }
    }
    // recursively add survey responses
    addRecursively(QuestionnairesResponse, 'Questionnaires');
    // Routines running outside a loop should always advance the datafile row
    if (currentLoop === psychoJS.experiment) {
      psychoJS.experiment.nextEntry(snapshot);
    }
    return Scheduler.Event.NEXT;
  }
}

Thanks in advance for any insights and help
Tristan

To close the thread:

Issue is resolved, but no explanation.

Tried again a couple days later and now the surveys display as intended while running the task through pavlovia (survey routine uses survey ID).