diff --git a/src/addon/mod/feedback/pages/form/form.html b/src/addon/mod/feedback/pages/form/form.html index 591b17a1d..722813335 100644 --- a/src/addon/mod/feedback/pages/form/form.html +++ b/src/addon/mod/feedback/pages/form/form.html @@ -29,7 +29,7 @@ -

{{ 'addon.mod_feedback.numberoutofrange' |translate }} [{{item.rangefrom}}, {{item.rangeto}}]

+

{{ 'addon.mod_feedback.numberoutofrange' | translate }} [{{item.rangefrom}}, {{item.rangeto}}]

@@ -111,7 +111,5 @@ - - diff --git a/src/addon/mod/feedback/pages/form/form.module.ts b/src/addon/mod/feedback/pages/form/form.module.ts index 854f15034..c71c52917 100644 --- a/src/addon/mod/feedback/pages/form/form.module.ts +++ b/src/addon/mod/feedback/pages/form/form.module.ts @@ -17,7 +17,6 @@ import { IonicPageModule } from 'ionic-angular'; import { TranslateModule } from '@ngx-translate/core'; import { CoreDirectivesModule } from '@directives/directives.module'; import { CoreComponentsModule } from '@components/components.module'; -import { CorePipesModule } from '@pipes/pipes.module'; import { AddonModFeedbackComponentsModule } from '../../components/components.module'; import { AddonModFeedbackFormPage } from './form'; @@ -28,7 +27,6 @@ import { AddonModFeedbackFormPage } from './form'; imports: [ CoreDirectivesModule, CoreComponentsModule, - CorePipesModule, AddonModFeedbackComponentsModule, IonicPageModule.forChild(AddonModFeedbackFormPage), TranslateModule.forChild() diff --git a/src/addon/mod/feedback/providers/feedback.ts b/src/addon/mod/feedback/providers/feedback.ts index 3b5fa4291..c28d69193 100644 --- a/src/addon/mod/feedback/providers/feedback.ts +++ b/src/addon/mod/feedback/providers/feedback.ts @@ -77,7 +77,7 @@ export class AddonModFeedbackProvider { * * @param {any} item Item to check. * @param {string} dependValue Value to compare. - * @return {boolean} eturn true if dependency is acomplished and it can be shown. False, otherwise. + * @return {boolean} Return true if dependency is acomplished and it can be shown. False, otherwise. */ protected compareDependItemMultichoice(item: any, dependValue: string): boolean { let values, choices; @@ -772,11 +772,11 @@ export class AddonModFeedbackProvider { /** * Convenience function to get the page we can jump. * - * @param {number} feedbackId [description] - * @param {number} page [description] - * @param {number} changePage [description] - * @param {string} siteId [description] - * @return {Promise} [description] + * @param {number} feedbackId Feedback ID. + * @param {number} page Page where we want to jump. + * @param {number} changePage If page change is forward (1) or backward (-1). + * @param {string} siteId Site ID. + * @return {Promise} Page number where to jump. Or false if completed or first page. */ protected getPageJumpTo(feedbackId: number, page: number, changePage: number, siteId: string): Promise { return this.getPageItemsWithValues(feedbackId, page, true, false, siteId).then((resp) => { @@ -1037,9 +1037,9 @@ export class AddonModFeedbackProvider { * * @param {number} feedbackId Feedback ID. * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the info is retrieved. + * @return {Promise} Promise resolved when the info is retrieved. */ - isCompleted(feedbackId: number, siteId?: string): Promise { + isCompleted(feedbackId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { const params = { feedbackid: feedbackId @@ -1092,7 +1092,7 @@ export class AddonModFeedbackProvider { * @param {boolean} formHasErrors Whether the form we sent has required but empty fields (only used in offline). * @param {number} courseId Course ID the feedback belongs to. * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the info is retrieved. + * @return {Promise} Promise resolved when the info is retrieved. */ processPage(feedbackId: number, page: number, responses: any, goPrevious: boolean, formHasErrors: boolean, courseId: number, siteId?: string): Promise { diff --git a/src/addon/mod/feedback/providers/helper.ts b/src/addon/mod/feedback/providers/helper.ts index 4453ae5c1..7f5527623 100644 --- a/src/addon/mod/feedback/providers/helper.ts +++ b/src/addon/mod/feedback/providers/helper.ts @@ -37,10 +37,11 @@ export class AddonModFeedbackHelperProvider { /** * Check if the page we are going to open is in the history and returns the number of pages in the stack to go back. * - * @param {string} pageName Name of the page we want to navigate. - * @param {number} instance Activity instance Id. I.e FeedbackId. - * @param {string} paramName Param name where to find the instance number. - * @param {string} prefix Prefix to check if we are out of the activity context. + * @param {string} pageName Name of the page we want to navigate. + * @param {number} instance Activity instance Id. I.e FeedbackId. + * @param {string} paramName Param name where to find the instance number. + * @param {string} prefix Prefix to check if we are out of the activity context. + * @param {NavController} navCtrl Nav Controller of the view. * @return {number} Returns the number of times the history needs to go back to find the specified page. */ protected getActivityHistoryBackCounter(pageName: string, instance: number, paramName: string, prefix: string, diff --git a/src/addon/mod/feedback/providers/offline.ts b/src/addon/mod/feedback/providers/offline.ts index a1fe0c39a..ffa69a4fd 100644 --- a/src/addon/mod/feedback/providers/offline.ts +++ b/src/addon/mod/feedback/providers/offline.ts @@ -27,7 +27,7 @@ export class AddonModFeedbackOfflineProvider { protected logger; // Variables for database. - protected FEEDBACK_TABLE = 'mma_mod_feedback_answers'; + protected FEEDBACK_TABLE = 'addon_mod_feedback_answers'; protected tablesSchema = [ { name: this.FEEDBACK_TABLE, @@ -102,7 +102,11 @@ export class AddonModFeedbackOfflineProvider { */ getFeedbackResponses(feedbackId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { - return site.getDb().getRecords(this.FEEDBACK_TABLE, {feedbackid: feedbackId}); + return site.getDb().getRecords(this.FEEDBACK_TABLE, {feedbackid: feedbackId}).then((entries) => { + return entries.map((entry) => { + entry.responses = this.textUtils.parseJSON(entry.responses); + }); + }); }); } diff --git a/src/addon/mod/feedback/providers/sync.ts b/src/addon/mod/feedback/providers/sync.ts index 143ed10a5..7653014b8 100644 --- a/src/addon/mod/feedback/providers/sync.ts +++ b/src/addon/mod/feedback/providers/sync.ts @@ -38,9 +38,9 @@ export class AddonModFeedbackSyncProvider extends CoreSyncBaseProvider { constructor(protected sitesProvider: CoreSitesProvider, protected loggerProvider: CoreLoggerProvider, protected appProvider: CoreAppProvider, private feedbackOffline: AddonModFeedbackOfflineProvider, private eventsProvider: CoreEventsProvider, private feedbackProvider: AddonModFeedbackProvider, - private translate: TranslateService, private utils: CoreUtilsProvider, protected textUtils: CoreTextUtilsProvider, + protected translate: TranslateService, private utils: CoreUtilsProvider, protected textUtils: CoreTextUtilsProvider, courseProvider: CoreCourseProvider, syncProvider: CoreSyncProvider) { - super('AddonModFeedbackSyncProvider', sitesProvider, loggerProvider, appProvider, syncProvider, textUtils); + super('AddonModFeedbackSyncProvider', loggerProvider, sitesProvider, appProvider, syncProvider, textUtils, translate); this.componentTranslate = courseProvider.translateModuleName('feedback'); } @@ -108,7 +108,7 @@ export class AddonModFeedbackSyncProvider extends CoreSyncBaseProvider { } /** - * ynchronize all offline responses of a feedback. + * Synchronize all offline responses of a feedback. * * @param {number} feedbackId Feedback ID to be synced. * @param {string} [siteId] Site ID. If not defined, current site. @@ -221,7 +221,16 @@ export class AddonModFeedbackSyncProvider extends CoreSyncBaseProvider { return this.addOngoingSync(syncId, syncPromise, siteId); } - // Convenience function to sync process page calls. + /** + * Convenience function to sync process page calls. + * + * @param {any} feedback Feedback object. + * @param {any} data Response data. + * @param {string} siteId Site Id. + * @param {number} timemodified Current completed modification time. + * @param {any} result Result object to be modified. + * @return {Promise} Resolve when done or rejected with error. + */ protected processPage(feedback: any, data: any, siteId: string, timemodified: number, result: any): Promise { // Delete all pages that are submitted before changing website. if (timemodified > data.timemodified) { diff --git a/src/addon/mod/survey/providers/sync.ts b/src/addon/mod/survey/providers/sync.ts index 9e7ae338a..d6fc54f02 100644 --- a/src/addon/mod/survey/providers/sync.ts +++ b/src/addon/mod/survey/providers/sync.ts @@ -97,9 +97,9 @@ export class AddonModSurveySyncProvider extends CoreSyncBaseProvider { /** * Sync a survey only if a certain time has passed since the last time. * - * @param {Number} surveyId Survey ID. - * @param {Number} userId User the answers belong to. - * @param {String} [siteId] Site ID. If not defined, current site. + * @param {number} surveyId Survey ID. + * @param {number} userId User the answers belong to. + * @param {string} [siteId] Site ID. If not defined, current site. * @return {Promise} Promise resolved when the survey is synced or if it doesn't need to be synced. */ syncSurveyIfNeeded(surveyId: number, userId: number, siteId?: string): Promise { diff --git a/src/components/recaptcha/recaptcha.ts b/src/components/recaptcha/recaptcha.ts index d8f2f76af..d9ccfa674 100644 --- a/src/components/recaptcha/recaptcha.ts +++ b/src/components/recaptcha/recaptcha.ts @@ -77,7 +77,7 @@ export class CoreRecaptchaComponent { } @Component({ - selector: 'core-recaptcha', + selector: 'core-recaptcha-modal', templateUrl: 'recaptchamodal.html' }) export class CoreRecaptchaModalComponent { diff --git a/src/core/user/providers/user.ts b/src/core/user/providers/user.ts index 5aeae8ec9..3464a8d0f 100644 --- a/src/core/user/providers/user.ts +++ b/src/core/user/providers/user.ts @@ -376,7 +376,7 @@ export class CoreUserProvider { * @param {string} [siteId] Site ID. If not defined, current site. * @return {Promise} Promise resolved when prefetched. */ - prefetchProfiles(userIds: number[], courseId: number, siteId?: string): Promise { + prefetchProfiles(userIds: number[], courseId?: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); const treated = {}, diff --git a/src/directives/chart.ts b/src/directives/chart.ts index c036bef72..3da2dd1ad 100644 --- a/src/directives/chart.ts +++ b/src/directives/chart.ts @@ -18,7 +18,7 @@ import { Chart } from 'chart.js'; /** * This component shows a chart using chart.js. * Documentation can be found at http://www.chartjs.org/docs/. - * It does not support changes on any input. + * It only supports changes on these properties: data and labels. * * Example usage: *