Merge pull request #1438 from dpalou/MOBILE-2503

Mobile 2503
main
Juan Leyva 2018-08-21 14:29:13 +01:00 committed by GitHub
commit a30bd282de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 7 deletions

View File

@ -23,7 +23,7 @@
<ion-item-divider *ngIf="item.typ == 'pagebreak'" color="light"></ion-item-divider>
<ion-item text-wrap *ngIf="item.typ != 'pagebreak'" [color]="item.dependitem > 0 ? 'light' : ''">
<h2 *ngIf="item.name" [core-mark-required]="item.required">
<span *ngIf="item.itemnumber">{{item.itemnumber}}. </span><core-format-text [component]="component" [componentId]="componentId" [text]="item.name"></core-format-text>
<span *ngIf="feedback.autonumbering && item.itemnumber">{{item.itemnumber}}. </span><core-format-text [component]="component" [componentId]="componentId" [text]="item.name"></core-format-text>
</h2>
<p *ngIf="item.submittedValue"><core-format-text [component]="component" [componentId]="componentId" [text]=" item.submittedValue"></core-format-text></p>
</ion-item>

View File

@ -30,7 +30,9 @@ import { CoreTextUtilsProvider } from '@providers/utils/text';
export class AddonModFeedbackAttemptPage {
protected feedbackId: number;
protected courseId: number;
feedback: any;
attempt: any;
items: any;
componentId: number;
@ -41,6 +43,7 @@ export class AddonModFeedbackAttemptPage {
protected domUtils: CoreDomUtilsProvider, protected feedbackHelper: AddonModFeedbackHelperProvider,
protected textUtils: CoreTextUtilsProvider) {
this.feedbackId = navParams.get('feedbackId') || 0;
this.courseId = navParams.get('courseId');
this.attempt = navParams.get('attempt') || false;
this.componentId = navParams.get('moduleId');
}
@ -58,7 +61,12 @@ export class AddonModFeedbackAttemptPage {
* @return {Promise<any>} Promise resolved when done.
*/
fetchData(): Promise<any> {
return this.feedbackProvider.getItems(this.feedbackId).then((items) => {
// Get the feedback to be able to now if questions should be autonumbered.
return this.feedbackProvider.getFeedbackById(this.courseId, this.feedbackId).then((feedback) => {
this.feedback = feedback;
return this.feedbackProvider.getItems(this.feedbackId);
}).then((items) => {
// Add responses and format items.
this.items = items.items.map((item) => {
if (item.typ == 'label') {
@ -67,7 +75,6 @@ export class AddonModFeedbackAttemptPage {
for (const x in this.attempt.responses) {
if (this.attempt.responses[x].id == item.id) {
item.submittedValue = this.attempt.responses[x].printval;
delete this.attempt.responses[x];
break;
}
}

View File

@ -16,7 +16,7 @@
<ion-item-divider *ngIf="item.typ == 'pagebreak'" color="light"></ion-item-divider>
<ion-item text-wrap *ngIf="item.typ != 'pagebreak'" [color]="item.dependitem > 0 ? 'light' : ''" [class.core-danger-item]="item.isEmpty || item.hasError">
<ion-label *ngIf="item.name" [core-mark-required]="item.required" stacked>
<span *ngIf="item.itemnumber">{{item.itemnumber}}. </span>
<span *ngIf="feedback.autonumbering && item.itemnumber">{{item.itemnumber}}. </span>
<core-format-text [component]="component" [componentId]="componentId" [text]="item.name"></core-format-text>
</ion-label>
<div item-content class="addon-mod_feedback-form-content" *ngIf="item.template">

View File

@ -38,7 +38,7 @@
<ion-item-divider color="light">
{{ 'addon.mod_feedback.anonymous_entries' |translate : {$a: anonResponses.total } }}
</ion-item-divider>
<a *ngFor="let attempt of anonResponses.attempts" ion-item text-wrap (click)="gotoAttempt(attempt)">
<a *ngFor="let attempt of anonResponses.attempts" ion-item text-wrap (click)="gotoAttempt(attempt)" [class.core-split-item-selected]="attempt.id == attemptId">
<h2>{{ 'addon.mod_feedback.response_nr' |translate }}: {{attempt.number}}</h2>
</a>
<ion-item padding text-center *ngIf="anonResponses.canLoadMore">

View File

@ -165,7 +165,8 @@ export class AddonModFeedbackRespondentsPage {
attemptId: attempt.id,
attempt: attempt,
feedbackId: this.feedbackId,
moduleId: this.moduleId
moduleId: this.moduleId,
courseId: this.courseId
});
}

View File

@ -70,7 +70,8 @@ export class AddonModFeedbackShowEntriesLinkHandler extends CoreContentLinksHand
moduleId: module.id,
attempt: attempt,
attemptId: attempt.id,
feedbackId: module.instance
feedbackId: module.instance,
courseId: module.course
};
return this.linkHelper.goInSite(navCtrl, 'AddonModFeedbackAttemptPage', stateParams, siteId);