MOBILE-4270 feedback: Display profile image in user attempt page
parent
29483572b7
commit
5eb4d17ca4
|
@ -24,10 +24,9 @@ import {
|
||||||
AddonModFeedback,
|
AddonModFeedback,
|
||||||
AddonModFeedbackProvider,
|
AddonModFeedbackProvider,
|
||||||
AddonModFeedbackWSAnonAttempt,
|
AddonModFeedbackWSAnonAttempt,
|
||||||
AddonModFeedbackWSAttempt,
|
|
||||||
AddonModFeedbackWSFeedback,
|
AddonModFeedbackWSFeedback,
|
||||||
} from '../../services/feedback';
|
} 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.
|
* Page that displays a feedback attempt review.
|
||||||
|
@ -41,7 +40,7 @@ export class AddonModFeedbackAttemptPage implements OnInit, OnDestroy {
|
||||||
cmId: number;
|
cmId: number;
|
||||||
courseId: number;
|
courseId: number;
|
||||||
feedback?: AddonModFeedbackWSFeedback;
|
feedback?: AddonModFeedbackWSFeedback;
|
||||||
attempt?: AddonModFeedbackWSAttempt;
|
attempt?: AddonModFeedbackAttempt;
|
||||||
attempts: AddonModFeedbackAttemptsSwipeManager;
|
attempts: AddonModFeedbackAttemptsSwipeManager;
|
||||||
anonAttempt?: AddonModFeedbackWSAnonAttempt;
|
anonAttempt?: AddonModFeedbackWSAnonAttempt;
|
||||||
items: AddonModFeedbackAttemptItem[] = [];
|
items: AddonModFeedbackAttemptItem[] = [];
|
||||||
|
@ -102,7 +101,7 @@ export class AddonModFeedbackAttemptPage implements OnInit, OnDestroy {
|
||||||
this.anonAttempt = attempt;
|
this.anonAttempt = attempt;
|
||||||
delete this.attempt;
|
delete this.attempt;
|
||||||
} else {
|
} else {
|
||||||
this.attempt = attempt;
|
this.attempt = (await AddonModFeedbackHelper.addImageProfile([attempt]))[0];
|
||||||
delete this.anonAttempt;
|
delete this.anonAttempt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +144,7 @@ export class AddonModFeedbackAttemptPage implements OnInit, OnDestroy {
|
||||||
* @param attempt Attempt to check.
|
* @param attempt Attempt to check.
|
||||||
* @returns If attempt is anonymous.
|
* @returns If attempt is anonymous.
|
||||||
*/
|
*/
|
||||||
isAnonAttempt(attempt: AddonModFeedbackWSAttempt | AddonModFeedbackWSAnonAttempt): attempt is AddonModFeedbackWSAnonAttempt {
|
isAnonAttempt(attempt: AddonModFeedbackAttempt | AddonModFeedbackWSAnonAttempt): attempt is AddonModFeedbackWSAnonAttempt {
|
||||||
return !('fullname' in attempt);
|
return !('fullname' in attempt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -220,9 +220,9 @@ export class AddonModFeedbackHelperProvider {
|
||||||
* @param entries Entries array to get profile from.
|
* @param entries Entries array to get profile from.
|
||||||
* @returns Returns the same array with the profileimageurl added if found.
|
* @returns Returns the same array with the profileimageurl added if found.
|
||||||
*/
|
*/
|
||||||
protected async addImageProfile(entries: AddonModFeedbackWSAttempt[]): Promise<AddonModFeedbackAttempt[]>;
|
async addImageProfile(entries: AddonModFeedbackWSAttempt[]): Promise<AddonModFeedbackAttempt[]>;
|
||||||
protected async addImageProfile(entries: AddonModFeedbackWSNonRespondent[]): Promise<AddonModFeedbackNonRespondent[]>;
|
async addImageProfile(entries: AddonModFeedbackWSNonRespondent[]): Promise<AddonModFeedbackNonRespondent[]>;
|
||||||
protected async addImageProfile(
|
async addImageProfile(
|
||||||
entries: (AddonModFeedbackWSAttempt | AddonModFeedbackWSNonRespondent)[],
|
entries: (AddonModFeedbackWSAttempt | AddonModFeedbackWSNonRespondent)[],
|
||||||
): Promise<(AddonModFeedbackAttempt | AddonModFeedbackNonRespondent)[]> {
|
): Promise<(AddonModFeedbackAttempt | AddonModFeedbackNonRespondent)[]> {
|
||||||
return Promise.all(entries.map(async (entry: AddonModFeedbackAttempt | AddonModFeedbackNonRespondent) => {
|
return Promise.all(entries.map(async (entry: AddonModFeedbackAttempt | AddonModFeedbackNonRespondent) => {
|
||||||
|
|
Loading…
Reference in New Issue