From 01ec387ab604c2959125d370507d1c479a02409a Mon Sep 17 00:00:00 2001 From: Vasilis Daloukas Date: Mon, 17 Apr 2017 16:07:12 +0300 Subject: [PATCH] Fix: recent activity on lib.php --- db/upgrade.php | 2 +- lib.php | 19 +++++-------------- version.php | 2 +- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/db/upgrade.php b/db/upgrade.php index 6c75786..3aca593 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -1547,7 +1547,7 @@ function xmldb_game_upgrade($oldversion) { if ($oldversion < ($ver = 2016062603)) { $table = new xmldb_table('game_cross'); - $field = new xmldb_field('createscore', XMLDB_TYPE_FLOAT, null, null, XMLDB_NULL, null, '0'); + $field = new xmldb_field('createscore', XMLDB_TYPE_FLOAT, null, null, null, null, '0'); // Launch change of type for field thisfield $dbman->change_field_type($table, $field); diff --git a/lib.php b/lib.php index c854423..8a574f0 100644 --- a/lib.php +++ b/lib.php @@ -539,16 +539,11 @@ function game_get_recent_mod_activity(&$activities, &$index, $timestart, $course $groupjoin = ""; } - if (!$attempts = $DB->get_records_sql("SELECT qa.*, qa.gameid, q.grade, u.lastname,". - " u.firstname, firstnamephonetic, u.lastnamephonetic, u.middlename, u.alternatename,". - " u.lastnamephonetic, u.picture - FROM {game_attempts} qa - JOIN {game} q ON q.id = qa.gameid - JOIN {user} u ON u.id = qa.userid - $groupjoin - WHERE qa.timefinish > $timestart AND q.id = $cm->instance - $userselect $groupselect - ORDER BY qa.timefinish ASC")) { + $sql = "SELECT qa.*, qa.gameid, q.grade, u.lastname,u.firstname,u.picture ". + "FROM {game_attempts} qa JOIN {game} q ON q.id = qa.gameid JOIN {user} u ON u.id = qa.userid $groupjoin ". + "WHERE qa.timefinish > $timestart AND q.id = $cm->instance $userselect $groupselect ". + "ORDER BY qa.timefinish ASC"; + if (!$attempts = $DB->get_records_sql( $sql)) { return; } @@ -603,10 +598,6 @@ function game_get_recent_mod_activity(&$activities, &$index, $timestart, $course $tmpactivity->user->fullname = fullname($attempt, $viewfullnames); $tmpactivity->user->firstname = $attempt->firstname; $tmpactivity->user->lastname = $attempt->lastname; - $tmpactivity->user->alternatename = $attempt->alternatename; - $tmpactivity->user->middlename = $attempt->middlename; - $tmpactivity->user->firstnamephonetic = $attempt->firstnamephonetic; - $tmpactivity->user->lastnamephonetic = $attempt->lastnamephonetic; $tmpactivity->user->picture = $attempt->picture; $tmpactivity->user->imagealt = $attempt->imagealt; $tmpactivity->user->email = $attempt->email; diff --git a/version.php b/version.php index 40a2b89..a65bc9d 100644 --- a/version.php +++ b/version.php @@ -36,7 +36,7 @@ if (!isset( $plugin)) { } $plugin->component = 'mod_game'; // Full name of the plugin (used for diagnostics). -$plugin->version = 2016091701; // The current module version (Date: YYYYMMDDXX). +$plugin->version = 2017041701; // The current module version (Date: YYYYMMDDXX). $plugin->requires = 2010112400; // Requires Moodle 2.0. $plugin->cron = 0; // Period for cron to check this module (secs). $plugin->release = '2016-09-17';