From 5eb4d17ca4f470c624e6e1a8a429171fbbc0c453 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Thu, 11 May 2023 12:19:16 +0200 Subject: [PATCH] MOBILE-4270 feedback: Display profile image in user attempt page --- src/addons/mod/feedback/pages/attempt/attempt.ts | 9 ++++----- src/addons/mod/feedback/services/feedback-helper.ts | 6 +++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/addons/mod/feedback/pages/attempt/attempt.ts b/src/addons/mod/feedback/pages/attempt/attempt.ts index 762aa611c..e2db40423 100644 --- a/src/addons/mod/feedback/pages/attempt/attempt.ts +++ b/src/addons/mod/feedback/pages/attempt/attempt.ts @@ -24,10 +24,9 @@ import { AddonModFeedback, AddonModFeedbackProvider, AddonModFeedbackWSAnonAttempt, - AddonModFeedbackWSAttempt, AddonModFeedbackWSFeedback, } from '../../services/feedback'; -import { AddonModFeedbackFormItem, AddonModFeedbackHelper } from '../../services/feedback-helper'; +import { AddonModFeedbackAttempt, AddonModFeedbackFormItem, AddonModFeedbackHelper } from '../../services/feedback-helper'; /** * Page that displays a feedback attempt review. @@ -41,7 +40,7 @@ export class AddonModFeedbackAttemptPage implements OnInit, OnDestroy { cmId: number; courseId: number; feedback?: AddonModFeedbackWSFeedback; - attempt?: AddonModFeedbackWSAttempt; + attempt?: AddonModFeedbackAttempt; attempts: AddonModFeedbackAttemptsSwipeManager; anonAttempt?: AddonModFeedbackWSAnonAttempt; items: AddonModFeedbackAttemptItem[] = []; @@ -102,7 +101,7 @@ export class AddonModFeedbackAttemptPage implements OnInit, OnDestroy { this.anonAttempt = attempt; delete this.attempt; } else { - this.attempt = attempt; + this.attempt = (await AddonModFeedbackHelper.addImageProfile([attempt]))[0]; delete this.anonAttempt; } @@ -145,7 +144,7 @@ export class AddonModFeedbackAttemptPage implements OnInit, OnDestroy { * @param attempt Attempt to check. * @returns If attempt is anonymous. */ - isAnonAttempt(attempt: AddonModFeedbackWSAttempt | AddonModFeedbackWSAnonAttempt): attempt is AddonModFeedbackWSAnonAttempt { + isAnonAttempt(attempt: AddonModFeedbackAttempt | AddonModFeedbackWSAnonAttempt): attempt is AddonModFeedbackWSAnonAttempt { return !('fullname' in attempt); } diff --git a/src/addons/mod/feedback/services/feedback-helper.ts b/src/addons/mod/feedback/services/feedback-helper.ts index 47920a859..1b312968e 100644 --- a/src/addons/mod/feedback/services/feedback-helper.ts +++ b/src/addons/mod/feedback/services/feedback-helper.ts @@ -220,9 +220,9 @@ export class AddonModFeedbackHelperProvider { * @param entries Entries array to get profile from. * @returns Returns the same array with the profileimageurl added if found. */ - protected async addImageProfile(entries: AddonModFeedbackWSAttempt[]): Promise; - protected async addImageProfile(entries: AddonModFeedbackWSNonRespondent[]): Promise; - protected async addImageProfile( + async addImageProfile(entries: AddonModFeedbackWSAttempt[]): Promise; + async addImageProfile(entries: AddonModFeedbackWSNonRespondent[]): Promise; + async addImageProfile( entries: (AddonModFeedbackWSAttempt | AddonModFeedbackWSNonRespondent)[], ): Promise<(AddonModFeedbackAttempt | AddonModFeedbackNonRespondent)[]> { return Promise.all(entries.map(async (entry: AddonModFeedbackAttempt | AddonModFeedbackNonRespondent) => {