Hi Dave,
Do you know why the results for a quiz are only saved the first time you play it?
For the second and further times you play, nothing is saved. :think
Quote from: Aussie on 30.01.2024, 11:27Hi Dave,
Do you know why the results for a quiz are only saved the first time you play it?
For the second and further times you play, nothing is saved. :think
It will only save your best score Aussie. On this site the most times you can play a quiz is twice (in most cases) so unless your second go is better than your first only the first will show.
I tried that on my forum, but it didn't work.
So I tried it on yours and it didn't work here either.
It only records the first play, regardless of how much better you are on the second play.
It doesn't even show the quiz was played twice.
Quote from: Aussie on 31.01.2024, 13:17I tried that on my forum, but it didn't work.
So I tried it on yours and it didn't work here either.
It only records the first play, regardless of how much better you are on the second play.
It doesn't even show the quiz was played twice.
Hmmm I'll investigate that, thanks for the test on here Aussie
I take it you're 'Bandicoot' on SMF. I've also made a post asking Diego for help
Yes, I'm Bandicoot there :)
Found the problem. Figured it must be in either start.php or end.php and it is in end.php
Go to:
Sources/Quiz/End.php
At line 45, find:
if (CheckResultExists($id_quiz, $id_user) == false)
Delete that line.
Every play is now recorded and score is updated.
Have posted this in the SMF forum.
A cleaner way is to change the entire code block from line 41:
// Don't make these changes if the user playing is the creator of the quiz, only kill the session
if ($creatorId != $id_user)
{
// Add result for every play
InsertQuizEnd($id_quiz, $id_user, $questions, $correct, $incorrect, $timeouts, $total_seconds, $totalResumes);
UpdateQuiz($id_quiz, $questions, $correct, $total_seconds, $id_user, $name);
}
}
That way it removes unnecessary braces and updates the comment line.
Next problem is why it ignores the play limit :think
Quote from: Aussie on 02.02.2024, 09:23Yes, I'm Bandicoot there :)
Found the problem. Figured it must be in either start.php or end.php and it is in end.php
Go to:
Sources/Quiz/End.php
At line 45, find:
if (CheckResultExists($id_quiz, $id_user) == false)
Delete that line.
Every play is now recorded and score is updated.
Have posted this in the SMF forum.
This works but the post below with removing the whole of the code from line 41 doesn't. I get no score at all removing everything. I just tested this with an alter ego
That's strange.
Maybe you removed a brace or some other bit of code by accident. If you are using cPanel, it would show a red X on the left if something is wrong.
But simply deleting the one line is okay too.
I can only find one reference to the play limit and it appears it isn't working. I've made a post about that too.