MOBILE-4081 user: Use lastcourseaccess if not undefined
parent
4d152f93c1
commit
df58083c46
|
@ -2387,6 +2387,7 @@
|
|||
"core.user.errorloaduser": "local_moodlemobileapp",
|
||||
"core.user.firstname": "moodle",
|
||||
"core.user.interests": "moodle",
|
||||
"core.user.lastcourseaccess": "moodle",
|
||||
"core.user.lastname": "moodle",
|
||||
"core.user.manager": "role",
|
||||
"core.user.newpicture": "moodle",
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
"errorloaduser": "Error loading user.",
|
||||
"firstname": "First name",
|
||||
"interests": "Interests",
|
||||
"lastcourseaccess": "Last access to course",
|
||||
"lastname": "Surname",
|
||||
"manager": "Manager",
|
||||
"newpicture": "New picture",
|
||||
|
|
|
@ -34,13 +34,16 @@
|
|||
<ion-label>
|
||||
<ng-container *ngIf="!searchQuery">
|
||||
<p class="item-heading">{{ participant.fullname }}</p>
|
||||
<p *ngIf="participant.lastcourseaccess">
|
||||
<strong>{{ 'core.lastaccess' | translate }}: </strong>
|
||||
{{ participant.lastcourseaccess | coreTimeAgo }}
|
||||
<p *ngIf="participant.lastcourseaccess !== undefined">
|
||||
<strong>{{ 'core.user.lastcourseaccess' | translate }}: </strong>
|
||||
<ng-container *ngIf="participant.lastcourseaccess">{{ participant.lastcourseaccess | coreTimeAgo }}
|
||||
</ng-container>
|
||||
<ng-container *ngIf="!participant.lastcourseaccess">{{ 'core.never' | translate }}</ng-container>
|
||||
</p>
|
||||
<p *ngIf="!participant.lastcourseaccess && participant.lastaccess">
|
||||
<p *ngIf="participant.lastcourseaccess === undefined && participant.lastaccess !== undefined">
|
||||
<strong>{{ 'core.lastaccess' | translate }}: </strong>
|
||||
{{ participant.lastaccess | coreTimeAgo }}
|
||||
<ng-container *ngIf="participant.lastaccess">{{ participant.lastaccess | coreTimeAgo }}</ng-container>
|
||||
<ng-container *ngIf="!participant.lastaccess">{{ 'core.never' | translate }}</ng-container>
|
||||
</p>
|
||||
</ng-container>
|
||||
|
||||
|
|
|
@ -26,6 +26,11 @@
|
|||
<strong>{{ 'core.user.roles' | translate}}</strong>{{'core.labelsep' | translate}}
|
||||
{{ rolesFormatted }}
|
||||
</p>
|
||||
<p *ngIf="user.lastaccess !== undefined">
|
||||
<strong>{{ 'core.lastaccess' | translate }}: </strong>
|
||||
<span *ngIf="user.lastaccess">{{ user.lastaccess | coreTimeAgo }}</span>
|
||||
<ng-container *ngIf="!user.lastaccess">{{ 'core.never' | translate }}</ng-container>
|
||||
</p>
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
|
||||
|
|
|
@ -1003,7 +1003,7 @@ export type CoreUserParticipant = CoreUserBasicData & {
|
|||
interests?: string; // User interests (separated by commas).
|
||||
firstaccess?: number; // First access to the site (0 if never).
|
||||
lastaccess?: number; // Last access to the site (0 if never).
|
||||
lastcourseaccess?: number | null; // Last access to the course (0 if never).
|
||||
lastcourseaccess?: number | null; // @since 3.7. Last access to the course (0 if never).
|
||||
description?: string; // User profile description.
|
||||
descriptionformat?: number; // Description format (1 = HTML, 0 = MOODLE, 2 = PLAIN or 4 = MARKDOWN).
|
||||
city?: string; // Home city of the user.
|
||||
|
|
|
@ -38,7 +38,7 @@ export class CoreTimeAgoPipe implements PipeTransform {
|
|||
* @return Formatted time.
|
||||
*/
|
||||
transform(timestamp: string | number): string {
|
||||
if (typeof timestamp == 'string') {
|
||||
if (typeof timestamp === 'string') {
|
||||
// Convert the value to a number.
|
||||
const numberTimestamp = parseInt(timestamp, 10);
|
||||
if (isNaN(numberTimestamp)) {
|
||||
|
|
Loading…
Reference in New Issue