Page 1 of 12

UQM 2.0 - Predictions Extensions

Posted: Mon Jan 18, 2010 2:30 pm
by subvertbeats
Hi battye, lets use this thread to discuss extending UQM 2.0 for Predictions.

Ive not yet installed UQM 2.0 (next job for coming days now that b3 is released), but as far as I know I need to extend it to support the following:

PHASE 1 (Needed)
1. Competition/Quiz Categories (eg may have a category for English Premier League predictions, another for boxing predictions etc) [PART OF STANDARD UQM 2.0]
2. For each competition, allow admin to post a set of questions with no answer yet (the questions are to predict sports fixtures yet to be played, possible answers: Team A Win, Team B Win, Draw) [COMPLETE]
3. For each competition, allow answers to be submitted by forum users, and their responses stored [PART OF STANDARD UQM 2.0]
4. After the event has happened, allow admin to enter correct answers [COMPLETE]
5. Once correct answers are entered, for each competition:
a) Auto-assessment of submitted predictions against actual results [PART OF STANDARD UQM 2.0]
b) Display to admin ranked list of users (ordered in ascending priority of incorrect picks), with columns to show user name, number of incorrect predictions, number of correct predictions (to support us easily assessing winners, and giving out prizes) [PART OF STANDARD UQM 2.0]
6. Replace the word 'Quiz' throughout all GUI elements, other than copyright notices (makes more sense if changed to 'Competition' or 'Prediction Competition'). Also change 'Quizzes' to 'Competitions' [COMPLETE]
7. Remove display of the right/wrong totals after submitting a quiz (as the correct answers - i.e the actual results - wont be available at the time of submission) [COMPLETE]
8. Remove display of the time taken to complete the quiz (not necessary) [COMPLETE]


PHASE 2 (Maybe do this in future)
9. Public page (per competition) to show ranked list of users as per 5.b) [PART OF STANDARD UQM 2.0]
10. Ongoing league table (user gets 1 point for 1 correct pick. Needs to support categories - eg option to show league table for each category, as well as overall combined league table) [TO BE DONE]
11. Way to initialize new league tables, and archive old ones for later access (to support having a league run from date x to date y, then a new league from date y to date z) [TO BE DONE]

Anything in phase 2 needs to have functions to retrospectively support existing data (eg if we add league tables, it would be necessary to have the league tables initialized with data from competitions in a specified data range


So, perhaps you could start by replying and letting me know your thoughts and ideas on all of this,

Thanks again battye!

Re: UQM 2.0 - Predictions Extensions

Posted: Mon Jan 18, 2010 3:22 pm
by battye
subvertbeats, this shouldn't be too much of a problem to do. Let me know when you've installed UQM and I'll have a look at some code changes for you :)

Thanks

Re: UQM 2.0 - Predictions Extensions

Posted: Mon Jan 18, 2010 5:23 pm
by subvertbeats
Hey battye

Progress:

b3 Installed, and working.
Created categories (one less thing to do from the list above)
Cant create quiz as Im not allowed to submit the quiz without the answers.

Re: UQM 2.0 - Predictions Extensions

Posted: Mon Jan 18, 2010 6:05 pm
by subvertbeats
Update: Tested creation of a quiz where answers are provided up front - all working well, but of course this isnt going to work for predictions....

Other things I noticed that dont really make sense in this context, and would be great if could be changed:

- The word 'Quiz' throughout all GUI elements, other than copyright notices (makes more sense if changed to 'Competition' or 'Prediction Competition')
- Displaying the right/wrong totals after submitting a quiz (as the correct answers - i.e the actual results - wont be available at the time of submission)
- Displaying the time taken to complete the quiz (not necessary)


Also, have looked at the statistics page, and unless Im missing something obvious (quite possible) it should address Requirements 5a) and 5b) from the original post here.......

Re: UQM 2.0 - Predictions Extensions

Posted: Mon Jan 18, 2010 6:27 pm
by subvertbeats
Updated OP with additional requirements and status.

Re: UQM 2.0 - Predictions Extensions

Posted: Tue Jan 19, 2010 4:27 am
by battye
1. Competition/Quiz Categories (eg may have a category for English Premier League predictions, another for boxing predictions etc) [PART OF STANDARD UQM 2.0]
Ok
2. For each competition, allow admin to post a set of questions with no answer yet (the questions are to predict sports fixtures yet to be played, possible answers: Team A Win, Team B Win, Draw) [TO BE DONE]
My suggestion, just enter something. What I write for you will overwrite whatever you put in originally, so rather than changing the whole submission checking system - just enter something :) Just one word only, something like tba
3. For each competition, allow answers to be submitted by forum users, and their responses stored [PART OF STANDARD UQM 2.0]
Ok
4. After the event has happened, allow admin to enter correct answers [TO BE DONE]
Yes, I will write the script that lets you do this. It will only be basic as only you/admins will be seeing it (no templating or anything like that) but it will do the trick.
5. Once correct answers are entered, for each competition:
a) Auto-assessment of submitted predictions against actual results [PART OF STANDARD UQM 2.0]
b) Display to admin ranked list of users (ordered in ascending priority of incorrect picks), with columns to show user name, number of incorrect predictions, number of correct predictions (to support us easily assessing winners, and giving out prizes) [PART OF STANDARD UQM 2.0]
I might be able to go one better here, I will try and have the script automatically update the statistics table for you - but in case you want to post the results on the forum or in an email, etc... when you run this script (the script will let you enter the correct answers, and will then scan the database for users who did the quiz and determine their scores) it will also give a display of the users results so you can copy/paste them.
6. Replace the word 'Quiz' throughout all GUI elements, other than copyright notices (makes more sense if changed to 'Competition' or 'Prediction Competition'). Also change 'Quizzes' to 'Competitions' [TO BE DONE]
You can do this yourself. In the language files included in the zip, open them (they are in language/en) and replace all instances of "Quiz" with whatever term you want to use. A "find and replace" (Ctrl+H on Windows I think) will do this for you in Notepad.
7. Remove display of the right/wrong totals after submitting a quiz (as the correct answers - i.e the actual results - wont be available at the time of submission) [TO BE DONE]
This is a setting in the ACP, turn "Show answers" to off. There is another change you will need to make, but I will explain that later.
8. Remove display of the time taken to complete the quiz (not necessary) [TO BE DONE]
In the ACP have you set "Time limit per question" to 0? I can't remember if that stops the time displaying or not, or if it only stops the quiz caring about the time it took... regardless, try it out and if it doesn't work I will give you the template change to make to stop the time from appearing.

Re: UQM 2.0 - Predictions Extensions

Posted: Tue Jan 19, 2010 12:00 pm
by subvertbeats
battye wrote:
2. For each competition, allow admin to post a set of questions with no answer yet (the questions are to predict sports fixtures yet to be played, possible answers: Team A Win, Team B Win, Draw) [TO BE DONE]
My suggestion, just enter something. What I write for you will overwrite whatever you put in originally, so rather than changing the whole submission checking system - just enter something :) Just one word only, something like tba
Not sure I understand that: The only available answers are 'Team A', 'Team B', or 'Draw'.
If I enter another option 'TBA' then users will be able to erroneously select that choice when they enter, and I would like to prevent that happening.
Perhaps you're suggesting I maybe put all the answers as 'Draw' initially?
battye wrote:
4. After the event has happened, allow admin to enter correct answers [TO BE DONE]
Yes, I will write the script that lets you do this. It will only be basic as only you/admins will be seeing it (no templating or anything like that) but it will do the trick.
Thanks!
battye wrote:
5. Once correct answers are entered, for each competition:
a) Auto-assessment of submitted predictions against actual results [PART OF STANDARD UQM 2.0]
b) Display to admin ranked list of users (ordered in ascending priority of incorrect picks), with columns to show user name, number of incorrect predictions, number of correct predictions (to support us easily assessing winners, and giving out prizes) [PART OF STANDARD UQM 2.0]
I might be able to go one better here, I will try and have the script automatically update the statistics table for you - but in case you want to post the results on the forum or in an email, etc... when you run this script (the script will let you enter the correct answers, and will then scan the database for users who did the quiz and determine their scores) it will also give a display of the users results so you can copy/paste them.
That would be perfect!
battye wrote:
6. Replace the word 'Quiz' throughout all GUI elements, other than copyright notices (makes more sense if changed to 'Competition' or 'Prediction Competition'). Also change 'Quizzes' to 'Competitions' [TO BE DONE]
You can do this yourself. In the language files included in the zip, open them (they are in language/en) and replace all instances of "Quiz" with whatever term you want to use. A "find and replace" (Ctrl+H on Windows I think) will do this for you in Notepad.
Thanks battye.....I was hoping all the strings would be externalized - I'll work on that shortly.
battye wrote:
7. Remove display of the right/wrong totals after submitting a quiz (as the correct answers - i.e the actual results - wont be available at the time of submission) [TO BE DONE]
This is a setting in the ACP, turn "Show answers" to off. There is another change you will need to make, but I will explain that later.
Thanks, that would be great. That option is off.
8. Remove display of the time taken to complete the quiz (not necessary) [TO BE DONE]
In the ACP have you set "Time limit per question" to 0? I can't remember if that stops the time displaying or not, or if it only stops the quiz caring about the time it took... regardless, try it out and if it doesn't work I will give you the template change to make to stop the time from appearing.[/quote]

Yes, I have that car set to 0, and it still displays.
Ive just commented out

Code: Select all

{TIME_SUMMARY}
from quiz_results_body.html

Hopefully that shoud do the trick....

Thanks!

Re: UQM 2.0 - Predictions Extensions

Posted: Tue Jan 19, 2010 12:09 pm
by battye
Not sure I understand that: The only available answers are 'Team A', 'Team B', or 'Draw'.
If I enter another option 'TBA' then users will be able to erroneously select that choice when they enter, and I would like to prevent that happening.
Perhaps you're suggesting I maybe put all the answers as 'Draw' initially?
Oh right, I misunderstood that (I didn't realise it was multiple choice). Yes, I meant put all of the answers as "draw", just so that an option is specified and the quiz will submit.

Re: UQM 2.0 - Predictions Extensions

Posted: Tue Jan 19, 2010 12:24 pm
by subvertbeats
Cool, gotcha.....thank you.

Ive done the language changes, and also got rid of the submit time notification.

Interestingly on submitting a competition Im getting:

[phpBB Debug] PHP Notice: in file /quiz.php on line 1015: Undefined variable: total_time_allowed
[phpBB Debug] PHP Notice: in file /quiz.php on line 1016: Undefined variable: total_time_allowed

Now $total_time_allowed is being set in a function that only runs if the following is true

Code: Select all

if ($config['quiz_time_limit_per_question'] > 0)
And I definitely have that var set to 0.
The quiz does submit correctly, or seems to, but that error is thrown

Re: UQM 2.0 - Predictions Extensions

Posted: Tue Jan 19, 2010 12:43 pm
by battye
Did you edit quiz.php?

Re: UQM 2.0 - Predictions Extensions

Posted: Tue Jan 19, 2010 12:47 pm
by subvertbeats
Nope, though I may have made an error with the time limit - I dont think I have, but to verify, I just retyped 0 and hit submit again in the acp.
Then Ive gone to validate the setting and see if I still get the error, so I refreshed the quiz submission page and got the cheating warning:
You are seeing this error because one of several events might have occurred:

- A cheating attempt may have been detected. You cannot leave a competition and later re-enter it without going through the save process.
- You have tried to resubmit a competition that you have exceeded the time limit on
- You have already played this competition, and the admin does not allow multiple attempts.
Not sure how to get round that? Tried going back to the list of quizzes and selecting the quiz again but the same warning is displayed.

Re: UQM 2.0 - Predictions Extensions

Posted: Tue Jan 19, 2010 1:22 pm
by battye
Open quiz.php and find on line 27:

Code: Select all

error_reporting(E_ALL | E_NOTICE);
Those errors will disappear now.

Cheating attempts happen because you refreshed the quiz submission page. It is to stop people from refreshing the page in order to reset the time limit. So don't ever refresh a quiz page :wink:

Re: UQM 2.0 - Predictions Extensions

Posted: Tue Jan 19, 2010 1:25 pm
by subvertbeats
Thanks battye

you want me to comment out that line?

And as for the cheating part - understood - but in the context of no timelimit, shouldnt that be disabled?
And as is the case now, its been triggered, how do I get back into the quiz?

Thanks!

Ben

Re: UQM 2.0 - Predictions Extensions

Posted: Tue Jan 19, 2010 1:34 pm
by battye
Yes, comment out that line.

As for getting back in, you will need to remove the particular row from the quiz_progressive table corresponding to the quiz_id and your user_id. I think this is probably a feature I should write into the code come to think of it.

Re: UQM 2.0 - Predictions Extensions

Posted: Tue Jan 19, 2010 1:35 pm
by subvertbeats
Ref getting back in - yes I think that would be a useful feature....


Another question for you.....with saved quizzes, will the users be able to submit their answers, and (optionally) any time before the event happens go in and change their predictions (this is the desired functionality) ?

Related to this I thought of something that is necessary - a very important function - close the quiz/comp for new entries (ideally automatically at a given date time, but for now a manual switch would be just fine).
Otherwise we'll get users cheating I guess...