From 2f46048aeacbb0ff99ec8273a5781344983a5c3e Mon Sep 17 00:00:00 2001 From: ubuntu Date: Wed, 25 Dec 2013 11:10:59 +0200 Subject: [PATCH] CONTRIB-4774 fix:crossword game activity throws database error --- cross/play.php | 2 +- cryptex/play.php | 2 +- hangman/play.php | 2 +- locallib.php | 6 +++--- snakes/play.php | 2 +- version.php | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cross/play.php b/cross/play.php index 680dede..a97f427 100755 --- a/cross/play.php +++ b/cross/play.php @@ -55,7 +55,7 @@ function game_cross_new( $game, $attemptid, &$crossm) $infos[ $rec->answertext] = array( $game->sourcemodule, $rec->questionid, $rec->glossaryentryid, $rec->attachment); $a = array( 'gameid' => $game->id, 'userid' => $USER->id, 'questionid' => $rec->questionid, 'glossaryentryid' => $rec->glossaryentryid); - if(($rec2 = $DB->get_record('game_repetitions', $a, 'id,repetitions r')) != false){ + if(($rec2 = $DB->get_record('game_repetitions', $a, 'id,repetitions AS r')) != false){ $reps[ $rec->answertext] = $rec2->r; } } diff --git a/cryptex/play.php b/cryptex/play.php index a6c0543..62bddb0 100755 --- a/cryptex/play.php +++ b/cryptex/play.php @@ -52,7 +52,7 @@ function game_cryptex_continue( $id, $game, $attempt, $cryptexrec, $endofgame, $ $infos[ $rec->answertext] = array( $game->sourcemodule, $rec->questionid, $rec->glossaryentryid); $a = array( 'gameid' => $game->id, 'userid' => $USER->id, 'questionid' => $rec->questionid, 'glossaryentryid' => $rec->glossaryentryid); - if(($rec2 = $DB->get_record('game_repetitions', $a, 'id,repetitions r')) != false){ + if(($rec2 = $DB->get_record('game_repetitions', $a, 'id,repetitions AS r')) != false){ $reps[ $rec->answertext] = $rec2->r; } } diff --git a/hangman/play.php b/hangman/play.php index 67eeff6..8049151 100755 --- a/hangman/play.php +++ b/hangman/play.php @@ -73,7 +73,7 @@ function game_hangman_continue( $id, $game, $attempt, $hangman, $newletter, $act $copy = false; $select2 = 'gameid=? AND userid=? AND questionid=? AND glossaryentryid=?'; - if( ($rec2 = $DB->get_record_select( 'game_repetitions', $select2, array( $game->id, $USER->id, $rec->questionid, $rec->glossaryentryid), 'id,repetitions r')) != false){ + if( ($rec2 = $DB->get_record_select( 'game_repetitions', $select2, array( $game->id, $USER->id, $rec->questionid, $rec->glossaryentryid), 'id,repetitions AS r')) != false){ if( ($rec2->r < $min_num) or ($min_num == 0)){ $min_num = $rec2->r; $copy = true; diff --git a/locallib.php b/locallib.php index e894547..ed7a6e0 100755 --- a/locallib.php +++ b/locallib.php @@ -270,7 +270,7 @@ function game_question_selectrandom( $game, $table, $select, $id_fields='id', $u $questionid = $id; $a = array( 'gameid' => $game->id, 'userid' => $USER->id, 'questionid' => $questionid, 'glossaryentryid' => $glossaryentryid); - if( ($rec = $DB->get_record( 'game_repetitions', $a, 'id,repetitions r')) != false){ + if( ($rec = $DB->get_record( 'game_repetitions', $a, 'id,repetitions AS r')) != false){ if( ($rec->r < $min_num) or ($min_num == 0)){ $min_num = $rec->r; $min_id = $id; @@ -295,7 +295,7 @@ function game_update_repetitions( $gameid, $userid, $questionid, $glossaryentryi global $DB; $a = array( 'gameid' => $gameid, 'userid' => $userid, 'questionid' => $questionid, 'glossaryentryid' => $glossaryentryid); - if( ($rec = $DB->get_record( 'game_repetitions', $a, 'id,repetitions r')) != false){ + if( ($rec = $DB->get_record( 'game_repetitions', $a, 'id,repetitions AS r')) != false){ $updrec = new stdClass(); $updrec->id = $rec->id; $updrec->repetitions = $rec->r + 1; @@ -1480,7 +1480,7 @@ function game_select_from_repetitions( $game, $recs, $need){ foreach( $recs as $rec){ $a = array( 'gameid' => $game->id, 'userid' => $USER->id, 'questionid' => $rec->questionid, 'glossaryentryid' => $rec->glossaryentryid); $id = $rec->$field; - if( ($rec = $DB->get_record( 'game_repetitions', $a, 'id,repetitions r')) != false){ + if( ($rec = $DB->get_record( 'game_repetitions', $a, 'id,repetitions AS r')) != false){ $reps[ $id] = $rec->r; }else { diff --git a/snakes/play.php b/snakes/play.php index 17f4641..3022a3a 100755 --- a/snakes/play.php +++ b/snakes/play.php @@ -170,7 +170,7 @@ function game_snakes_computenextquestion( $game, &$snakes, &$query) $query = new stdClass(); foreach( $recs as $rec){ $a = array( 'gameid' => $game->id, 'userid' => $USER->id, 'questionid' => $rec->questionid, 'glossaryentryid' => $rec->glossaryentryid); - if(($rec2 = $DB->get_record('game_repetitions', $a, 'id,repetitions r')) != false){ + if(($rec2 = $DB->get_record('game_repetitions', $a, 'id,repetitions AS r')) != false){ if( ($rec2->r < $min_num) or ($min_num == 0)){ $min_num = $rec2->r; $query->glossaryentryid = $rec->glossaryentryid; diff --git a/version.php b/version.php index 75b9be1..6f06066 100755 --- a/version.php +++ b/version.php @@ -11,7 +11,7 @@ defined('MOODLE_INTERNAL') || die(); $module->component = 'mod_game'; // Full name of the plugin (used for diagnostics) -$module->version = 2013122501; // The current module version (Date: YYYYMMDDXX) +$module->version = 2013122502; // The current module version (Date: YYYYMMDDXX) $module->requires = 2010112400; // Requires Moodle 2.0 $module->cron = 0; // Period for cron to check this module (secs) -$module->release = '3.12.25'; +$module->release = '3.12.25.2';