From c2c606b629164f2c1ca99b0f37df9ff82f839f22 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Fri, 3 Aug 2018 08:08:22 +0200 Subject: [PATCH] MOBILE-2503 feedback: Don't show question numbers if no autonumber --- src/addon/mod/feedback/pages/attempt/attempt.html | 2 +- src/addon/mod/feedback/pages/attempt/attempt.ts | 10 +++++++++- src/addon/mod/feedback/pages/form/form.html | 2 +- .../mod/feedback/pages/respondents/respondents.ts | 3 ++- .../feedback/providers/show-entries-link-handler.ts | 3 ++- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/addon/mod/feedback/pages/attempt/attempt.html b/src/addon/mod/feedback/pages/attempt/attempt.html index 9ef944676..7fbaa7ea5 100644 --- a/src/addon/mod/feedback/pages/attempt/attempt.html +++ b/src/addon/mod/feedback/pages/attempt/attempt.html @@ -23,7 +23,7 @@

- {{item.itemnumber}}. + {{item.itemnumber}}.

diff --git a/src/addon/mod/feedback/pages/attempt/attempt.ts b/src/addon/mod/feedback/pages/attempt/attempt.ts index f53f04ead..7a1f0c035 100644 --- a/src/addon/mod/feedback/pages/attempt/attempt.ts +++ b/src/addon/mod/feedback/pages/attempt/attempt.ts @@ -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} Promise resolved when done. */ fetchData(): Promise { - 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') { diff --git a/src/addon/mod/feedback/pages/form/form.html b/src/addon/mod/feedback/pages/form/form.html index 3f337b2be..3d29e01bf 100644 --- a/src/addon/mod/feedback/pages/form/form.html +++ b/src/addon/mod/feedback/pages/form/form.html @@ -16,7 +16,7 @@ - {{item.itemnumber}}. + {{item.itemnumber}}.
diff --git a/src/addon/mod/feedback/pages/respondents/respondents.ts b/src/addon/mod/feedback/pages/respondents/respondents.ts index 2f3fb82b0..e5d555231 100644 --- a/src/addon/mod/feedback/pages/respondents/respondents.ts +++ b/src/addon/mod/feedback/pages/respondents/respondents.ts @@ -165,7 +165,8 @@ export class AddonModFeedbackRespondentsPage { attemptId: attempt.id, attempt: attempt, feedbackId: this.feedbackId, - moduleId: this.moduleId + moduleId: this.moduleId, + courseId: this.courseId }); } diff --git a/src/addon/mod/feedback/providers/show-entries-link-handler.ts b/src/addon/mod/feedback/providers/show-entries-link-handler.ts index f640c9163..fd32a42fe 100644 --- a/src/addon/mod/feedback/providers/show-entries-link-handler.ts +++ b/src/addon/mod/feedback/providers/show-entries-link-handler.ts @@ -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);