Page 1 of 1

TIME EXCEED

Posted: Fri Nov 09, 2007 12:45 am
by kikkotm
So, i hope that i can explain my problem in a nearly correct english :P

I've installed the UQM and I made some quizzes with the time limit.
So, if I try to solve the quiz in a time out of limits it's all ok and I can't publish my results... but if I come back (with the same user), re-open the quiz and check the answers in a short time, the results will be showed.

I use the time to force the users to don't use Google...but if I can do the quiz 2 times, is useless use the time.

I can also solve the quiz how many times I want... This is a little "bug" of the mod...

There is the possibility to solve only ONE time the quiz, and if the user go out of time to do a result =0 ?
10x

Posted: Fri Nov 09, 2007 6:36 am
by battye
Do you mean that, you want a user to only be able to play a quiz once, regardless of whether they complete it or not?

Posted: Fri Nov 09, 2007 5:55 pm
by kikkotm
yeah...maybe...

I want that a user can play a quiz ONLY ONE TIME.

I try to explane with an example:
I'm an user and I open a quiz.
I read the first question
I search the answer on Google and I write it
I read the second question
I search on Google ...
etc...
I click on SUBMIT QUIZ
And come up the phrase: "TIME LIMIT EXCEED"
So, I come back.
Refresh the page
Do the same quiz in 20sec with the answer that I've searched previously.
Submit my PERFECT result...

Is too easy to solve with this method...You understand?

Posted: Sat Nov 10, 2007 3:24 am
by battye
In the ACP under this Quiz Config have you selected the setting that users can only play a quiz once?

Posted: Sat Nov 10, 2007 12:40 pm
by kikkotm
yeah of course, but the problem persist!

edit: Ok it was my error...Only the amministrator can play the quiz how many times he want :wink: but the problem with the time is the same:
If the user play the quiz once and he go out of time limit, he can play another time the same quiz.

Posted: Sat Nov 10, 2007 2:12 pm
by battye
kikkotm wrote:If the user play the quiz once and he go out of time limit, he can play another time the same quiz.
Even if you have the play once setting set to on?

Posted: Sat Nov 10, 2007 4:22 pm
by kikkotm
yeah...I said you before!

Posted: Mon Nov 12, 2007 12:55 pm
by kikkotm
impossible to solve? :roll:

Posted: Mon Nov 12, 2007 1:08 pm
by battye
I'll need to have a look at the code, I think I might need to write something custom for you.

Check back here tomorrow, hopefully I can post a quick solution for you :)

Posted: Mon Nov 12, 2007 1:34 pm
by kikkotm
oh but i'm always here...i read some posts to improve the quizzes :P

Posted: Tue Nov 13, 2007 12:57 pm
by battye
See if this fixes it.

Open quiz.php

FIND

Code: Select all

	if( $board_config['Quiz_timeout'] != 0 )
	{
		if( $time_taken_to_complete_quiz > ($board_config['Quiz_timeout'] * $number_of_questions) )
		{
			message_die(GENERAL_MESSAGE, $lang['Quiz_user_exceed_timelimit']);
		}
	}
REPLACE WITH

Code: Select all

	if( $board_config['Quiz_timeout'] != 0 )
	{
		if( $time_taken_to_complete_quiz > ($board_config['Quiz_timeout'] * $number_of_questions) )
		{
		$statistics_sql = "INSERT INTO " . QUIZ_STATISTICS_TABLE . " (stats_id, quiz_id, user_id, stats_correct, stats_incorrect, stats_percentage) VALUES ('" . quiz_new_stats_id() . "', '$id', '" . $userdata['user_id'] . "', '0', '0', '0', '0')";
			
			if(!$db->sql_query($statistics_sql))
			{
				message_die(GENERAL_ERROR, '', 'Could not insert statistical values', __LINE__, __FILE__, $statistics_sql);
			}
			
			message_die(GENERAL_MESSAGE, $lang['Quiz_user_exceed_timelimit']);
		}
	}

Posted: Wed Nov 14, 2007 12:12 pm
by kikkotm
no...there is an error...

Code: Select all

DEBUG MODE



SQL Error : 1136 Column count doesn't match value count at row 1

INSERT INTO phpbb_quiz_statistics (stats_id, quiz_id, user_id, stats_correct, stats_incorrect, stats_percentage) VALUES ('14', '3', '40', '0', '0', '0', '0')


Line : 855

File : quiz.php
i try to write

Code: Select all

 if( $db->sql_query($statistics_sql)) 
instead

Code: Select all

 if(!$db->sql_query($statistics_sql)) 
it run without errors, but the problem with time is the same...if the user exceed, he can run the quiz again

Posted: Wed Nov 14, 2007 2:59 pm
by battye
Sorry, I think I accidentally entered a column too many. Give this a shot:

Open quiz.php

FIND

Code: Select all

	if( $board_config['Quiz_timeout'] != 0 )
	{
		if( $time_taken_to_complete_quiz > ($board_config['Quiz_timeout'] * $number_of_questions) )
		{
			message_die(GENERAL_MESSAGE, $lang['Quiz_user_exceed_timelimit']);
		}
	}
REPLACE WITH

Code: Select all

	if( $board_config['Quiz_timeout'] != 0 )
	{
		if( $time_taken_to_complete_quiz > ($board_config['Quiz_timeout'] * $number_of_questions) )
		{
		$statistics_sql = "INSERT INTO " . QUIZ_STATISTICS_TABLE . " (stats_id, quiz_id, user_id, stats_correct, stats_incorrect, stats_percentage) VALUES ('" . quiz_new_stats_id() . "', '$id', '" . $userdata['user_id'] . "', '0', '0', '0')";
			
			if(!$db->sql_query($statistics_sql))
			{
				message_die(GENERAL_ERROR, '', 'Could not insert statistical values', __LINE__, __FILE__, $statistics_sql);
			}
			
			message_die(GENERAL_MESSAGE, $lang['Quiz_user_exceed_timelimit']);
		}
	}

Posted: Wed Nov 14, 2007 3:26 pm
by kikkotm
GOOOOOOOOOOOOOOOOD
NOW IS ALL OK!!!!! I CAN DO MY TOURNAMENT!!!

You're the best!!! :D :D :D :D :D

Image

Posted: Wed Nov 14, 2007 3:27 pm
by battye
Fantastic, glad to hear all is well.

Please feel free to stick around, be sure to check out the OT Forum if you haven't already :)