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