diff --git a/src/addons/mod/workshop/components/assessment-strategy/assessment-strategy.ts b/src/addons/mod/workshop/components/assessment-strategy/assessment-strategy.ts index c3656705a..503174cf5 100644 --- a/src/addons/mod/workshop/components/assessment-strategy/assessment-strategy.ts +++ b/src/addons/mod/workshop/components/assessment-strategy/assessment-strategy.ts @@ -29,8 +29,6 @@ import { CoreEventObserver, CoreEvents } from '@singletons/events'; import { CoreFormFields, CoreForms } from '@singletons/form'; import { AddonWorkshopAssessmentStrategyDelegate } from '../../services/assessment-strategy-delegate'; import { - AddonModWorkshopProvider, - AddonModWorkshopOverallFeedbackMode, AddonModWorkshop, AddonModWorkshopData, AddonModWorkshopGetWorkshopAccessInformationWSResponse, @@ -38,7 +36,12 @@ import { } from '../../services/workshop'; import { AddonModWorkshopHelper, AddonModWorkshopSubmissionAssessmentWithFormData } from '../../services/workshop-helper'; import { AddonModWorkshopOffline } from '../../services/workshop-offline'; -import { ADDON_MOD_WORKSHOP_COMPONENT } from '@addons/mod/workshop/constants'; +import { + ADDON_MOD_WORKSHOP_ASSESSMENT_INVALIDATED, + ADDON_MOD_WORKSHOP_ASSESSMENT_SAVED, + ADDON_MOD_WORKSHOP_COMPONENT, + AddonModWorkshopOverallFeedbackMode, +} from '@addons/mod/workshop/constants'; /** * Component that displays workshop assessment strategy form. @@ -135,7 +138,7 @@ export class AddonModWorkshopAssessmentStrategyComponent implements OnInit, OnDe try { await this.load(); this.obsInvalidated = CoreEvents.on( - AddonModWorkshopProvider.ASSESSMENT_INVALIDATED, + ADDON_MOD_WORKSHOP_ASSESSMENT_INVALIDATED, () => this.load(), CoreSites.getCurrentSiteId(), ); @@ -382,7 +385,7 @@ export class AddonModWorkshopAssessmentStrategyComponent implements OnInit, OnDe await CoreUtils.ignoreErrors(Promise.all(promises)); - CoreEvents.trigger(AddonModWorkshopProvider.ASSESSMENT_SAVED, { + CoreEvents.trigger(ADDON_MOD_WORKSHOP_ASSESSMENT_SAVED, { workshopId: this.workshop.id, assessmentId: this.assessmentId, userId: CoreSites.getCurrentSiteUserId(), diff --git a/src/addons/mod/workshop/components/index/index.ts b/src/addons/mod/workshop/components/index/index.ts index 382a796c0..b86e774ea 100644 --- a/src/addons/mod/workshop/components/index/index.ts +++ b/src/addons/mod/workshop/components/index/index.ts @@ -26,8 +26,6 @@ import { CoreUtils } from '@services/utils/utils'; import { CoreEventObserver, CoreEvents } from '@singletons/events'; import { Subscription } from 'rxjs'; import { - AddonModWorkshopProvider, - AddonModWorkshopPhase, AddonModWorkshop, AddonModWorkshopData, AddonModWorkshopGetWorkshopAccessInformationWSResponse, @@ -46,13 +44,20 @@ import { } from '../../services/workshop-helper'; import { AddonModWorkshopOffline, AddonModWorkshopOfflineSubmission } from '../../services/workshop-offline'; import { - AddonModWorkshopSyncProvider, AddonModWorkshopSync, AddonModWorkshopAutoSyncData, AddonModWorkshopSyncResult, } from '../../services/workshop-sync'; import { AddonModWorkshopPhaseInfoComponent } from '../phase/phase'; -import { ADDON_MOD_WORKSHOP_COMPONENT, ADDON_MOD_WORKSHOP_PAGE_NAME } from '@addons/mod/workshop/constants'; +import { + ADDON_MOD_WORKSHOP_ASSESSMENT_SAVED, + ADDON_MOD_WORKSHOP_AUTO_SYNCED, + ADDON_MOD_WORKSHOP_COMPONENT, + ADDON_MOD_WORKSHOP_PAGE_NAME, + ADDON_MOD_WORKSHOP_PER_PAGE, + ADDON_MOD_WORKSHOP_SUBMISSION_CHANGED, + AddonModWorkshopPhase, +} from '@addons/mod/workshop/constants'; /** * Component that displays a workshop index page. @@ -101,7 +106,7 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity protected obsAssessmentSaved: CoreEventObserver; protected appResumeSubscription: Subscription; protected syncObserver?: CoreEventObserver; - protected syncEventName = AddonModWorkshopSyncProvider.AUTO_SYNCED; + protected syncEventName = ADDON_MOD_WORKSHOP_AUTO_SYNCED; constructor ( @Optional() content: IonContent, @@ -110,12 +115,12 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity super('AddonModWorkshopIndexComponent', content, courseContentsPage); // Listen to submission and assessment changes. - this.obsSubmissionChanged = CoreEvents.on(AddonModWorkshopProvider.SUBMISSION_CHANGED, (data) => { + this.obsSubmissionChanged = CoreEvents.on(ADDON_MOD_WORKSHOP_SUBMISSION_CHANGED, (data) => { this.eventReceived(data); }, this.siteId); // Listen to submission and assessment changes. - this.obsAssessmentSaved = CoreEvents.on(AddonModWorkshopProvider.ASSESSMENT_SAVED, (data) => { + this.obsAssessmentSaved = CoreEvents.on(ADDON_MOD_WORKSHOP_ASSESSMENT_SAVED, (data) => { this.eventReceived(data); }, this.siteId); @@ -125,7 +130,7 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity }); // Refresh workshop on sync. - this.syncObserver = CoreEvents.on(AddonModWorkshopSyncProvider.AUTO_SYNCED, (data) => { + this.syncObserver = CoreEvents.on(ADDON_MOD_WORKSHOP_AUTO_SYNCED, (data) => { // Update just when all database is synced. this.eventReceived(data); }, this.siteId); @@ -282,8 +287,8 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity this.page = page; - this.hasNextPage = numEntries >= AddonModWorkshopProvider.PER_PAGE && ((this.page + 1) * - AddonModWorkshopProvider.PER_PAGE) < report.totalcount; + this.hasNextPage = numEntries >= ADDON_MOD_WORKSHOP_PER_PAGE && ((this.page + 1) * + ADDON_MOD_WORKSHOP_PER_PAGE) < report.totalcount; const grades: AddonModWorkshopGradesData[] = report.grades || []; diff --git a/src/addons/mod/workshop/components/phase/phase.ts b/src/addons/mod/workshop/components/phase/phase.ts index fb0030a84..5fa88c08b 100644 --- a/src/addons/mod/workshop/components/phase/phase.ts +++ b/src/addons/mod/workshop/components/phase/phase.ts @@ -15,7 +15,8 @@ import { Component, Input, OnInit } from '@angular/core'; import { CoreUtils } from '@services/utils/utils'; import { ModalController } from '@singletons'; -import { AddonModWorkshopPhaseData, AddonModWorkshopPhase, AddonModWorkshopPhaseTaskData } from '../../services/workshop'; +import { AddonModWorkshopPhaseData, AddonModWorkshopPhaseTaskData } from '../../services/workshop'; +import { AddonModWorkshopPhase } from '../../constants'; /** * Page that displays the phase info modal. diff --git a/src/addons/mod/workshop/components/submission/submission.ts b/src/addons/mod/workshop/components/submission/submission.ts index 8d49a967c..53ae4a891 100644 --- a/src/addons/mod/workshop/components/submission/submission.ts +++ b/src/addons/mod/workshop/components/submission/submission.ts @@ -20,7 +20,6 @@ import { CoreNavigator } from '@services/navigator'; import { CoreSites } from '@services/sites'; import { AddonModWorkshopSubmissionPage } from '../../pages/submission/submission'; import { - AddonModWorkshopPhase, AddonModWorkshopData, AddonModWorkshopGetWorkshopAccessInformationWSResponse, } from '../../services/workshop'; @@ -30,7 +29,7 @@ import { AddonModWorkshopSubmissionDataWithOfflineData, } from '../../services/workshop-helper'; import { AddonModWorkshopOffline } from '../../services/workshop-offline'; -import { ADDON_MOD_WORKSHOP_COMPONENT, ADDON_MOD_WORKSHOP_PAGE_NAME } from '@addons/mod/workshop/constants'; +import { ADDON_MOD_WORKSHOP_COMPONENT, ADDON_MOD_WORKSHOP_PAGE_NAME, AddonModWorkshopPhase } from '@addons/mod/workshop/constants'; /** * Component that displays workshop submission. diff --git a/src/addons/mod/workshop/constants.ts b/src/addons/mod/workshop/constants.ts index 24ba9d6ff..e164c112f 100644 --- a/src/addons/mod/workshop/constants.ts +++ b/src/addons/mod/workshop/constants.ts @@ -14,6 +14,8 @@ export const ADDON_MOD_WORKSHOP_COMPONENT = 'mmaModWorkshop'; +export const ADDON_MOD_WORKSHOP_PER_PAGE = 10; + // Routing. export const ADDON_MOD_WORKSHOP_PAGE_NAME = 'mod_workshop'; @@ -41,3 +43,46 @@ export const ADDON_MOD_WORKSHOP_PREFETCH_UPDATE_NAMES = new RegExp( export const ADDON_MOD_WORKSHOP_SYNC_CRON_NAME = 'AddonModWorkshopSyncCronHandler'; export const ADDON_MOD_WORKSHOP_FEATURE_NAME = 'CoreCourseModuleDelegate_AddonModWorkshop'; + +// Events. +export const ADDON_MOD_WORKSHOP_SUBMISSION_CHANGED = 'addon_mod_workshop_submission_changed'; +export const ADDON_MOD_WORKSHOP_ASSESSMENT_SAVED = 'addon_mod_workshop_assessment_saved'; +export const ADDON_MOD_WORKSHOP_ASSESSMENT_INVALIDATED = 'addon_mod_workshop_assessment_invalidated'; +export const ADDON_MOD_WORKSHOP_AUTO_SYNCED = 'addon_mod_workshop_autom_synced'; + +export const enum AddonModWorkshopPhase { + PHASE_SETUP = 10, + PHASE_SUBMISSION = 20, + PHASE_ASSESSMENT = 30, + PHASE_EVALUATION = 40, + PHASE_CLOSED = 50, +} + +export const enum AddonModWorkshopSubmissionType { + SUBMISSION_TYPE_DISABLED = 0, + SUBMISSION_TYPE_AVAILABLE = 1, + SUBMISSION_TYPE_REQUIRED = 2, +} + +export const enum AddonModWorkshopExampleMode { + EXAMPLES_VOLUNTARY = 0, + EXAMPLES_BEFORE_SUBMISSION = 1, + EXAMPLES_BEFORE_ASSESSMENT = 2, +} + +export const enum AddonModWorkshopAction { + ADD = 'add', + DELETE = 'delete', + UPDATE = 'update', +} + +export const enum AddonModWorkshopAssessmentMode { + ASSESSMENT = 'assessment', + PREVIEW = 'preview', +} + +export const enum AddonModWorkshopOverallFeedbackMode { + DISABLED = 0, + ENABLED_OPTIONAL = 1, + ENABLED_REQUIRED = 2, +} diff --git a/src/addons/mod/workshop/pages/assessment/assessment.ts b/src/addons/mod/workshop/pages/assessment/assessment.ts index 61fded7ba..080ac4155 100644 --- a/src/addons/mod/workshop/pages/assessment/assessment.ts +++ b/src/addons/mod/workshop/pages/assessment/assessment.ts @@ -31,16 +31,19 @@ import { AddonModWorkshopAssessmentSavedChangedEventData, AddonModWorkshopData, AddonModWorkshopGetWorkshopAccessInformationWSResponse, - AddonModWorkshopPhase, - AddonModWorkshopProvider, AddonModWorkshopSubmissionData, } from '../../services/workshop'; import { AddonModWorkshopHelper, AddonModWorkshopSubmissionAssessmentWithFormData } from '../../services/workshop-helper'; import { AddonModWorkshopOffline } from '../../services/workshop-offline'; -import { AddonModWorkshopSyncProvider } from '../../services/workshop-sync'; import { CoreTime } from '@singletons/time'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; -import { ADDON_MOD_WORKSHOP_COMPONENT } from '@addons/mod/workshop/constants'; +import { + ADDON_MOD_WORKSHOP_ASSESSMENT_INVALIDATED, + ADDON_MOD_WORKSHOP_ASSESSMENT_SAVED, + ADDON_MOD_WORKSHOP_AUTO_SYNCED, + ADDON_MOD_WORKSHOP_COMPONENT, + AddonModWorkshopPhase, +} from '@addons/mod/workshop/constants'; /** * Page that displays a workshop assessment. @@ -107,7 +110,7 @@ export class AddonModWorkshopAssessmentPage implements OnInit, OnDestroy, CanLea this.evaluateForm.addControl('text', this.fb.control('')); // Refresh workshop on sync. - this.syncObserver = CoreEvents.on(AddonModWorkshopSyncProvider.AUTO_SYNCED, (data) => { + this.syncObserver = CoreEvents.on(ADDON_MOD_WORKSHOP_AUTO_SYNCED, (data) => { // Update just when all database is synced. if (this.workshopId === data.workshopId) { this.loaded = false; @@ -331,7 +334,7 @@ export class AddonModWorkshopAssessmentPage implements OnInit, OnDestroy, CanLea try { await Promise.all(promises); } finally { - CoreEvents.trigger(AddonModWorkshopProvider.ASSESSMENT_INVALIDATED, null, this.siteId); + CoreEvents.trigger(ADDON_MOD_WORKSHOP_ASSESSMENT_INVALIDATED, null, this.siteId); await this.fetchAssessmentData(); } @@ -396,7 +399,7 @@ export class AddonModWorkshopAssessmentPage implements OnInit, OnDestroy, CanLea }; return AddonModWorkshop.invalidateAssessmentData(this.workshopId, this.assessmentId).finally(() => { - CoreEvents.trigger(AddonModWorkshopProvider.ASSESSMENT_SAVED, data, this.siteId); + CoreEvents.trigger(ADDON_MOD_WORKSHOP_ASSESSMENT_SAVED, data, this.siteId); }); } catch (error) { CoreDomUtils.showErrorModalDefault(error, 'Cannot save assessment evaluation'); diff --git a/src/addons/mod/workshop/pages/edit-submission/edit-submission.ts b/src/addons/mod/workshop/pages/edit-submission/edit-submission.ts index 5d7b73734..26a5a40b7 100644 --- a/src/addons/mod/workshop/pages/edit-submission/edit-submission.ts +++ b/src/addons/mod/workshop/pages/edit-submission/edit-submission.ts @@ -30,18 +30,20 @@ import { Translate } from '@singletons'; import { CoreEvents } from '@singletons/events'; import { CoreForms } from '@singletons/form'; import { - AddonModWorkshopProvider, AddonModWorkshop, - AddonModWorkshopSubmissionType, AddonModWorkshopSubmissionChangedEventData, - AddonModWorkshopAction, AddonModWorkshopGetWorkshopAccessInformationWSResponse, AddonModWorkshopData, } from '../../services/workshop'; import { AddonModWorkshopHelper, AddonModWorkshopSubmissionDataWithOfflineData } from '../../services/workshop-helper'; import { AddonModWorkshopOffline } from '../../services/workshop-offline'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; -import { ADDON_MOD_WORKSHOP_COMPONENT } from '@addons/mod/workshop/constants'; +import { + ADDON_MOD_WORKSHOP_COMPONENT, + ADDON_MOD_WORKSHOP_SUBMISSION_CHANGED, + AddonModWorkshopAction, + AddonModWorkshopSubmissionType, +} from '@addons/mod/workshop/constants'; /** * Page that displays the workshop edit submission. @@ -473,7 +475,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy, Ca Promise.resolve(); await promise.finally(() => { - CoreEvents.trigger(AddonModWorkshopProvider.SUBMISSION_CHANGED, data, this.siteId); + CoreEvents.trigger(ADDON_MOD_WORKSHOP_SUBMISSION_CHANGED, data, this.siteId); // Delete the local files from the tmp folder. CoreFileUploader.clearTmpFiles(inputData.attachmentfiles); diff --git a/src/addons/mod/workshop/pages/submission/submission.ts b/src/addons/mod/workshop/pages/submission/submission.ts index 08fda91ba..ba743b49b 100644 --- a/src/addons/mod/workshop/pages/submission/submission.ts +++ b/src/addons/mod/workshop/pages/submission/submission.ts @@ -31,11 +31,8 @@ import { CoreEventObserver, CoreEvents } from '@singletons/events'; import { CoreForms } from '@singletons/form'; import { AddonModWorkshopAssessmentStrategyComponent } from '../../components/assessment-strategy/assessment-strategy'; import { - AddonModWorkshopProvider, AddonModWorkshop, - AddonModWorkshopPhase, AddonModWorkshopSubmissionChangedEventData, - AddonModWorkshopAction, AddonModWorkshopData, AddonModWorkshopGetWorkshopAccessInformationWSResponse, AddonModWorkshopAssessmentSavedChangedEventData, @@ -46,10 +43,18 @@ import { AddonModWorkshopSubmissionDataWithOfflineData, } from '../../services/workshop-helper'; import { AddonModWorkshopOffline } from '../../services/workshop-offline'; -import { AddonModWorkshopSyncProvider, AddonModWorkshopAutoSyncData } from '../../services/workshop-sync'; +import { AddonModWorkshopAutoSyncData } from '../../services/workshop-sync'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; import { CoreTime } from '@singletons/time'; -import { ADDON_MOD_WORKSHOP_COMPONENT } from '@addons/mod/workshop/constants'; +import { + ADDON_MOD_WORKSHOP_ASSESSMENT_INVALIDATED, + ADDON_MOD_WORKSHOP_ASSESSMENT_SAVED, + ADDON_MOD_WORKSHOP_AUTO_SYNCED, + ADDON_MOD_WORKSHOP_COMPONENT, + ADDON_MOD_WORKSHOP_SUBMISSION_CHANGED, + AddonModWorkshopAction, + AddonModWorkshopPhase, +} from '@addons/mod/workshop/constants'; /** * Page that displays a workshop submission. @@ -119,12 +124,12 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy, CanLea this.feedbackForm.addControl('grade', this.fb.control('')); this.feedbackForm.addControl('text', this.fb.control('')); - this.obsAssessmentSaved = CoreEvents.on(AddonModWorkshopProvider.ASSESSMENT_SAVED, (data) => { + this.obsAssessmentSaved = CoreEvents.on(ADDON_MOD_WORKSHOP_ASSESSMENT_SAVED, (data) => { this.eventReceived(data); }, this.siteId); // Refresh workshop on sync. - this.syncObserver = CoreEvents.on(AddonModWorkshopSyncProvider.AUTO_SYNCED, (data) => { + this.syncObserver = CoreEvents.on(ADDON_MOD_WORKSHOP_AUTO_SYNCED, (data) => { // Update just when all database is synced. this.eventReceived(data); }, this.siteId); @@ -447,7 +452,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy, CanLea try { await Promise.all(promises); } finally { - CoreEvents.trigger(AddonModWorkshopProvider.ASSESSMENT_INVALIDATED, null, this.siteId); + CoreEvents.trigger(ADDON_MOD_WORKSHOP_ASSESSMENT_INVALIDATED, null, this.siteId); await this.fetchSubmissionData(); @@ -535,7 +540,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy, CanLea submissionId: this.submissionId, }; - CoreEvents.trigger(AddonModWorkshopProvider.SUBMISSION_CHANGED, data, this.siteId); + CoreEvents.trigger(ADDON_MOD_WORKSHOP_SUBMISSION_CHANGED, data, this.siteId); }); } catch (message) { CoreDomUtils.showErrorModalDefault(message, 'Cannot save submission evaluation'); @@ -572,7 +577,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy, CanLea submissionId: this.submissionId, }; - CoreEvents.trigger(AddonModWorkshopProvider.SUBMISSION_CHANGED, data, this.siteId); + CoreEvents.trigger(ADDON_MOD_WORKSHOP_SUBMISSION_CHANGED, data, this.siteId); this.forceLeavePage(); } @@ -595,7 +600,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy, CanLea submissionId: this.submissionId, }; - CoreEvents.trigger(AddonModWorkshopProvider.SUBMISSION_CHANGED, data, this.siteId); + CoreEvents.trigger(ADDON_MOD_WORKSHOP_SUBMISSION_CHANGED, data, this.siteId); await this.refreshAllData(); }); diff --git a/src/addons/mod/workshop/services/database/workshop.ts b/src/addons/mod/workshop/services/database/workshop.ts index 346f168c2..b3f3ed5a4 100644 --- a/src/addons/mod/workshop/services/database/workshop.ts +++ b/src/addons/mod/workshop/services/database/workshop.ts @@ -13,7 +13,7 @@ // limitations under the License. import { CoreSiteSchema } from '@services/sites'; -import { AddonModWorkshopAction } from '../workshop'; +import { AddonModWorkshopAction } from '../../constants'; /** * Database variables for AddonModWorkshopOfflineProvider. diff --git a/src/addons/mod/workshop/services/handlers/prefetch-lazy.ts b/src/addons/mod/workshop/services/handlers/prefetch-lazy.ts index b48227563..0e69b40aa 100644 --- a/src/addons/mod/workshop/services/handlers/prefetch-lazy.ts +++ b/src/addons/mod/workshop/services/handlers/prefetch-lazy.ts @@ -25,7 +25,6 @@ import { CoreWSExternalFile, CoreWSFile } from '@services/ws'; import { makeSingleton } from '@singletons'; import { AddonModWorkshop, - AddonModWorkshopPhase, AddonModWorkshopGradesData, AddonModWorkshopData, AddonModWorkshopGetWorkshopAccessInformationWSResponse, @@ -33,6 +32,7 @@ import { import { AddonModWorkshopHelper } from '../workshop-helper'; import { AddonModWorkshopSync } from '../workshop-sync'; import { AddonModWorkshopPrefetchHandlerService } from '@addons/mod/workshop/services/handlers/prefetch'; +import { AddonModWorkshopPhase } from '../../constants'; /** * Handler to prefetch workshops. diff --git a/src/addons/mod/workshop/services/workshop-helper.ts b/src/addons/mod/workshop/services/workshop-helper.ts index 898ab0166..7dec857eb 100644 --- a/src/addons/mod/workshop/services/workshop-helper.ts +++ b/src/addons/mod/workshop/services/workshop-helper.ts @@ -26,8 +26,6 @@ import { CoreFormFields } from '@singletons/form'; import { AddonModWorkshopAssessmentStrategyFieldErrors } from '../components/assessment-strategy/assessment-strategy'; import { AddonWorkshopAssessmentStrategyDelegate } from './assessment-strategy-delegate'; import { - AddonModWorkshopExampleMode, - AddonModWorkshopPhase, AddonModWorkshopUserOptions, AddonModWorkshopData, AddonModWorkshop, @@ -36,12 +34,16 @@ import { AddonModWorkshopPhaseTaskData, AddonModWorkshopSubmissionAssessmentData, AddonModWorkshopGetAssessmentFormDefinitionData, - AddonModWorkshopAction, - AddonModWorkshopOverallFeedbackMode, AddonModWorkshopGetAssessmentFormFieldsParsedData, } from './workshop'; import { AddonModWorkshopOffline, AddonModWorkshopOfflineSubmission } from './workshop-offline'; -import { ADDON_MOD_WORKSHOP_COMPONENT } from '@addons/mod/workshop/constants'; +import { + ADDON_MOD_WORKSHOP_COMPONENT, + AddonModWorkshopAction, + AddonModWorkshopExampleMode, + AddonModWorkshopOverallFeedbackMode, + AddonModWorkshopPhase, +} from '@addons/mod/workshop/constants'; /** * Helper to gather some common functions for workshop. diff --git a/src/addons/mod/workshop/services/workshop-offline.ts b/src/addons/mod/workshop/services/workshop-offline.ts index 370da3e28..c88c06e68 100644 --- a/src/addons/mod/workshop/services/workshop-offline.ts +++ b/src/addons/mod/workshop/services/workshop-offline.ts @@ -31,7 +31,7 @@ import { EVALUATE_SUBMISSIONS_TABLE, SUBMISSIONS_TABLE, } from './database/workshop'; -import { AddonModWorkshopAction } from './workshop'; +import { AddonModWorkshopAction } from '../constants'; /** * Service to handle offline workshop. diff --git a/src/addons/mod/workshop/services/workshop-sync.ts b/src/addons/mod/workshop/services/workshop-sync.ts index ea7495a7e..a666badd4 100644 --- a/src/addons/mod/workshop/services/workshop-sync.ts +++ b/src/addons/mod/workshop/services/workshop-sync.ts @@ -26,9 +26,7 @@ import { CoreUtils } from '@services/utils/utils'; import { Translate, makeSingleton } from '@singletons'; import { CoreEvents } from '@singletons/events'; import { AddonModWorkshop, - AddonModWorkshopAction, AddonModWorkshopData, - AddonModWorkshopSubmissionType, } from './workshop'; import { AddonModWorkshopHelper } from './workshop-helper'; import { AddonModWorkshopOffline, @@ -37,7 +35,12 @@ import { AddonModWorkshopOffline, AddonModWorkshopOfflineEvaluateSubmission, AddonModWorkshopOfflineSubmission, } from './workshop-offline'; -import { ADDON_MOD_WORKSHOP_COMPONENT } from '@addons/mod/workshop/constants'; +import { + ADDON_MOD_WORKSHOP_AUTO_SYNCED, + ADDON_MOD_WORKSHOP_COMPONENT, + AddonModWorkshopAction, + AddonModWorkshopSubmissionType, +} from '@addons/mod/workshop/constants'; /** * Service to sync workshops. @@ -45,9 +48,6 @@ import { ADDON_MOD_WORKSHOP_COMPONENT } from '@addons/mod/workshop/constants'; @Injectable({ providedIn: 'root' }) export class AddonModWorkshopSyncProvider extends CoreSyncBaseProvider { - static readonly AUTO_SYNCED = 'addon_mod_workshop_autom_synced'; - static readonly MANUAL_SYNCED = 'addon_mod_workshop_manual_synced'; - protected componentTranslatableString = 'workshop'; constructor() { @@ -94,7 +94,7 @@ export class AddonModWorkshopSyncProvider extends CoreSyncBaseProvider { options.page = options.page ?? 0; - options.perPage = options.perPage ?? AddonModWorkshopProvider.PER_PAGE; + options.perPage = options.perPage ?? ADDON_MOD_WORKSHOP_PER_PAGE; const report = await this.getGradesReport(workshopId, options); @@ -1933,7 +1903,7 @@ export type AddonModWorkshopGetSubmissionsOptions = AddonModWorkshopUserOptions * Options to pass to fetchAllGradeReports. */ export type AddonModWorkshopFetchAllGradesReportOptions = AddonModWorkshopGroupOptions & { - perPage?: number; // Records per page to return. Default AddonModWorkshopProvider.PER_PAGE. + perPage?: number; // Records per page to return. Default ADDON_MOD_WORKSHOP_PER_PAGE. }; /** diff --git a/src/addons/mod/workshop/workshop-lazy.module.ts b/src/addons/mod/workshop/workshop-lazy.module.ts index a49cddae5..1e7f038af 100644 --- a/src/addons/mod/workshop/workshop-lazy.module.ts +++ b/src/addons/mod/workshop/workshop-lazy.module.ts @@ -60,4 +60,4 @@ const routes: Routes = [ AddonModWorkshopEditSubmissionPage, ], }) -export class AddonModWorkshopLazyModule {} +export default class AddonModWorkshopLazyModule {} diff --git a/src/addons/mod/workshop/workshop.module.ts b/src/addons/mod/workshop/workshop.module.ts index 6bc3fabb6..63653ee8f 100644 --- a/src/addons/mod/workshop/workshop.module.ts +++ b/src/addons/mod/workshop/workshop.module.ts @@ -66,7 +66,7 @@ export async function getModWorkshopComponentModules(): Promise { const routes: Routes = [ { path: ADDON_MOD_WORKSHOP_PAGE_NAME, - loadChildren: () => import('./workshop-lazy.module').then(m => m.AddonModWorkshopLazyModule), + loadChildren: () => import('./workshop-lazy.module'), }, ];