MOBILE-4418 feedback: Fix viewing attempts with groups
parent
23f0d07343
commit
43c89dddee
|
@ -22,6 +22,7 @@ import {
|
|||
AddonModFeedbackWSFeedback,
|
||||
} from '../services/feedback';
|
||||
import { AddonModFeedbackHelper } from '../services/feedback-helper';
|
||||
import { Params } from '@angular/router';
|
||||
|
||||
/**
|
||||
* Feedback attempts.
|
||||
|
@ -53,6 +54,15 @@ export class AddonModFeedbackAttemptsSource extends CoreRoutedItemsManagerSource
|
|||
return attempt.id.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
getItemQueryParams(): Params {
|
||||
return {
|
||||
groupId: this.selectedGroup,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
|
|
|
@ -50,12 +50,14 @@ export class AddonModFeedbackAttemptPage implements OnInit, OnDestroy {
|
|||
loaded = false;
|
||||
|
||||
protected attemptId: number;
|
||||
protected groupId?: number;
|
||||
protected logView: () => void;
|
||||
|
||||
constructor() {
|
||||
this.cmId = CoreNavigator.getRequiredRouteNumberParam('cmId');
|
||||
this.courseId = CoreNavigator.getRequiredRouteNumberParam('courseId');
|
||||
this.attemptId = CoreNavigator.getRequiredRouteNumberParam('attemptId');
|
||||
this.groupId = CoreNavigator.getRouteNumberParam('groupId');
|
||||
|
||||
const source = CoreRoutedItemsManagerSourcesTracker.getOrCreateSource(
|
||||
AddonModFeedbackAttemptsSource,
|
||||
|
@ -113,7 +115,10 @@ export class AddonModFeedbackAttemptPage implements OnInit, OnDestroy {
|
|||
try {
|
||||
this.feedback = await AddonModFeedback.getFeedback(this.courseId, this.cmId);
|
||||
|
||||
const attempt = await AddonModFeedback.getAttempt(this.feedback.id, this.attemptId, { cmId: this.cmId });
|
||||
const attempt = await AddonModFeedback.getAttempt(this.feedback.id, this.attemptId, {
|
||||
cmId: this.cmId,
|
||||
groupId: this.groupId,
|
||||
});
|
||||
|
||||
if (this.isAnonAttempt(attempt)) {
|
||||
this.anonAttempt = attempt;
|
||||
|
|
|
@ -198,7 +198,7 @@ export class AddonModFeedbackHelperProvider {
|
|||
});
|
||||
|
||||
await CoreNavigator.navigateToSitePath(
|
||||
AddonModFeedbackModuleHandlerService.PAGE_NAME + `/${module.course}/${module.id}/attempt/${attempt.id}`,
|
||||
AddonModFeedbackModuleHandlerService.PAGE_NAME + `/${module.course}/${module.id}/attempts/${attempt.id}`,
|
||||
{
|
||||
params: {
|
||||
feedbackId: module.instance,
|
||||
|
|
|
@ -358,7 +358,7 @@ export class AddonModFeedbackProvider {
|
|||
async getAttempt(
|
||||
feedbackId: number,
|
||||
attemptId: number,
|
||||
options: CoreCourseCommonModWSOptions = {},
|
||||
options: AddonModFeedbackGroupOptions = {},
|
||||
previous?: AddonModFeedbackGetAttemptPreviousData,
|
||||
): Promise<AddonModFeedbackWSAttempt | AddonModFeedbackWSAnonAttempt> {
|
||||
options.siteId = options.siteId || CoreSites.getCurrentSiteId();
|
||||
|
@ -370,7 +370,6 @@ export class AddonModFeedbackProvider {
|
|||
|
||||
const responses = await this.getResponsesAnalysis(feedbackId, {
|
||||
page: previous.page,
|
||||
groupId: 0,
|
||||
...options, // Include all options.
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue