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