From 3f53e40d3d16f65e6e4ac1441e00baac274d739a Mon Sep 17 00:00:00 2001 From: Albert Gasset Date: Thu, 21 Jun 2018 11:15:28 +0200 Subject: [PATCH] MOBILE-2431 feedback: Fix feedback sync --- src/addon/mod/feedback/providers/offline.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/addon/mod/feedback/providers/offline.ts b/src/addon/mod/feedback/providers/offline.ts index 89c7f5e0f..d8c26f1c4 100644 --- a/src/addon/mod/feedback/providers/offline.ts +++ b/src/addon/mod/feedback/providers/offline.ts @@ -38,7 +38,7 @@ export class AddonModFeedbackOfflineProvider { }, { name: 'page', - type: 'TEXT' + type: 'INTEGER' }, { name: 'courseid', @@ -86,9 +86,11 @@ export class AddonModFeedbackOfflineProvider { getAllFeedbackResponses(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { return site.getDb().getAllRecords(AddonModFeedbackOfflineProvider.FEEDBACK_TABLE).then((entries) => { - return entries.map((entry) => { + entries.forEach((entry) => { entry.responses = this.textUtils.parseJSON(entry.responses); }); + + return entries; }); }); } @@ -104,9 +106,11 @@ export class AddonModFeedbackOfflineProvider { return this.sitesProvider.getSite(siteId).then((site) => { return site.getDb().getRecords(AddonModFeedbackOfflineProvider.FEEDBACK_TABLE, {feedbackid: feedbackId}); }).then((entries) => { - return entries.map((entry) => { + entries.forEach((entry) => { entry.responses = this.textUtils.parseJSON(entry.responses); }); + + return entries; }); }