Skip to content
Snippets Groups Projects
Commit 968608f0 authored by Thomas Marstrander's avatar Thomas Marstrander
Browse files

Merge branch 'stable' into release

parents 8f58da2d 24cdadda
No related branches found
No related tags found
No related merge requests found
...@@ -180,6 +180,10 @@ class results { ...@@ -180,6 +180,10 @@ class results {
throw new \coding_exception('missing content_id'); throw new \coding_exception('missing content_id');
} }
// Xapi join
$where[] = "x.content_id = ?";
$args[] = $this->contentid;
// Build where statement. // Build where statement.
$where[] = "i.itemtype = 'mod'"; $where[] = "i.itemtype = 'mod'";
$where[] = "i.itemmodule = 'hvp'"; $where[] = "i.itemmodule = 'hvp'";
...@@ -193,8 +197,8 @@ class results { ...@@ -193,8 +197,8 @@ class results {
$orderby = $this->get_order_sql($order); $orderby = $this->get_order_sql($order);
// Join on xAPI results. // Join on xAPI results.
$join .= ' LEFT JOIN {hvp_xapi_results} x ON i.iteminstance = x.content_id'; $join .= ' LEFT JOIN {hvp_xapi_results} x ON g.userid = x.user_id';
$join .= " LEFT JOIN {user} u ON u.id = x.user_id"; $join .= " LEFT JOIN {user} u ON u.id = g.userid";
$groupby = ' GROUP BY i.id, g.id, u.id, i.iteminstance, x.id'; $groupby = ' GROUP BY i.id, g.id, u.id, i.iteminstance, x.id';
// Get from statement. // Get from statement.
...@@ -298,11 +302,8 @@ class results { ...@@ -298,11 +302,8 @@ class results {
$ordered = array("{$prefix}firstname", "{$prefix}lastname"); $ordered = array("{$prefix}firstname", "{$prefix}lastname");
} else { } else {
// Find fields in order. // Find fields in order.
$matches = array(); foreach ($available as $key => $value) {
preg_match_all('/' . implode('|', $available) . '/', $displayname, $matches); $ordered[] = $prefix . $available[$key];
$ordered = $matches[0];
foreach ($ordered as $index => $value) {
$ordered[$index] = "{$prefix}{$value}";
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment