MOBILE-4272 workshop: Rollback async handlers
There is a bug with missing optional methods in async handlers. If their existence is checked before initialization, they always exist but fail on execution. That should be refactored into asynchronous and type-safe code, but we decided to do it in the next version.main
parent
2ec215e212
commit
53e902ca82
|
@ -15,7 +15,9 @@
|
|||
import { APP_INITIALIZER, NgModule } from '@angular/core';
|
||||
import { AddonWorkshopAssessmentStrategyDelegate } from '../../services/assessment-strategy-delegate';
|
||||
import { CoreSharedModule } from '@/core/shared.module';
|
||||
import { getAssessmentStrategyHandlerInstance } from '@addons/mod/workshop/assessment/accumulative/services/handler';
|
||||
import {
|
||||
AddonModWorkshopAssessmentStrategyAccumulativeHandler,
|
||||
} from '@addons/mod/workshop/assessment/accumulative/services/handler-lazy';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -26,7 +28,12 @@ import { getAssessmentStrategyHandlerInstance } from '@addons/mod/workshop/asses
|
|||
provide: APP_INITIALIZER,
|
||||
multi: true,
|
||||
useValue: () => {
|
||||
AddonWorkshopAssessmentStrategyDelegate.registerHandler(getAssessmentStrategyHandlerInstance());
|
||||
// TODO use async instances
|
||||
// AddonWorkshopAssessmentStrategyDelegate.registerHandler(getAssessmentStrategyHandlerInstance());
|
||||
|
||||
AddonWorkshopAssessmentStrategyDelegate.registerHandler(
|
||||
AddonModWorkshopAssessmentStrategyAccumulativeHandler.instance,
|
||||
);
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
import { CoreSharedModule } from '@/core/shared.module';
|
||||
import { APP_INITIALIZER, NgModule } from '@angular/core';
|
||||
import { AddonWorkshopAssessmentStrategyDelegate } from '../../services/assessment-strategy-delegate';
|
||||
import { getAssessmentStrategyHandlerInstance } from './services/handler';
|
||||
import { AddonModWorkshopAssessmentStrategyCommentsHandler } from '@addons/mod/workshop/assessment/comments/services/handler-lazy';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -26,7 +26,10 @@ import { getAssessmentStrategyHandlerInstance } from './services/handler';
|
|||
provide: APP_INITIALIZER,
|
||||
multi: true,
|
||||
useValue: () => {
|
||||
AddonWorkshopAssessmentStrategyDelegate.registerHandler(getAssessmentStrategyHandlerInstance());
|
||||
// TODO use async instances
|
||||
// AddonWorkshopAssessmentStrategyDelegate.registerHandler(getAssessmentStrategyHandlerInstance());
|
||||
|
||||
AddonWorkshopAssessmentStrategyDelegate.registerHandler(AddonModWorkshopAssessmentStrategyCommentsHandler.instance);
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
|
@ -15,7 +15,9 @@
|
|||
import { CoreSharedModule } from '@/core/shared.module';
|
||||
import { APP_INITIALIZER, NgModule } from '@angular/core';
|
||||
import { AddonWorkshopAssessmentStrategyDelegate } from '../../services/assessment-strategy-delegate';
|
||||
import { getAssessmentStrategyHandlerInstance } from './services/handler';
|
||||
import {
|
||||
AddonModWorkshopAssessmentStrategyNumErrorsHandler,
|
||||
} from '@addons/mod/workshop/assessment/numerrors/services/handler-lazy';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -26,7 +28,12 @@ import { getAssessmentStrategyHandlerInstance } from './services/handler';
|
|||
provide: APP_INITIALIZER,
|
||||
multi: true,
|
||||
useValue: () => {
|
||||
AddonWorkshopAssessmentStrategyDelegate.registerHandler(getAssessmentStrategyHandlerInstance());
|
||||
// TODO use async instances
|
||||
// AddonWorkshopAssessmentStrategyDelegate.registerHandler(getAssessmentStrategyHandlerInstance());
|
||||
|
||||
AddonWorkshopAssessmentStrategyDelegate.registerHandler(
|
||||
AddonModWorkshopAssessmentStrategyNumErrorsHandler.instance,
|
||||
);
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
import { CoreSharedModule } from '@/core/shared.module';
|
||||
import { APP_INITIALIZER, NgModule } from '@angular/core';
|
||||
import { AddonWorkshopAssessmentStrategyDelegate } from '../../services/assessment-strategy-delegate';
|
||||
import { getAssessmentStrategyHandlerInstance } from './services/handler';
|
||||
import { AddonModWorkshopAssessmentStrategyRubricHandler } from '@addons/mod/workshop/assessment/rubric/services/handler-lazy';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -26,7 +26,10 @@ import { getAssessmentStrategyHandlerInstance } from './services/handler';
|
|||
provide: APP_INITIALIZER,
|
||||
multi: true,
|
||||
useValue: () => {
|
||||
AddonWorkshopAssessmentStrategyDelegate.registerHandler(getAssessmentStrategyHandlerInstance());
|
||||
// TODO use async instances
|
||||
// AddonWorkshopAssessmentStrategyDelegate.registerHandler(getAssessmentStrategyHandlerInstance());
|
||||
|
||||
AddonWorkshopAssessmentStrategyDelegate.registerHandler(AddonModWorkshopAssessmentStrategyRubricHandler.instance);
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
|
@ -27,8 +27,8 @@ import { AddonModWorkshopIndexLinkHandler } from './services/handlers/index-link
|
|||
import { AddonModWorkshopListLinkHandler } from './services/handlers/list-link';
|
||||
import { AddonModWorkshopModuleHandler } from './services/handlers/module';
|
||||
import { ADDON_MOD_WORKSHOP_COMPONENT, ADDON_MOD_WORKSHOP_PAGE_NAME } from '@addons/mod/workshop/constants';
|
||||
import { getCronHandlerInstance } from '@addons/mod/workshop/services/handlers/sync-cron';
|
||||
import { getPrefetchHandlerInstance } from '@addons/mod/workshop/services/handlers/prefetch';
|
||||
import { AddonModWorkshopPrefetchHandler } from '@addons/mod/workshop/services/handlers/prefetch-lazy';
|
||||
import { AddonModWorkshopSyncCronHandler } from '@addons/mod/workshop/services/handlers/sync-cron-lazy';
|
||||
|
||||
/**
|
||||
* Get workshop services.
|
||||
|
@ -85,9 +85,13 @@ const routes: Routes = [
|
|||
provide: APP_INITIALIZER,
|
||||
multi: true,
|
||||
useValue: () => {
|
||||
// TODO use async instances
|
||||
// CoreCourseModulePrefetchDelegate.registerHandler(getPrefetchHandlerInstance());
|
||||
// CoreCronDelegate.register(getCronHandlerInstance());
|
||||
|
||||
CoreCourseModuleDelegate.registerHandler(AddonModWorkshopModuleHandler.instance);
|
||||
CoreCourseModulePrefetchDelegate.registerHandler(getPrefetchHandlerInstance());
|
||||
CoreCronDelegate.register(getCronHandlerInstance());
|
||||
CoreCourseModulePrefetchDelegate.registerHandler(AddonModWorkshopPrefetchHandler.instance);
|
||||
CoreCronDelegate.register(AddonModWorkshopSyncCronHandler.instance);
|
||||
CoreContentLinksDelegate.registerHandler(AddonModWorkshopIndexLinkHandler.instance);
|
||||
CoreContentLinksDelegate.registerHandler(AddonModWorkshopListLinkHandler.instance);
|
||||
|
||||
|
|
Loading…
Reference in New Issue