diff --git a/classes/output/mobile.php b/classes/output/mobile.php
index 1e36d63..f8abacc 100644
--- a/classes/output/mobile.php
+++ b/classes/output/mobile.php
@@ -60,7 +60,11 @@ class mobile {
$certificate->introformat, $context->id, 'mod_customcert', 'intro');
// Get any issues this person may have.
- $issues = $DB->get_records('customcert_issues', ['userid' => $USER->id, 'customcertid' => $certificate->id]);
+ $issue = false;
+ if ($issues = $DB->get_records('customcert_issues', ['userid' => $USER->id, 'customcertid' => $certificate->id],
+ 'timecreated DESC')) {
+ $issue = reset($issues);
+ }
$candownload = true;
$canmanage = has_capability('mod/customcert:manage', $context);
@@ -101,8 +105,7 @@ class mobile {
$data = [
'certificate' => $certificate,
'cmid' => $cm->id,
- 'hasissues' => !empty($issues),
- 'issues' => array_values($issues),
+ 'issue' => $issue,
'showgroups' => !empty($groups),
'groups' => array_values($groups),
'canmanage' => $canmanage,
diff --git a/templates/mobile_view_activity_page.mustache b/templates/mobile_view_activity_page.mustache
index 1d389e2..8488f51 100644
--- a/templates/mobile_view_activity_page.mustache
+++ b/templates/mobile_view_activity_page.mustache
@@ -50,12 +50,9 @@
"requiredtime": "60"
},
"cmid": "25",
- "hasissues": "true",
- "issues": [
- {
- "timecreated": "1528370177"
- }
- ],
+ "issue": {
+ "timecreated": "1528370177"
+ },
"showgroups": "true",
"groups": [
{
@@ -84,20 +81,15 @@
{{=<% %>=}}
- <%#hasissues%>
+ <%#issue%>
<%^canmanage%>
-
-
- {{ 'plugin.mod_customcert.receiveddate' | translate }}
-
- <%#issues%>
-
- {{ <% timecreated %> | coreToLocaleString }}
-
- <%/issues%>
-
+
+ {{ 'plugin.mod_customcert.receiveddate' | translate }}
+
+ {{ <% timecreated %> | coreToLocaleString }}
+
<%/canmanage%>
- <%/hasissues%>
+ <%/issue%>
<%#candownload%>