MOBILE-3939 feedback: rename respondents
parent
4fb700b985
commit
00a12df79b
|
@ -72,7 +72,7 @@
|
||||||
</ion-select-option>
|
</ion-select-option>
|
||||||
</ion-select>
|
</ion-select>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<ion-item class="ion-text-wrap" (click)="openRespondents()" [class.hide-detail]="!(access.canviewreports && completedCount > 0)"
|
<ion-item class="ion-text-wrap" (click)="openAttempts()" [class.hide-detail]="!(access.canviewreports && completedCount > 0)"
|
||||||
detail="true" [button]="access.canviewreports && completedCount > 0">
|
detail="true" [button]="access.canviewreports && completedCount > 0">
|
||||||
<ion-label>
|
<ion-label>
|
||||||
<h2>{{ 'addon.mod_feedback.completed_feedbacks' | translate }}</h2>
|
<h2>{{ 'addon.mod_feedback.completed_feedbacks' | translate }}</h2>
|
||||||
|
|
|
@ -400,15 +400,15 @@ export class AddonModFeedbackIndexComponent extends CoreCourseModuleMainActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open respondents page.
|
* Open attempts page.
|
||||||
*/
|
*/
|
||||||
openRespondents(): void {
|
openAttempts(): void {
|
||||||
if (!this.access!.canviewreports || this.completedCount <= 0) {
|
if (!this.access!.canviewreports || this.completedCount <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CoreNavigator.navigateToSitePath(
|
CoreNavigator.navigateToSitePath(
|
||||||
AddonModFeedbackModuleHandlerService.PAGE_NAME + `/${this.courseId}/${this.module.id}/respondents`,
|
AddonModFeedbackModuleHandlerService.PAGE_NAME + `/${this.courseId}/${this.module.id}/attempts`,
|
||||||
{
|
{
|
||||||
params: {
|
params: {
|
||||||
group: this.group,
|
group: this.group,
|
||||||
|
|
|
@ -17,7 +17,7 @@ import { RouterModule, Routes } from '@angular/router';
|
||||||
import { CoreSharedModule } from '@/core/shared.module';
|
import { CoreSharedModule } from '@/core/shared.module';
|
||||||
import { AddonModFeedbackComponentsModule } from './components/components.module';
|
import { AddonModFeedbackComponentsModule } from './components/components.module';
|
||||||
import { AddonModFeedbackIndexPage } from './pages/index/index';
|
import { AddonModFeedbackIndexPage } from './pages/index/index';
|
||||||
import { AddonModFeedbackRespondentsPage } from './pages/respondents/respondents';
|
import { AddonModFeedbackAttemptsPage } from './pages/attempts/attempts';
|
||||||
import { conditionalRoutes } from '@/app/app-routing.module';
|
import { conditionalRoutes } from '@/app/app-routing.module';
|
||||||
import { CoreScreen } from '@services/screen';
|
import { CoreScreen } from '@services/screen';
|
||||||
|
|
||||||
|
@ -40,11 +40,11 @@ const commonRoutes: Routes = [
|
||||||
const mobileRoutes: Routes = [
|
const mobileRoutes: Routes = [
|
||||||
...commonRoutes,
|
...commonRoutes,
|
||||||
{
|
{
|
||||||
path: ':courseId/:cmId/respondents',
|
path: ':courseId/:cmId/attempts',
|
||||||
component: AddonModFeedbackRespondentsPage,
|
component: AddonModFeedbackAttemptsPage,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ':courseId/:cmId/respondents/attempt/:attemptId',
|
path: ':courseId/:cmId/attempts/:attemptId',
|
||||||
loadChildren: () => import('./pages/attempt/attempt.module').then(m => m.AddonModFeedbackAttemptPageModule),
|
loadChildren: () => import('./pages/attempt/attempt.module').then(m => m.AddonModFeedbackAttemptPageModule),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
@ -52,11 +52,11 @@ const mobileRoutes: Routes = [
|
||||||
const tabletRoutes: Routes = [
|
const tabletRoutes: Routes = [
|
||||||
...commonRoutes,
|
...commonRoutes,
|
||||||
{
|
{
|
||||||
path: ':courseId/:cmId/respondents',
|
path: ':courseId/:cmId/attempts',
|
||||||
component: AddonModFeedbackRespondentsPage,
|
component: AddonModFeedbackAttemptsPage,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'attempt/:attemptId',
|
path: ':attemptId',
|
||||||
loadChildren: () => import('./pages/attempt/attempt.module').then(m => m.AddonModFeedbackAttemptPageModule),
|
loadChildren: () => import('./pages/attempt/attempt.module').then(m => m.AddonModFeedbackAttemptPageModule),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -76,7 +76,7 @@ const routes: Routes = [
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
AddonModFeedbackIndexPage,
|
AddonModFeedbackIndexPage,
|
||||||
AddonModFeedbackRespondentsPage,
|
AddonModFeedbackAttemptsPage,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class AddonModFeedbackLazyModule {}
|
export class AddonModFeedbackLazyModule {}
|
||||||
|
|
|
@ -29,14 +29,15 @@
|
||||||
</ion-select>
|
</ion-select>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
|
||||||
<ng-container *ngIf="responses.responses.total > 0">
|
<ng-container *ngIf="attempts.identifiable.total > 0">
|
||||||
<ion-item-divider>
|
<ion-item-divider>
|
||||||
<ion-label>
|
<ion-label>
|
||||||
<h2>{{ 'addon.mod_feedback.non_anonymous_entries' | translate : {$a: responses.responses.total } }}</h2>
|
<h2>{{ 'addon.mod_feedback.non_anonymous_entries' | translate : {$a: attempts.identifiable.total } }}
|
||||||
|
</h2>
|
||||||
</ion-label>
|
</ion-label>
|
||||||
</ion-item-divider>
|
</ion-item-divider>
|
||||||
<ion-item *ngFor="let attempt of responses.responses.attempts" class="ion-text-wrap" button detail="true"
|
<ion-item *ngFor="let attempt of attempts.identifiable.items" class="ion-text-wrap" button detail="true"
|
||||||
(click)="responses.select(attempt)" [attr.aria-current]="responses.getItemAriaCurrent(attempt)">
|
(click)="attempts.select(attempt)" [attr.aria-current]="attempts.getItemAriaCurrent(attempt)">
|
||||||
<core-user-avatar [user]="attempt" slot="start"></core-user-avatar>
|
<core-user-avatar [user]="attempt" slot="start"></core-user-avatar>
|
||||||
<ion-label>
|
<ion-label>
|
||||||
<p class="item-heading">{{ attempt.fullname }}</p>
|
<p class="item-heading">{{ attempt.fullname }}</p>
|
||||||
|
@ -45,36 +46,36 @@
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
|
||||||
<!-- Button and spinner to show more attempts. -->
|
<!-- Button and spinner to show more attempts. -->
|
||||||
<ion-button *ngIf="responses.responses.canLoadMore && !loadingMore" class="ion-margin" expand="block"
|
<ion-button *ngIf="attempts.identifiable.canLoadMore && !loadingMore" class="ion-margin" expand="block"
|
||||||
(click)="loadAttempts()">
|
(click)="loadAttempts()">
|
||||||
{{ 'core.loadmore' | translate }}
|
{{ 'core.loadmore' | translate }}
|
||||||
</ion-button>
|
</ion-button>
|
||||||
<ion-item *ngIf="responses.responses.canLoadMore && loadingMore" class="ion-text-center">
|
<ion-item *ngIf="attempts.identifiable.canLoadMore && loadingMore" class="ion-text-center">
|
||||||
<ion-label>
|
<ion-label>
|
||||||
<ion-spinner [attr.aria-label]="'core.loading' | translate"></ion-spinner>
|
<ion-spinner [attr.aria-label]="'core.loading' | translate"></ion-spinner>
|
||||||
</ion-label>
|
</ion-label>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container *ngIf="responses.anonResponses.total > 0">
|
<ng-container *ngIf="attempts.anonymous.total > 0">
|
||||||
<ion-item-divider>
|
<ion-item-divider>
|
||||||
<ion-label>
|
<ion-label>
|
||||||
<h2>{{ 'addon.mod_feedback.anonymous_entries' |translate : {$a: responses.anonResponses.total } }}</h2>
|
<h2>{{ 'addon.mod_feedback.anonymous_entries' |translate : {$a: attempts.anonymous.total } }}</h2>
|
||||||
</ion-label>
|
</ion-label>
|
||||||
</ion-item-divider>
|
</ion-item-divider>
|
||||||
<ion-item *ngFor="let attempt of responses.anonResponses.attempts" class="ion-text-wrap" button detail="true"
|
<ion-item *ngFor="let attempt of attempts.anonymous.items" class="ion-text-wrap" button detail="true"
|
||||||
(click)="responses.select(attempt)" [attr.aria-current]="responses.getItemAriaCurrent(attempt)">
|
(click)="attempts.select(attempt)" [attr.aria-current]="attempts.getItemAriaCurrent(attempt)">
|
||||||
<ion-label>
|
<ion-label>
|
||||||
<h2>{{ 'addon.mod_feedback.response_nr' |translate }}: {{attempt.number}}</h2>
|
<h2>{{ 'addon.mod_feedback.response_nr' |translate }}: {{attempt.number}}</h2>
|
||||||
</ion-label>
|
</ion-label>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
|
||||||
<!-- Button and spinner to show more attempts. -->
|
<!-- Button and spinner to show more attempts. -->
|
||||||
<ion-button *ngIf="responses.anonResponses.canLoadMore && !loadingMore" class="ion-margin" expand="block"
|
<ion-button *ngIf="attempts.anonymous.canLoadMore && !loadingMore" class="ion-margin" expand="block"
|
||||||
(click)="loadAttempts()">
|
(click)="loadAttempts()">
|
||||||
{{ 'core.loadmore' | translate }}
|
{{ 'core.loadmore' | translate }}
|
||||||
</ion-button>
|
</ion-button>
|
||||||
<ion-item *ngIf="responses.anonResponses.canLoadMore && loadingMore" class="ion-text-center">
|
<ion-item *ngIf="attempts.anonymous.canLoadMore && loadingMore" class="ion-text-center">
|
||||||
<ion-label>
|
<ion-label>
|
||||||
<ion-spinner [attr.aria-label]="'core.loading' | translate"></ion-spinner>
|
<ion-spinner [attr.aria-label]="'core.loading' | translate"></ion-spinner>
|
||||||
</ion-label>
|
</ion-label>
|
|
@ -30,13 +30,13 @@ import {
|
||||||
import { AddonModFeedbackHelper, AddonModFeedbackResponsesAnalysis } from '../../services/feedback-helper';
|
import { AddonModFeedbackHelper, AddonModFeedbackResponsesAnalysis } from '../../services/feedback-helper';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Page that displays feedback respondents.
|
* Page that displays feedback attempts.
|
||||||
*/
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'page-addon-mod-feedback-respondents',
|
selector: 'page-addon-mod-feedback-attempts',
|
||||||
templateUrl: 'respondents.html',
|
templateUrl: 'attempts.html',
|
||||||
})
|
})
|
||||||
export class AddonModFeedbackRespondentsPage implements AfterViewInit {
|
export class AddonModFeedbackAttemptsPage implements AfterViewInit {
|
||||||
|
|
||||||
@ViewChild(CoreSplitViewComponent) splitView!: CoreSplitViewComponent;
|
@ViewChild(CoreSplitViewComponent) splitView!: CoreSplitViewComponent;
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ export class AddonModFeedbackRespondentsPage implements AfterViewInit {
|
||||||
protected page = 0;
|
protected page = 0;
|
||||||
protected feedback?: AddonModFeedbackWSFeedback;
|
protected feedback?: AddonModFeedbackWSFeedback;
|
||||||
|
|
||||||
responses: AddonModFeedbackResponsesManager;
|
attempts: AddonModFeedbackAttemptsManager;
|
||||||
selectedGroup!: number;
|
selectedGroup!: number;
|
||||||
groupInfo?: CoreGroupInfo;
|
groupInfo?: CoreGroupInfo;
|
||||||
loaded = false;
|
loaded = false;
|
||||||
|
@ -54,7 +54,7 @@ export class AddonModFeedbackRespondentsPage implements AfterViewInit {
|
||||||
constructor(
|
constructor(
|
||||||
route: ActivatedRoute,
|
route: ActivatedRoute,
|
||||||
) {
|
) {
|
||||||
this.responses = new AddonModFeedbackResponsesManager(
|
this.attempts = new AddonModFeedbackAttemptsManager(
|
||||||
route.component,
|
route.component,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ export class AddonModFeedbackRespondentsPage implements AfterViewInit {
|
||||||
|
|
||||||
await this.fetchData();
|
await this.fetchData();
|
||||||
|
|
||||||
this.responses.start(this.splitView);
|
this.attempts.start(this.splitView);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -88,7 +88,7 @@ export class AddonModFeedbackRespondentsPage implements AfterViewInit {
|
||||||
*/
|
*/
|
||||||
async fetchData(refresh: boolean = false): Promise<void> {
|
async fetchData(refresh: boolean = false): Promise<void> {
|
||||||
this.page = 0;
|
this.page = 0;
|
||||||
this.responses.resetItems();
|
this.attempts.resetItems();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.feedback = await AddonModFeedback.getFeedback(this.courseId, this.cmId);
|
this.feedback = await AddonModFeedback.getFeedback(this.courseId, this.cmId);
|
||||||
|
@ -121,17 +121,17 @@ export class AddonModFeedbackRespondentsPage implements AfterViewInit {
|
||||||
} else {
|
} else {
|
||||||
this.selectedGroup = groupId;
|
this.selectedGroup = groupId;
|
||||||
this.page = 0;
|
this.page = 0;
|
||||||
this.responses.resetItems();
|
this.attempts.resetItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const responses = await AddonModFeedbackHelper.getResponsesAnalysis(this.feedback!.id, {
|
const attempts = await AddonModFeedbackHelper.getResponsesAnalysis(this.feedback!.id, {
|
||||||
groupId: this.selectedGroup,
|
groupId: this.selectedGroup,
|
||||||
page: this.page,
|
page: this.page,
|
||||||
cmId: this.cmId,
|
cmId: this.cmId,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.responses.setResponses(responses);
|
this.attempts.setAttempts(attempts);
|
||||||
} finally {
|
} finally {
|
||||||
this.loadingMore = false;
|
this.loadingMore = false;
|
||||||
this.loaded = true;
|
this.loaded = true;
|
||||||
|
@ -183,16 +183,16 @@ type EntryItem = AddonModFeedbackWSAttempt | AddonModFeedbackWSAnonAttempt;
|
||||||
/**
|
/**
|
||||||
* Entries manager.
|
* Entries manager.
|
||||||
*/
|
*/
|
||||||
class AddonModFeedbackResponsesManager extends CorePageItemsListManager<EntryItem> {
|
class AddonModFeedbackAttemptsManager extends CorePageItemsListManager<EntryItem> {
|
||||||
|
|
||||||
responses: AddonModFeedbackResponses = {
|
identifiable: AddonModFeedbackIdentifiableAttempts = {
|
||||||
attempts: [],
|
items: [],
|
||||||
total: 0,
|
total: 0,
|
||||||
canLoadMore: false,
|
canLoadMore: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
anonResponses: AddonModFeedbackAnonResponses = {
|
anonymous: AddonModFeedbackAnonymousAttempts = {
|
||||||
attempts: [],
|
items: [],
|
||||||
total: 0,
|
total: 0,
|
||||||
canLoadMore: false,
|
canLoadMore: false,
|
||||||
};
|
};
|
||||||
|
@ -202,25 +202,25 @@ class AddonModFeedbackResponsesManager extends CorePageItemsListManager<EntryIte
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update responses.
|
* Update attempts.
|
||||||
*
|
*
|
||||||
* @param responses Responses.
|
* @param attempts Attempts.
|
||||||
*/
|
*/
|
||||||
setResponses(responses: AddonModFeedbackResponsesAnalysis): void {
|
setAttempts(attempts: AddonModFeedbackResponsesAnalysis): void {
|
||||||
this.responses.total = responses.totalattempts;
|
this.identifiable.total = attempts.totalattempts;
|
||||||
this.anonResponses.total = responses.totalanonattempts;
|
this.anonymous.total = attempts.totalanonattempts;
|
||||||
|
|
||||||
if (this.anonResponses.attempts.length < responses.totalanonattempts) {
|
if (this.anonymous.items.length < attempts.totalanonattempts) {
|
||||||
this.anonResponses.attempts = this.anonResponses.attempts.concat(responses.anonattempts);
|
this.anonymous.items = this.anonymous.items.concat(attempts.anonattempts);
|
||||||
}
|
}
|
||||||
if (this.responses.attempts.length < responses.totalattempts) {
|
if (this.identifiable.items.length < attempts.totalattempts) {
|
||||||
this.responses.attempts = this.responses.attempts.concat(responses.attempts);
|
this.identifiable.items = this.identifiable.items.concat(attempts.attempts);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.anonResponses.canLoadMore = this.anonResponses.attempts.length < responses.totalanonattempts;
|
this.anonymous.canLoadMore = this.anonymous.items.length < attempts.totalanonattempts;
|
||||||
this.responses.canLoadMore = this.responses.attempts.length < responses.totalattempts;
|
this.identifiable.canLoadMore = this.identifiable.items.length < attempts.totalattempts;
|
||||||
|
|
||||||
this.setItems((<EntryItem[]> this.responses.attempts).concat(this.anonResponses.attempts));
|
this.setItems((<EntryItem[]> this.identifiable.items).concat(this.anonymous.items));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -228,29 +228,29 @@ class AddonModFeedbackResponsesManager extends CorePageItemsListManager<EntryIte
|
||||||
*/
|
*/
|
||||||
resetItems(): void {
|
resetItems(): void {
|
||||||
super.resetItems();
|
super.resetItems();
|
||||||
this.responses.total = 0;
|
this.identifiable.total = 0;
|
||||||
this.responses.attempts = [];
|
this.identifiable.items = [];
|
||||||
this.anonResponses.total = 0;
|
this.anonymous.total = 0;
|
||||||
this.anonResponses.attempts = [];
|
this.anonymous.items = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
protected getItemPath(entry: EntryItem): string {
|
protected getItemPath(entry: EntryItem): string {
|
||||||
return `attempt/${entry.id}`;
|
return entry.id.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type AddonModFeedbackResponses = {
|
type AddonModFeedbackIdentifiableAttempts = {
|
||||||
attempts: AddonModFeedbackWSAttempt[];
|
items: AddonModFeedbackWSAttempt[];
|
||||||
total: number;
|
total: number;
|
||||||
canLoadMore: boolean;
|
canLoadMore: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
type AddonModFeedbackAnonResponses = {
|
type AddonModFeedbackAnonymousAttempts = {
|
||||||
attempts: AddonModFeedbackWSAnonAttempt[];
|
items: AddonModFeedbackWSAnonAttempt[];
|
||||||
total: number;
|
total: number;
|
||||||
canLoadMore: boolean;
|
canLoadMore: boolean;
|
||||||
};
|
};
|
|
@ -184,7 +184,7 @@ export class AddonModFeedbackHelperProvider {
|
||||||
if (params.showcompleted === undefined) {
|
if (params.showcompleted === undefined) {
|
||||||
// Param showcompleted not defined. Show entry list.
|
// Param showcompleted not defined. Show entry list.
|
||||||
await CoreNavigator.navigateToSitePath(
|
await CoreNavigator.navigateToSitePath(
|
||||||
AddonModFeedbackModuleHandlerService.PAGE_NAME + `/${module.course}/${module.id}/respondents`,
|
AddonModFeedbackModuleHandlerService.PAGE_NAME + `/${module.course}/${module.id}/attempts`,
|
||||||
{ siteId },
|
{ siteId },
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue