MOBILE-4270 feedback: Display profile image in user attempt page

main
Dani Palou 2023-05-11 12:19:16 +02:00
parent 29483572b7
commit 5eb4d17ca4
2 changed files with 7 additions and 8 deletions

View File

@ -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);
}

View File

@ -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<AddonModFeedbackAttempt[]>;
protected async addImageProfile(entries: AddonModFeedbackWSNonRespondent[]): Promise<AddonModFeedbackNonRespondent[]>;
protected async addImageProfile(
async addImageProfile(entries: AddonModFeedbackWSAttempt[]): Promise<AddonModFeedbackAttempt[]>;
async addImageProfile(entries: AddonModFeedbackWSNonRespondent[]): Promise<AddonModFeedbackNonRespondent[]>;
async addImageProfile(
entries: (AddonModFeedbackWSAttempt | AddonModFeedbackWSNonRespondent)[],
): Promise<(AddonModFeedbackAttempt | AddonModFeedbackNonRespondent)[]> {
return Promise.all(entries.map(async (entry: AddonModFeedbackAttempt | AddonModFeedbackNonRespondent) => {