0 votes
in SoSci Survey (dt.) by s018813 (150 points)
edited by SoSci Survey

Ich habe 4 Seiten, die ich in zufälliger Reihenfolge anzeige. Wenn die VP ein Item überspringt, erscheint zwar der Hinweis, dass alle Items beantwortet werden müssen, aber es springt zur nächsten Seite. Später wird die Seite dann zwar nochmal angezeigt (vorherige Angaben werden auch gespeichert). Aber es wäre natürlich eleganter, erst die Seite vollständig zu beantworten, bis es auf die nächste Seite geht. Hat jemand einen Tipp?

$pages = array('A','B','C','D');
// Die Seiten nicht direkt mischen, sondern deren Positionen
$indices = array_keys($pages);
shuffle($indices);
// Nun die Ränge speichern - und die neue Abfolge der Seiten in $random speichern
$random = array();
for ($i=0; $i<count($indices); $i++) {
  // Rang speichern wie oben
  $id = id('IV02', $indices[$i] + 1);
  put($id, $i + 1);
  // Seite in der Abfolge speichern
  $random[$i] = $pages[$indices[$i]];
}

$random[] = 'E';
setPageOrder($random);
by s018813 (150 points)
Hier noch die debug-Info (die Seitennamen stimmen nicht überein, da ich sie hier für die Frage nur A B C usw. genannt habe). hier steht auch, dass die Seite nochmal angezeigt werden soll, aber halt leider nicht direkt im Anschluss.


[Information]    Interview number 41 is to be continued
[Information]    Questionnaire base from project sa_rf_n will be used
[Processing]    Reading answers from page 6+8
[Information]    Retention period on page 8 has been 14 seconds
[Information]    Answer to FL02_01 = 1
[Information]    Answer to FL02_02 = 1
[Information]    Answer to FL02_03 = 2
[Information]    Answer missing for FL02_04
[Information]    The question FL02 is missing a required answer
[Information]    Answer to BI01_01 = 4
[Information]    Answer to BI01_02 = 4
[Information]    Answer missing for BI01_03
[Information]    The question BI01 is missing a required answer
[Information]    71% of the questions have been answered so far
[Information]    Answers required. This page will be displayed again.
[Processing]    Create questionnaire page no. 6
[Information]    This combination has been drawn from urn "gruppe" for "IV01" earlier: 1
[Information]    Answer to IV02_03 = 1
[Information]    The internal variable IV02_03 gets a value of 1.
[Information]    Answer to IV02_01 = 2
[Information]    The internal variable IV02_01 gets a value of 2.
[Information]    Answer to IV02_04 = 3
[Information]    The internal variable IV02_04 gets a value of 3.
[Information]    Answer to IV02_02 = 4
[Information]    The internal variable IV02_02 gets a value of 4.
[Information]    According to a setPageOrder() the subsequent pages will be shown next:
9 (mill), 7 (car), 10 (shoe), 8 (bike), 11 (MC)
[Information]    No visible content on this page, continue with page 9
[Processing]    Create questionnaire page no. 9
[Content]    Show text treadmill
[Information]    value("IV01_01") = 1
[Content]    Create question FL03
[Content]    Create question TR01

1 Answer

+1 vote
by SoSci Survey (302k points)

Das Problem ist folgende Zeile in der Debug-Information:

[Information]    No visible content on this page, continue with page 9

Nachdem die Seite mit der Rotation keine weiteren Inhalte zeigt, wird die erste rotierte Seite direkt mit-angezeigt. Das führt aber dazu, dass - wenn diese Seite aufgrund einer fehlenden Antwort erneut angezeigt wird - auch der PHP-Code für die Rotation erneut ausgeführt wird.

Dies lässt sich mit einem isset() und einem registerVariable() recht einfach verhindern:

if (!isset($random)) {
  $pages = array('A','B','C','D');
  // Die Seiten nicht direkt mischen, sondern deren Positionen
  $indices = array_keys($pages);
  shuffle($indices);
  // Nun die Ränge speichern - und die neue Abfolge der Seiten in $random speichern
  $random = array();
  for ($i=0; $i<count($indices); $i++) {
    // Rang speichern wie oben
    $id = id('IV02', $indices[$i] + 1);
    put($id, $i + 1);
    // Seite in der Abfolge speichern
    $random[$i] = $pages[$indices[$i]];
  }

  $random[] = 'E';
  setPageOrder($random);
  registerVariable($random);
}

Dies sollte ausreichen, damit sich an der Seitenabfolge nichts mehr ändert.

Alternativ könnten Sie den PHP-Code für die Rotation einfach schon eine Seite früher platzieren, wo ein anderer Inhalt angezeigt wird.

by s018813 (150 points)
Funktioniert! Vielen Dank für die schnelle Antwort!

Willkommen im Online-Support von SoSci Survey.

Hier bekommen Sie schnelle und fundierte Antworten von anderen Projektleitern und direkt von SoSci Survey.

→ Eine Frage stellen


Welcome to the SoSci Survey online support.

Simply ask a question to quickly get answers from other professionals, and directly from SoSci Survey.

→ Ask a Question

...