diff --git a/src/addons/mod/assign/feedback/comments/services/handler.ts b/src/addons/mod/assign/feedback/comments/services/handler.ts index 803865630..6bb08860b 100644 --- a/src/addons/mod/assign/feedback/comments/services/handler.ts +++ b/src/addons/mod/assign/feedback/comments/services/handler.ts @@ -60,11 +60,7 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss } /** - * Discard the draft data of the feedback plugin. - * - * @param assignId The assignment ID. - * @param userId User ID. - * @param siteId Site ID. If not defined, current site. + * @inheritdoc */ discardDraft(assignId: number, userId: number, siteId?: string): void { const id = this.getDraftId(assignId, userId, siteId); @@ -74,22 +70,14 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss } /** - * Return the Component to use to display the plugin data. - * It's recommended to return the class of the component, but you can also return an instance of the component. - * - * @returns The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ getComponent(): Type { return AddonModAssignFeedbackCommentsComponent; } /** - * Return the draft saved data of the feedback plugin. - * - * @param assignId The assignment ID. - * @param userId User ID. - * @param siteId Site ID. If not defined, current site. - * @returns Data (or promise resolved with the data). + * @inheritdoc */ getDraft(assignId: number, userId: number, siteId?: string): AddonModAssignFeedbackCommentsDraftData | undefined { const id = this.getDraftId(assignId, userId, siteId); @@ -114,13 +102,7 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss } /** - * Get files used by this plugin. - * The files returned by this function will be prefetched when the user prefetches the assign. - * - * @param assign The assignment. - * @param submission The submission. - * @param plugin The plugin object. - * @returns The files (or promise resolved with the files). + * @inheritdoc */ getPluginFiles( assign: AddonModAssignAssign, @@ -131,14 +113,7 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss } /** - * Check if the feedback data has changed for this plugin. - * - * @param assign The assignment. - * @param submission The submission. - * @param plugin The plugin object. - * @param inputData Data entered by the user for the feedback. - * @param userId User ID of the submission. - * @returns Boolean (or promise resolved with boolean): whether the data has changed. + * @inheritdoc */ async hasDataChanged( assign: AddonModAssignAssign, @@ -172,12 +147,7 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss } /** - * Check whether the plugin has draft data stored. - * - * @param assignId The assignment ID. - * @param userId User ID. - * @param siteId Site ID. If not defined, current site. - * @returns Boolean or promise resolved with boolean: whether the plugin has draft data. + * @inheritdoc */ hasDraftData(assignId: number, userId: number, siteId?: string): boolean | Promise { const draft = this.getDraft(assignId, userId, siteId); @@ -186,9 +156,7 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss } /** - * Whether or not the handler is enabled on a site level. - * - * @returns True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { // In here we should check if comments is not disabled in site. @@ -198,13 +166,7 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss } /** - * Prepare and add to pluginData the data to send to the server based on the draft data saved. - * - * @param assignId The assignment ID. - * @param userId User ID. - * @param plugin The plugin object. - * @param pluginData Object where to store the data to send. - * @param siteId Site ID. If not defined, current site. + * @inheritdoc */ prepareFeedbackData( assignId: number, @@ -225,13 +187,7 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss } /** - * Save draft data of the feedback plugin. - * - * @param assignId The assignment ID. - * @param userId User ID. - * @param plugin The plugin object. - * @param data The data to save. - * @param siteId Site ID. If not defined, current site. + * @inheritdoc */ saveDraft( assignId: number, diff --git a/src/addons/mod/assign/feedback/editpdf/services/handler.ts b/src/addons/mod/assign/feedback/editpdf/services/handler.ts index 17d871a96..c40c2e36b 100644 --- a/src/addons/mod/assign/feedback/editpdf/services/handler.ts +++ b/src/addons/mod/assign/feedback/editpdf/services/handler.ts @@ -35,23 +35,14 @@ export class AddonModAssignFeedbackEditPdfHandlerService implements AddonModAssi type = 'editpdf'; /** - * Return the Component to use to display the plugin data. - * It's recommended to return the class of the component, but you can also return an instance of the component. - * - * @returns The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ getComponent(): Type { return AddonModAssignFeedbackEditPdfComponent; } /** - * Get files used by this plugin. - * The files returned by this function will be prefetched when the user prefetches the assign. - * - * @param assign The assignment. - * @param submission The submission. - * @param plugin The plugin object. - * @returns The files (or promise resolved with the files). + * @inheritdoc */ getPluginFiles( assign: AddonModAssignAssign, @@ -62,9 +53,7 @@ export class AddonModAssignFeedbackEditPdfHandlerService implements AddonModAssi } /** - * Whether or not the handler is enabled on a site level. - * - * @returns True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; diff --git a/src/addons/mod/assign/feedback/file/services/handler.ts b/src/addons/mod/assign/feedback/file/services/handler.ts index 3fac9b626..dad819815 100644 --- a/src/addons/mod/assign/feedback/file/services/handler.ts +++ b/src/addons/mod/assign/feedback/file/services/handler.ts @@ -35,23 +35,14 @@ export class AddonModAssignFeedbackFileHandlerService implements AddonModAssignF type = 'file'; /** - * Return the Component to use to display the plugin data. - * It's recommended to return the class of the component, but you can also return an instance of the component. - * - * @returns The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ getComponent(): Type { return AddonModAssignFeedbackFileComponent; } /** - * Get files used by this plugin. - * The files returned by this function will be prefetched when the user prefetches the assign. - * - * @param assign The assignment. - * @param submission The submission. - * @param plugin The plugin object. - * @returns The files (or promise resolved with the files). + * @inheritdoc */ getPluginFiles( assign: AddonModAssignAssign, @@ -62,9 +53,7 @@ export class AddonModAssignFeedbackFileHandlerService implements AddonModAssignF } /** - * Whether or not the handler is enabled on a site level. - * - * @returns True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; diff --git a/src/addons/mod/assign/services/handlers/default-feedback.ts b/src/addons/mod/assign/services/handlers/default-feedback.ts index 0de9e391a..d72d41ca0 100644 --- a/src/addons/mod/assign/services/handlers/default-feedback.ts +++ b/src/addons/mod/assign/services/handlers/default-feedback.ts @@ -15,8 +15,9 @@ import { Injectable } from '@angular/core'; import { CoreWSFile } from '@services/ws'; import { Translate } from '@singletons'; -import { AddonModAssignPlugin } from '../assign'; +import { AddonModAssignAssign, AddonModAssignPlugin, AddonModAssignSavePluginData, AddonModAssignSubmission } from '../assign'; import { AddonModAssignFeedbackHandler } from '../feedback-delegate'; +import { CoreFormFields } from '@singletons/form'; /** * Default handler used when a feedback plugin doesn't have a specific implementation. @@ -30,14 +31,19 @@ export class AddonModAssignDefaultFeedbackHandler implements AddonModAssignFeedb /** * @inheritdoc */ - discardDraft(): void { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + discardDraft(assignId: number, userId: number, siteId?: string): void | Promise { // Nothing to do. } /** * @inheritdoc */ - getDraft(): undefined { + getDraft( + assignId: number, // eslint-disable-line @typescript-eslint/no-unused-vars + userId: number, // eslint-disable-line @typescript-eslint/no-unused-vars + siteId?: string, // eslint-disable-line @typescript-eslint/no-unused-vars + ): CoreFormFields | Promise | undefined { // Nothing to do. return; } @@ -45,7 +51,12 @@ export class AddonModAssignDefaultFeedbackHandler implements AddonModAssignFeedb /** * @inheritdoc */ - getPluginFiles(): CoreWSFile[] { + getPluginFiles( + assign: AddonModAssignAssign, // eslint-disable-line @typescript-eslint/no-unused-vars + submission: AddonModAssignSubmission, // eslint-disable-line @typescript-eslint/no-unused-vars + plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars + siteId?: string, // eslint-disable-line @typescript-eslint/no-unused-vars + ): CoreWSFile[] | Promise { return []; } @@ -73,14 +84,21 @@ export class AddonModAssignDefaultFeedbackHandler implements AddonModAssignFeedb /** * @inheritdoc */ - hasDataChanged(): boolean { + async hasDataChanged( + assign: AddonModAssignAssign, // eslint-disable-line @typescript-eslint/no-unused-vars + submission: AddonModAssignSubmission, // eslint-disable-line @typescript-eslint/no-unused-vars + plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars + inputData: CoreFormFields, // eslint-disable-line @typescript-eslint/no-unused-vars + userId: number, // eslint-disable-line @typescript-eslint/no-unused-vars + ): Promise { return false; } /** * @inheritdoc */ - hasDraftData(): boolean { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + hasDraftData(assignId: number, userId: number, siteId?: string): boolean | Promise { return false; } @@ -94,21 +112,38 @@ export class AddonModAssignDefaultFeedbackHandler implements AddonModAssignFeedb /** * @inheritdoc */ - async prefetch(): Promise { + async prefetch( + assign: AddonModAssignAssign, // eslint-disable-line @typescript-eslint/no-unused-vars + submission: AddonModAssignSubmission, // eslint-disable-line @typescript-eslint/no-unused-vars + plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars + siteId?: string, // eslint-disable-line @typescript-eslint/no-unused-vars + ): Promise { return; } /** * @inheritdoc */ - prepareFeedbackData(): void { + prepareFeedbackData( + assignId: number, // eslint-disable-line @typescript-eslint/no-unused-vars + userId: number, // eslint-disable-line @typescript-eslint/no-unused-vars + plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars + pluginData: AddonModAssignSavePluginData, // eslint-disable-line @typescript-eslint/no-unused-vars + siteId?: string, // eslint-disable-line @typescript-eslint/no-unused-vars + ): void | Promise { // Nothing to do. } /** * @inheritdoc */ - saveDraft(): void { + saveDraft( + assignId: number, // eslint-disable-line @typescript-eslint/no-unused-vars + userId: number, // eslint-disable-line @typescript-eslint/no-unused-vars + plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars + data: CoreFormFields, // eslint-disable-line @typescript-eslint/no-unused-vars + siteId?: string, // eslint-disable-line @typescript-eslint/no-unused-vars + ): void | Promise { // Nothing to do. } diff --git a/src/addons/mod/assign/services/handlers/default-submission.ts b/src/addons/mod/assign/services/handlers/default-submission.ts index 3ab79c0b2..e78516b57 100644 --- a/src/addons/mod/assign/services/handlers/default-submission.ts +++ b/src/addons/mod/assign/services/handlers/default-submission.ts @@ -15,8 +15,10 @@ import { Injectable } from '@angular/core'; import { CoreWSFile } from '@services/ws'; import { Translate } from '@singletons'; -import { AddonModAssignPlugin } from '../assign'; +import { AddonModAssignAssign, AddonModAssignPlugin, AddonModAssignSavePluginData, AddonModAssignSubmission } from '../assign'; import { AddonModAssignSubmissionHandler } from '../submission-delegate'; +import { CoreFormFields } from '@singletons/form'; +import { AddonModAssignSubmissionsDBRecordFormatted } from '../assign-offline'; /** * Default handler used when a submission plugin doesn't have a specific implementation. @@ -30,42 +32,71 @@ export class AddonModAssignDefaultSubmissionHandler implements AddonModAssignSub /** * @inheritdoc */ - canEditOffline(): boolean | Promise { + canEditOffline( + assign: AddonModAssignAssign, // eslint-disable-line @typescript-eslint/no-unused-vars + submission: AddonModAssignSubmission, // eslint-disable-line @typescript-eslint/no-unused-vars + plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars + ): boolean | Promise { return false; } /** * @inheritdoc */ - isEmpty(): boolean { + isEmpty( + assign: AddonModAssignAssign, // eslint-disable-line @typescript-eslint/no-unused-vars + plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars + ): boolean { return true; } /** * @inheritdoc */ - clearTmpData(): void { + clearTmpData( + assign: AddonModAssignAssign, // eslint-disable-line @typescript-eslint/no-unused-vars + submission: AddonModAssignSubmission, // eslint-disable-line @typescript-eslint/no-unused-vars + plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars + inputData: CoreFormFields, // eslint-disable-line @typescript-eslint/no-unused-vars + ): void { // Nothing to do. } /** * @inheritdoc */ - copySubmissionData(): void { + copySubmissionData( + assign: AddonModAssignAssign, // eslint-disable-line @typescript-eslint/no-unused-vars + plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars + pluginData: AddonModAssignSavePluginData, // eslint-disable-line @typescript-eslint/no-unused-vars + userId?: number, // eslint-disable-line @typescript-eslint/no-unused-vars + siteId?: string, // eslint-disable-line @typescript-eslint/no-unused-vars + ): void | Promise { // Nothing to do. } /** * @inheritdoc */ - deleteOfflineData(): void { + deleteOfflineData( + assign: AddonModAssignAssign, // eslint-disable-line @typescript-eslint/no-unused-vars + submission: AddonModAssignSubmission, // eslint-disable-line @typescript-eslint/no-unused-vars + plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars + offlineData: AddonModAssignSubmissionsDBRecordFormatted, // eslint-disable-line @typescript-eslint/no-unused-vars + siteId?: string, // eslint-disable-line @typescript-eslint/no-unused-vars + ): void | Promise { // Nothing to do. } /** * @inheritdoc */ - getPluginFiles(): CoreWSFile[] { + getPluginFiles( + assign: AddonModAssignAssign, // eslint-disable-line @typescript-eslint/no-unused-vars + submission: AddonModAssignSubmission, // eslint-disable-line @typescript-eslint/no-unused-vars + plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars + siteId?: string, // eslint-disable-line @typescript-eslint/no-unused-vars + ): CoreWSFile[] | Promise { return []; } @@ -93,21 +124,34 @@ export class AddonModAssignDefaultSubmissionHandler implements AddonModAssignSub /** * @inheritdoc */ - getSizeForCopy(): number { + getSizeForCopy( + assign: AddonModAssignAssign, // eslint-disable-line @typescript-eslint/no-unused-vars + plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars + ): number | Promise { return 0; } /** * @inheritdoc */ - getSizeForEdit(): number { + getSizeForEdit( + assign: AddonModAssignAssign, // eslint-disable-line @typescript-eslint/no-unused-vars + submission: AddonModAssignSubmission, // eslint-disable-line @typescript-eslint/no-unused-vars + plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars + inputData: CoreFormFields, // eslint-disable-line @typescript-eslint/no-unused-vars + ): number | Promise { return 0; } /** * @inheritdoc */ - hasDataChanged(): boolean { + async hasDataChanged( + assign: AddonModAssignAssign, // eslint-disable-line @typescript-eslint/no-unused-vars + submission: AddonModAssignSubmission, // eslint-disable-line @typescript-eslint/no-unused-vars + plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars + inputData: CoreFormFields, // eslint-disable-line @typescript-eslint/no-unused-vars + ): Promise { return false; } @@ -121,28 +165,49 @@ export class AddonModAssignDefaultSubmissionHandler implements AddonModAssignSub /** * @inheritdoc */ - isEnabledForEdit(): boolean { + isEnabledForEdit(): boolean | Promise { return false; } /** * @inheritdoc */ - async prefetch(): Promise { + async prefetch( + assign: AddonModAssignAssign, // eslint-disable-line @typescript-eslint/no-unused-vars + submission: AddonModAssignSubmission, // eslint-disable-line @typescript-eslint/no-unused-vars + plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars + siteId?: string, // eslint-disable-line @typescript-eslint/no-unused-vars + ): Promise { return; } /** * @inheritdoc */ - prepareSubmissionData(): void { + prepareSubmissionData( + assign: AddonModAssignAssign, // eslint-disable-line @typescript-eslint/no-unused-vars + submission: AddonModAssignSubmission, // eslint-disable-line @typescript-eslint/no-unused-vars + plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars + inputData: CoreFormFields, // eslint-disable-line @typescript-eslint/no-unused-vars + pluginData: AddonModAssignSavePluginData, // eslint-disable-line @typescript-eslint/no-unused-vars + offline?: boolean, // eslint-disable-line @typescript-eslint/no-unused-vars + userId?: number, // eslint-disable-line @typescript-eslint/no-unused-vars + siteId?: string, // eslint-disable-line @typescript-eslint/no-unused-vars + ): void | Promise { // Nothing to do. } /** * @inheritdoc */ - prepareSyncData(): void { + prepareSyncData( + assign: AddonModAssignAssign, // eslint-disable-line @typescript-eslint/no-unused-vars + submission: AddonModAssignSubmission, // eslint-disable-line @typescript-eslint/no-unused-vars + plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars + offlineData: AddonModAssignSubmissionsDBRecordFormatted, // eslint-disable-line @typescript-eslint/no-unused-vars + pluginData: AddonModAssignSavePluginData, // eslint-disable-line @typescript-eslint/no-unused-vars + siteId?: string, // eslint-disable-line @typescript-eslint/no-unused-vars + ): void | Promise { // Nothing to do. } diff --git a/src/addons/mod/assign/services/submission-delegate.ts b/src/addons/mod/assign/services/submission-delegate.ts index 5aaf1a76a..5f4d39e7e 100644 --- a/src/addons/mod/assign/services/submission-delegate.ts +++ b/src/addons/mod/assign/services/submission-delegate.ts @@ -194,7 +194,7 @@ export interface AddonModAssignSubmissionHandler extends CoreDelegateHandler { submission: AddonModAssignSubmission, plugin: AddonModAssignPlugin, inputData: CoreFormFields, - ): boolean | Promise; + ): Promise; /** * Whether or not the handler is enabled for edit on a site level. diff --git a/src/addons/mod/assign/submission/comments/services/handler.ts b/src/addons/mod/assign/submission/comments/services/handler.ts index e2f05162d..3bb5a0162 100644 --- a/src/addons/mod/assign/submission/comments/services/handler.ts +++ b/src/addons/mod/assign/submission/comments/services/handler.ts @@ -30,11 +30,7 @@ export class AddonModAssignSubmissionCommentsHandlerService implements AddonModA type = 'comments'; /** - * Whether the plugin can be edited in offline for existing submissions. In general, this should return false if the - * plugin uses Moodle filters. The reason is that the app only prefetches filtered data, and the user should edit - * unfiltered data. - * - * @returns Boolean or promise resolved with boolean: whether it can be edited in offline. + * @inheritdoc */ canEditOffline(): boolean { // This plugin is read only, but return true to prevent blocking the edition. @@ -42,44 +38,28 @@ export class AddonModAssignSubmissionCommentsHandlerService implements AddonModA } /** - * Return the Component to use to display the plugin data, either in read or in edit mode. - * It's recommended to return the class of the component, but you can also return an instance of the component. - * - * @param plugin The plugin object. - * @param edit Whether the user is editing. - * @returns The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ getComponent(plugin: AddonModAssignPlugin, edit = false): Type | undefined { return edit ? undefined : AddonModAssignSubmissionCommentsComponent; } /** - * Whether or not the handler is enabled on a site level. - * - * @returns True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; } /** - * Whether or not the handler is enabled for edit on a site level. - * - * @returns Whether or not the handler is enabled for edit on a site level. + * @inheritdoc */ isEnabledForEdit(): boolean{ return true; } /** - * Prefetch any required data for the plugin. - * This should NOT prefetch files. Files to be prefetched should be returned by the getPluginFiles function. - * - * @param assign The assignment. - * @param submission The submission. - * @param plugin The plugin object. - * @param siteId Site ID. If not defined, current site. - * @returns Promise resolved when done. + * @inheritdoc */ async prefetch( assign: AddonModAssignAssign, diff --git a/src/addons/mod/assign/submission/file/services/handler.ts b/src/addons/mod/assign/submission/file/services/handler.ts index a919b5ac4..121f64fb5 100644 --- a/src/addons/mod/assign/submission/file/services/handler.ts +++ b/src/addons/mod/assign/submission/file/services/handler.ts @@ -45,11 +45,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig type = 'file'; /** - * Whether the plugin can be edited in offline for existing submissions. In general, this should return false if the - * plugin uses Moodle filters. The reason is that the app only prefetches filtered data, and the user should edit - * unfiltered data. - * - * @returns Boolean or promise resolved with boolean: whether it can be edited in offline. + * @inheritdoc */ canEditOffline(): boolean { // This plugin doesn't use Moodle filters, it can be edited in offline. @@ -57,11 +53,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig } /** - * Check if a plugin has no data. - * - * @param assign The assignment. - * @param plugin The plugin object. - * @returns Whether the plugin is empty. + * @inheritdoc */ isEmpty(assign: AddonModAssignAssign, plugin: AddonModAssignPlugin): boolean { const files = AddonModAssign.getSubmissionPluginAttachments(plugin); @@ -70,9 +62,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig } /** - * Should clear temporary data for a cancelled submission. - * - * @param assign The assignment. + * @inheritdoc */ clearTmpData(assign: AddonModAssignAssign): void { const files = CoreFileSession.getFiles(AddonModAssignProvider.COMPONENT, assign.id); @@ -85,13 +75,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig } /** - * This function will be called when the user wants to create a new submission based on the previous one. - * It should add to pluginData the data to send to server based in the data in plugin (previous attempt). - * - * @param assign The assignment. - * @param plugin The plugin object. - * @param pluginData Object where to store the data to send. - * @returns If the function is async, it should return a Promise resolved when done. + * @inheritdoc */ async copySubmissionData( assign: AddonModAssignAssign, @@ -106,24 +90,14 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig } /** - * Return the Component to use to display the plugin data, either in read or in edit mode. - * It's recommended to return the class of the component, but you can also return an instance of the component. - * - * @returns The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ getComponent(): Type { return AddonModAssignSubmissionFileComponent; } /** - * Delete any stored data for the plugin and submission. - * - * @param assign The assignment. - * @param submission The submission. - * @param plugin The plugin object. - * @param offlineData Offline data stored. - * @param siteId Site ID. If not defined, current site. - * @returns If the function is async, it should return a Promise resolved when done. + * @inheritdoc */ async deleteOfflineData( assign: AddonModAssignAssign, @@ -144,13 +118,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig } /** - * Get files used by this plugin. - * The files returned by this function will be prefetched when the user prefetches the assign. - * - * @param assign The assignment. - * @param submission The submission. - * @param plugin The plugin object. - * @returns The files (or promise resolved with the files). + * @inheritdoc */ getPluginFiles( assign: AddonModAssignAssign, @@ -161,11 +129,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig } /** - * Get the size of data (in bytes) this plugin will send to copy a previous submission. - * - * @param assign The assignment. - * @param plugin The plugin object. - * @returns The size (or promise resolved with size). + * @inheritdoc */ async getSizeForCopy(assign: AddonModAssignAssign, plugin: AddonModAssignPlugin): Promise { const files = AddonModAssign.getSubmissionPluginAttachments(plugin); @@ -174,12 +138,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig } /** - * Get the size of data (in bytes) this plugin will send to add or edit a submission. - * - * @param assign The assignment. - * @param submission The submission. - * @param plugin The plugin object. - * @returns The size (or promise resolved with size). + * @inheritdoc */ async getSizeForEdit( assign: AddonModAssignAssign, @@ -199,12 +158,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig } /** - * Check if the submission data has changed for this plugin. - * - * @param assign The assignment. - * @param submission The submission. - * @param plugin The plugin object. - * @returns Boolean (or promise resolved with boolean): whether the data has changed. + * @inheritdoc */ async hasDataChanged( assign: AddonModAssignAssign, @@ -243,35 +197,21 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig } /** - * Whether or not the handler is enabled on a site level. - * - * @returns True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; } /** - * Whether or not the handler is enabled for edit on a site level. - * - * @returns Whether or not the handler is enabled for edit on a site level. + * @inheritdoc */ isEnabledForEdit(): boolean { return true; } /** - * Prepare and add to pluginData the data to send to the server based on the input data. - * - * @param assign The assignment. - * @param submission The submission. - * @param plugin The plugin object. - * @param inputData Data entered by the user for the submission. - * @param pluginData Object where to store the data to send. - * @param offline Whether the user is editing in offline. - * @param userId User ID. If not defined, site's current user. - * @param siteId Site ID. If not defined, current site. - * @returns If the function is async, it should return a Promise resolved when done. + * @inheritdoc */ async prepareSubmissionData( assign: AddonModAssignAssign, @@ -308,16 +248,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig } /** - * Prepare and add to pluginData the data to send to the server based on the offline data stored. - * This will be used when performing a synchronization. - * - * @param assign The assignment. - * @param submission The submission. - * @param plugin The plugin object. - * @param offlineData Offline data stored. - * @param pluginData Object where to store the data to send. - * @param siteId Site ID. If not defined, current site. - * @returns If the function is async, it should return a Promise resolved when done. + * @inheritdoc */ async prepareSyncData( assign: AddonModAssignAssign, diff --git a/src/addons/mod/assign/submission/onlinetext/services/handler.ts b/src/addons/mod/assign/submission/onlinetext/services/handler.ts index e0f0a93a5..8ae7b7f78 100644 --- a/src/addons/mod/assign/submission/onlinetext/services/handler.ts +++ b/src/addons/mod/assign/submission/onlinetext/services/handler.ts @@ -41,11 +41,7 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo type = 'onlinetext'; /** - * Whether the plugin can be edited in offline for existing submissions. In general, this should return false if the - * plugin uses Moodle filters. The reason is that the app only prefetches filtered data, and the user should edit - * unfiltered data. - * - * @returns Boolean or promise resolved with boolean: whether it can be edited in offline. + * @inheritdoc */ canEditOffline(): boolean { // This plugin uses Moodle filters, it cannot be edited in offline. @@ -53,11 +49,7 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo } /** - * Check if a plugin has no data. - * - * @param assign The assignment. - * @param plugin The plugin object. - * @returns Whether the plugin is empty. + * @inheritdoc */ isEmpty(assign: AddonModAssignAssign, plugin: AddonModAssignPlugin): boolean { const text = AddonModAssign.getSubmissionPluginText(plugin, true); @@ -67,15 +59,7 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo } /** - * This function will be called when the user wants to create a new submission based on the previous one. - * It should add to pluginData the data to send to server based in the data in plugin (previous attempt). - * - * @param assign The assignment. - * @param plugin The plugin object. - * @param pluginData Object where to store the data to send. - * @param userId User ID. If not defined, site's current user. - * @param siteId Site ID. If not defined, current site. - * @returns If the function is async, it should return a Promise resolved when done. + * @inheritdoc */ async copySubmissionData( assign: AddonModAssignAssign, @@ -102,23 +86,14 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo } /** - * Return the Component to use to display the plugin data, either in read or in edit mode. - * It's recommended to return the class of the component, but you can also return an instance of the component. - * - * @returns The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ getComponent(): Type { return AddonModAssignSubmissionOnlineTextComponent; } /** - * Get files used by this plugin. - * The files returned by this function will be prefetched when the user prefetches the assign. - * - * @param assign The assignment. - * @param submission The submission. - * @param plugin The plugin object. - * @returns The files (or promise resolved with the files). + * @inheritdoc */ getPluginFiles( assign: AddonModAssignAssign, @@ -129,11 +104,7 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo } /** - * Get the size of data (in bytes) this plugin will send to copy a previous submission. - * - * @param assign The assignment. - * @param plugin The plugin object. - * @returns The size (or promise resolved with size). + * @inheritdoc */ async getSizeForCopy(assign: AddonModAssignAssign, plugin: AddonModAssignPlugin): Promise { const text = AddonModAssign.getSubmissionPluginText(plugin, true); @@ -145,12 +116,7 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo } /** - * Get the size of data (in bytes) this plugin will send to add or edit a submission. - * - * @param assign The assignment. - * @param submission The submission. - * @param plugin The plugin object. - * @returns The size (or promise resolved with size). + * @inheritdoc */ getSizeForEdit( assign: AddonModAssignAssign, @@ -177,13 +143,7 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo } /** - * Check if the submission data has changed for this plugin. - * - * @param assign The assignment. - * @param submission The submission. - * @param plugin The plugin object. - * @param inputData Data entered by the user for the submission. - * @returns Boolean (or promise resolved with boolean): whether the data has changed. + * @inheritdoc */ async hasDataChanged( assign: AddonModAssignAssign, @@ -209,31 +169,21 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo } /** - * Whether or not the handler is enabled on a site level. - * - * @returns True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; } /** - * Whether or not the handler is enabled for edit on a site level. - * - * @returns Whether or not the handler is enabled for edit on a site level. + * @inheritdoc */ isEnabledForEdit(): boolean { return true; } /** - * Prepare and add to pluginData the data to send to the server based on the input data. - * - * @param assign The assignment. - * @param submission The submission. - * @param plugin The plugin object. - * @param inputData Data entered by the user for the submission. - * @param pluginData Object where to store the data to send. + * @inheritdoc */ prepareSubmissionData( assign: AddonModAssignAssign, @@ -269,14 +219,7 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo } /** - * Prepare and add to pluginData the data to send to the server based on the offline data stored. - * This will be used when performing a synchronization. - * - * @param assign The assignment. - * @param submission The submission. - * @param plugin The plugin object. - * @param offlineData Offline data stored. - * @param pluginData Object where to store the data to send. + * @inheritdoc */ prepareSyncData( assign: AddonModAssignAssign,