From c2c606b629164f2c1ca99b0f37df9ff82f839f22 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Fri, 3 Aug 2018 08:08:22 +0200 Subject: [PATCH 1/3] 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); From f211cfa2b2aa49e30f77ea857908b2f2c6db8723 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Fri, 3 Aug 2018 08:09:30 +0200 Subject: [PATCH 2/3] MOBILE-2503 feedback: Fix answers hidden in tablet when viewing twice --- src/addon/mod/feedback/pages/attempt/attempt.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/addon/mod/feedback/pages/attempt/attempt.ts b/src/addon/mod/feedback/pages/attempt/attempt.ts index 7a1f0c035..3ec17f95e 100644 --- a/src/addon/mod/feedback/pages/attempt/attempt.ts +++ b/src/addon/mod/feedback/pages/attempt/attempt.ts @@ -75,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; } } From 86a79298630223059681d698788bdd4def3107c7 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Fri, 3 Aug 2018 08:48:27 +0200 Subject: [PATCH 3/3] MOBILE-2503 feedback: Mark selected in split view in anonymous mode --- src/addon/mod/feedback/pages/respondents/respondents.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/addon/mod/feedback/pages/respondents/respondents.html b/src/addon/mod/feedback/pages/respondents/respondents.html index c6f493444..189d1e90e 100644 --- a/src/addon/mod/feedback/pages/respondents/respondents.html +++ b/src/addon/mod/feedback/pages/respondents/respondents.html @@ -38,7 +38,7 @@ {{ 'addon.mod_feedback.anonymous_entries' |translate : {$a: anonResponses.total } }} - +

{{ 'addon.mod_feedback.response_nr' |translate }}: {{attempt.number}}