Browse Source

Fix: recent activity on lib.php

MOODLE_20_STABLE
Vasilis Daloukas 8 years ago
parent
commit
01ec387ab6
  1. 2
      db/upgrade.php
  2. 19
      lib.php
  3. 2
      version.php

2
db/upgrade.php

@ -1547,7 +1547,7 @@ function xmldb_game_upgrade($oldversion) {
if ($oldversion < ($ver = 2016062603)) { if ($oldversion < ($ver = 2016062603)) {
$table = new xmldb_table('game_cross'); $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 // Launch change of type for field thisfield
$dbman->change_field_type($table, $field); $dbman->change_field_type($table, $field);

19
lib.php

@ -539,16 +539,11 @@ function game_get_recent_mod_activity(&$activities, &$index, $timestart, $course
$groupjoin = ""; $groupjoin = "";
} }
if (!$attempts = $DB->get_records_sql("SELECT qa.*, qa.gameid, q.grade, u.lastname,". $sql = "SELECT qa.*, qa.gameid, q.grade, u.lastname,u.firstname,u.picture ".
" u.firstname, firstnamephonetic, u.lastnamephonetic, u.middlename, u.alternatename,". "FROM {game_attempts} qa JOIN {game} q ON q.id = qa.gameid JOIN {user} u ON u.id = qa.userid $groupjoin ".
" u.lastnamephonetic, u.picture "WHERE qa.timefinish > $timestart AND q.id = $cm->instance $userselect $groupselect ".
FROM {game_attempts} qa "ORDER BY qa.timefinish ASC";
JOIN {game} q ON q.id = qa.gameid if (!$attempts = $DB->get_records_sql( $sql)) {
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")) {
return; return;
} }
@ -603,10 +598,6 @@ function game_get_recent_mod_activity(&$activities, &$index, $timestart, $course
$tmpactivity->user->fullname = fullname($attempt, $viewfullnames); $tmpactivity->user->fullname = fullname($attempt, $viewfullnames);
$tmpactivity->user->firstname = $attempt->firstname; $tmpactivity->user->firstname = $attempt->firstname;
$tmpactivity->user->lastname = $attempt->lastname; $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->picture = $attempt->picture;
$tmpactivity->user->imagealt = $attempt->imagealt; $tmpactivity->user->imagealt = $attempt->imagealt;
$tmpactivity->user->email = $attempt->email; $tmpactivity->user->email = $attempt->email;

2
version.php

@ -36,7 +36,7 @@ if (!isset( $plugin)) {
} }
$plugin->component = 'mod_game'; // Full name of the plugin (used for diagnostics). $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->requires = 2010112400; // Requires Moodle 2.0.
$plugin->cron = 0; // Period for cron to check this module (secs). $plugin->cron = 0; // Period for cron to check this module (secs).
$plugin->release = '2016-09-17'; $plugin->release = '2016-09-17';

Loading…
Cancel
Save