CoreCommunity ExtensionsIncubatorDistributionsTYPO3 4.5 ProjectsTYPO3 4.6 ProjectsTYPO3 4.7 ProjectsTYPO3 6.0 ProjectsTYPO3 6.1 ProjectsTYPO3 6.2 Projects (+)

Bug #9763

premium edition: question type "random" multipage problem: questionnair finished instead of next page

Added by Ralf Merz over 2 years ago. Updated over 1 year ago.

Status:Accepted Start date:2010-09-16
Priority:Must have Due date:
Assignee:- % Done:

0%

Category:-
Target version:2.5.3
TYPO3 Version:4.5 PHP Version:
Votes: 0

Description

Hi,

when I use the question type "random" and setup the questionnaire to be a multipage one, concrete: 5 questions/page, I cannot go to the second page.
When I click on "next page" I can find the parameter in the URL: ?tx_kequestionnaire_pi1[page]=2
but I get the finish-page content "thank you for..."

The same behaviour is in question type "Quiz/eLearning". I get redirected to the finish page with the content:
[...]
Sie haben 0,00% der Gesamtpunktzahl erreicht.
Es wurden 0 von 0 möglichen Punkten erreicht.
[...]
And there is an error:
Warning: Division by zero in /.../typo3conf/ext/ke_questionnaire/pi1/class.tx_kequestionnaire_pi1.php on line 1300
Warning: Division by zero in /.../typo3conf/ext/ke_questionnaire/pi1/class.tx_kequestionnaire_pi1.php on line 1356

The PDF I download is also broken then "... cannot open...", but I think this is because the questionnaire isn´t finished properly.

I try to find out where this problem occurs in the code, but meanwhile maybe you can give me a hint.

Greets
Ralf

patch_pageCount_class.tx_kequestionnaire_pi1.php.patch (486 Bytes) Ralf Merz, 2010-11-26 13:23

2011-01-10_class.tx_kequestionnaire_pi1.php.patch - show description text when pageNr=1 (1.3 kB) Ralf Merz, 2011-01-10 15:45

History

Updated by Nadine Schwingler over 2 years ago

  • Status changed from New to Needs Feedback
  • Assignee set to Nadine Schwingler

Hmm,
i tested it with a Random-Type Questionnaire and had no problems.

Seems like the calculation for the pages is broken.

How big is your pool and how much questions do you want to display out of the pool?

Updated by Ralf Merz over 2 years ago

Yeah! Cool! First thanks for the fast reply!

Ok,
The questionnaire has the following settings:
in the plugin:
- type: random
- show analysis in frontend: checked
- Storage Page: the sysfolder with questions / pools
- Access: FE-User
- Time for whole questionnaire: 20min
- Max participations for user: 10
- no restart
- no history
- Appearance: 5 questions/page
- "Zertifikat-Einstellungen": min 80%

The Sysfolder with the questions has 7 pools which have 59 questions with all about 233 Answers.
- so each pool has about 7 to 12 questions
- each pool has the setting:
-- Amount of random Questionsshow 5 answers randomly

Greets
Ralf

Updated by Ralf Merz over 2 years ago

Hi again,

I´ve tested again with this results:
I open a random questionnaire, so I am on page 1. Ich click "next page" an get "Vielen Dank für ihre Teilnahme", the finish page, with the URL:
http://my.domain.com/intern/elearning-glasseminar-1.html?tx_kequestionnaire_pi1[page]=2

Now I change the digit "2" to "3" in the browser´s address line, hit return and tattaa: I get the 3rd page.
Or: If I go with my cursor into the address line, where page=2 stands and hit return, I get the 2nd page. Hmm...

And now, when I click back and forward with the "next/last page" buttons, everything works suddenly!
So it seems the error occurs only with the first "next page" event/click.

Additional: my bug #9764 with the "wrong" timer:
After calling the 2nd page twice (per URL) or enter "3" in the URL, the timer shows the right time and it counts backwards normally.

Hope this help location the error.

Greets
Ralf

Updated by Ralf Merz over 2 years ago

Hi,

I think I´ve found something:
in class.tx_kequestionnaire_pi1.php on line 604:
The first time the questionnaire is called, $pageNr is 0.
If I add these lines:
if($pageNr == 0) {
$pageNr = 1;
}

before lines
$this->piVars['page']=$pageNr;
return $pageNr;

it works for me on questionnaire type "random". Type "questionnaier" still works.

Additional to bug #9764:
The first time I call the questionnaire, the timer starts working correctly, without negative values.

Greets
Ralf

Updated by Nadine Schwingler over 2 years ago

Is this issue still there?

Updated by Ralf Merz over 2 years ago

Hi,

with the additional I mentioned above, everything is ok. Could you reproduce something meanwhile?
What do you think about setting $pageNr = 1 in the first loop?

Greets
Ralf

Updated by Ralf Merz over 2 years ago

Hi,

now I have used the actual TER version of ke_questionnaire where I still or again have problems with the first page and with the timer.
The problem is that in function getPageNr() the var $pageNr is empty on the first call.
So I added a check: if $pageNr is empty, I set it to "1". It works for me.

Please find attached a patch which adds those 3 lines.

Regards
Ralf Merz

Updated by Ralf Merz over 2 years ago

Hi,

now I´ve found out an error when I change the first page to "1" instead of "0":
The questionnaire´s description text will not be shown because it checks if the text is set and page_nr=0.
According to my last patch: I´ve set page_nr to 1, so that the timer works properly.

So I thought the best thing to get

function getPages($form_pre_add = '',$form_post_add = '') { ... }

working:
A new variable called
$this->showFirstPage = TRUE;

I added this in

function getPageNr(){
        $pageNr = $this->piVars['page'];
        if(empty($pageNr) || $pageNr < 1) {
            $pageNr = 1;
            # Ralf Merz <rfm@lightwerk.com>: new global Var showFirstPage;
            $this->showFirstPage = TRUE;
        } else {
            $this->showFirstPage = FALSE;
        } ... }

getPages() now checks this one and so we know when we hit the questionnaire´s first page.

Find attached a patch file changing these few lines.
edit: filename of patch: 2011-01-10_class.tx_kequestionnaire_pi1.php.patch

Regards
Ralf Merz
(merzilla)

Updated by www.kennziffer.com GmbH over 1 year ago

  • Status changed from Needs Feedback to Accepted
  • Assignee deleted (Nadine Schwingler)
  • Target version set to 2.5.3
  • TYPO3 Version set to 4.5

Also available in: Atom PDF