MOBILE-4616 workshop: Move workshop constants to a file
parent
ba80f1ce05
commit
65a5659d47
|
@ -29,8 +29,6 @@ import { CoreEventObserver, CoreEvents } from '@singletons/events';
|
||||||
import { CoreFormFields, CoreForms } from '@singletons/form';
|
import { CoreFormFields, CoreForms } from '@singletons/form';
|
||||||
import { AddonWorkshopAssessmentStrategyDelegate } from '../../services/assessment-strategy-delegate';
|
import { AddonWorkshopAssessmentStrategyDelegate } from '../../services/assessment-strategy-delegate';
|
||||||
import {
|
import {
|
||||||
AddonModWorkshopProvider,
|
|
||||||
AddonModWorkshopOverallFeedbackMode,
|
|
||||||
AddonModWorkshop,
|
AddonModWorkshop,
|
||||||
AddonModWorkshopData,
|
AddonModWorkshopData,
|
||||||
AddonModWorkshopGetWorkshopAccessInformationWSResponse,
|
AddonModWorkshopGetWorkshopAccessInformationWSResponse,
|
||||||
|
@ -38,7 +36,12 @@ import {
|
||||||
} from '../../services/workshop';
|
} from '../../services/workshop';
|
||||||
import { AddonModWorkshopHelper, AddonModWorkshopSubmissionAssessmentWithFormData } from '../../services/workshop-helper';
|
import { AddonModWorkshopHelper, AddonModWorkshopSubmissionAssessmentWithFormData } from '../../services/workshop-helper';
|
||||||
import { AddonModWorkshopOffline } from '../../services/workshop-offline';
|
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.
|
* Component that displays workshop assessment strategy form.
|
||||||
|
@ -135,7 +138,7 @@ export class AddonModWorkshopAssessmentStrategyComponent implements OnInit, OnDe
|
||||||
try {
|
try {
|
||||||
await this.load();
|
await this.load();
|
||||||
this.obsInvalidated = CoreEvents.on(
|
this.obsInvalidated = CoreEvents.on(
|
||||||
AddonModWorkshopProvider.ASSESSMENT_INVALIDATED,
|
ADDON_MOD_WORKSHOP_ASSESSMENT_INVALIDATED,
|
||||||
() => this.load(),
|
() => this.load(),
|
||||||
CoreSites.getCurrentSiteId(),
|
CoreSites.getCurrentSiteId(),
|
||||||
);
|
);
|
||||||
|
@ -382,7 +385,7 @@ export class AddonModWorkshopAssessmentStrategyComponent implements OnInit, OnDe
|
||||||
|
|
||||||
await CoreUtils.ignoreErrors(Promise.all(promises));
|
await CoreUtils.ignoreErrors(Promise.all(promises));
|
||||||
|
|
||||||
CoreEvents.trigger(AddonModWorkshopProvider.ASSESSMENT_SAVED, {
|
CoreEvents.trigger(ADDON_MOD_WORKSHOP_ASSESSMENT_SAVED, {
|
||||||
workshopId: this.workshop.id,
|
workshopId: this.workshop.id,
|
||||||
assessmentId: this.assessmentId,
|
assessmentId: this.assessmentId,
|
||||||
userId: CoreSites.getCurrentSiteUserId(),
|
userId: CoreSites.getCurrentSiteUserId(),
|
||||||
|
|
|
@ -26,8 +26,6 @@ import { CoreUtils } from '@services/utils/utils';
|
||||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
|
import { CoreEventObserver, CoreEvents } from '@singletons/events';
|
||||||
import { Subscription } from 'rxjs';
|
import { Subscription } from 'rxjs';
|
||||||
import {
|
import {
|
||||||
AddonModWorkshopProvider,
|
|
||||||
AddonModWorkshopPhase,
|
|
||||||
AddonModWorkshop,
|
AddonModWorkshop,
|
||||||
AddonModWorkshopData,
|
AddonModWorkshopData,
|
||||||
AddonModWorkshopGetWorkshopAccessInformationWSResponse,
|
AddonModWorkshopGetWorkshopAccessInformationWSResponse,
|
||||||
|
@ -46,13 +44,20 @@ import {
|
||||||
} from '../../services/workshop-helper';
|
} from '../../services/workshop-helper';
|
||||||
import { AddonModWorkshopOffline, AddonModWorkshopOfflineSubmission } from '../../services/workshop-offline';
|
import { AddonModWorkshopOffline, AddonModWorkshopOfflineSubmission } from '../../services/workshop-offline';
|
||||||
import {
|
import {
|
||||||
AddonModWorkshopSyncProvider,
|
|
||||||
AddonModWorkshopSync,
|
AddonModWorkshopSync,
|
||||||
AddonModWorkshopAutoSyncData,
|
AddonModWorkshopAutoSyncData,
|
||||||
AddonModWorkshopSyncResult,
|
AddonModWorkshopSyncResult,
|
||||||
} from '../../services/workshop-sync';
|
} from '../../services/workshop-sync';
|
||||||
import { AddonModWorkshopPhaseInfoComponent } from '../phase/phase';
|
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.
|
* Component that displays a workshop index page.
|
||||||
|
@ -101,7 +106,7 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity
|
||||||
protected obsAssessmentSaved: CoreEventObserver;
|
protected obsAssessmentSaved: CoreEventObserver;
|
||||||
protected appResumeSubscription: Subscription;
|
protected appResumeSubscription: Subscription;
|
||||||
protected syncObserver?: CoreEventObserver;
|
protected syncObserver?: CoreEventObserver;
|
||||||
protected syncEventName = AddonModWorkshopSyncProvider.AUTO_SYNCED;
|
protected syncEventName = ADDON_MOD_WORKSHOP_AUTO_SYNCED;
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
@Optional() content: IonContent,
|
@Optional() content: IonContent,
|
||||||
|
@ -110,12 +115,12 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity
|
||||||
super('AddonModWorkshopIndexComponent', content, courseContentsPage);
|
super('AddonModWorkshopIndexComponent', content, courseContentsPage);
|
||||||
|
|
||||||
// Listen to submission and assessment changes.
|
// 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.eventReceived(data);
|
||||||
}, this.siteId);
|
}, this.siteId);
|
||||||
|
|
||||||
// Listen to submission and assessment changes.
|
// 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.eventReceived(data);
|
||||||
}, this.siteId);
|
}, this.siteId);
|
||||||
|
|
||||||
|
@ -125,7 +130,7 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity
|
||||||
});
|
});
|
||||||
|
|
||||||
// Refresh workshop on sync.
|
// 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.
|
// Update just when all database is synced.
|
||||||
this.eventReceived(data);
|
this.eventReceived(data);
|
||||||
}, this.siteId);
|
}, this.siteId);
|
||||||
|
@ -282,8 +287,8 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity
|
||||||
|
|
||||||
this.page = page;
|
this.page = page;
|
||||||
|
|
||||||
this.hasNextPage = numEntries >= AddonModWorkshopProvider.PER_PAGE && ((this.page + 1) *
|
this.hasNextPage = numEntries >= ADDON_MOD_WORKSHOP_PER_PAGE && ((this.page + 1) *
|
||||||
AddonModWorkshopProvider.PER_PAGE) < report.totalcount;
|
ADDON_MOD_WORKSHOP_PER_PAGE) < report.totalcount;
|
||||||
|
|
||||||
const grades: AddonModWorkshopGradesData[] = report.grades || [];
|
const grades: AddonModWorkshopGradesData[] = report.grades || [];
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,8 @@
|
||||||
import { Component, Input, OnInit } from '@angular/core';
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
import { CoreUtils } from '@services/utils/utils';
|
import { CoreUtils } from '@services/utils/utils';
|
||||||
import { ModalController } from '@singletons';
|
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.
|
* Page that displays the phase info modal.
|
||||||
|
|
|
@ -20,7 +20,6 @@ import { CoreNavigator } from '@services/navigator';
|
||||||
import { CoreSites } from '@services/sites';
|
import { CoreSites } from '@services/sites';
|
||||||
import { AddonModWorkshopSubmissionPage } from '../../pages/submission/submission';
|
import { AddonModWorkshopSubmissionPage } from '../../pages/submission/submission';
|
||||||
import {
|
import {
|
||||||
AddonModWorkshopPhase,
|
|
||||||
AddonModWorkshopData,
|
AddonModWorkshopData,
|
||||||
AddonModWorkshopGetWorkshopAccessInformationWSResponse,
|
AddonModWorkshopGetWorkshopAccessInformationWSResponse,
|
||||||
} from '../../services/workshop';
|
} from '../../services/workshop';
|
||||||
|
@ -30,7 +29,7 @@ import {
|
||||||
AddonModWorkshopSubmissionDataWithOfflineData,
|
AddonModWorkshopSubmissionDataWithOfflineData,
|
||||||
} from '../../services/workshop-helper';
|
} from '../../services/workshop-helper';
|
||||||
import { AddonModWorkshopOffline } from '../../services/workshop-offline';
|
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.
|
* Component that displays workshop submission.
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
|
|
||||||
export const ADDON_MOD_WORKSHOP_COMPONENT = 'mmaModWorkshop';
|
export const ADDON_MOD_WORKSHOP_COMPONENT = 'mmaModWorkshop';
|
||||||
|
|
||||||
|
export const ADDON_MOD_WORKSHOP_PER_PAGE = 10;
|
||||||
|
|
||||||
// Routing.
|
// Routing.
|
||||||
export const ADDON_MOD_WORKSHOP_PAGE_NAME = 'mod_workshop';
|
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_SYNC_CRON_NAME = 'AddonModWorkshopSyncCronHandler';
|
||||||
|
|
||||||
export const ADDON_MOD_WORKSHOP_FEATURE_NAME = 'CoreCourseModuleDelegate_AddonModWorkshop';
|
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,
|
||||||
|
}
|
||||||
|
|
|
@ -31,16 +31,19 @@ import {
|
||||||
AddonModWorkshopAssessmentSavedChangedEventData,
|
AddonModWorkshopAssessmentSavedChangedEventData,
|
||||||
AddonModWorkshopData,
|
AddonModWorkshopData,
|
||||||
AddonModWorkshopGetWorkshopAccessInformationWSResponse,
|
AddonModWorkshopGetWorkshopAccessInformationWSResponse,
|
||||||
AddonModWorkshopPhase,
|
|
||||||
AddonModWorkshopProvider,
|
|
||||||
AddonModWorkshopSubmissionData,
|
AddonModWorkshopSubmissionData,
|
||||||
} from '../../services/workshop';
|
} from '../../services/workshop';
|
||||||
import { AddonModWorkshopHelper, AddonModWorkshopSubmissionAssessmentWithFormData } from '../../services/workshop-helper';
|
import { AddonModWorkshopHelper, AddonModWorkshopSubmissionAssessmentWithFormData } from '../../services/workshop-helper';
|
||||||
import { AddonModWorkshopOffline } from '../../services/workshop-offline';
|
import { AddonModWorkshopOffline } from '../../services/workshop-offline';
|
||||||
import { AddonModWorkshopSyncProvider } from '../../services/workshop-sync';
|
|
||||||
import { CoreTime } from '@singletons/time';
|
import { CoreTime } from '@singletons/time';
|
||||||
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
|
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.
|
* Page that displays a workshop assessment.
|
||||||
|
@ -107,7 +110,7 @@ export class AddonModWorkshopAssessmentPage implements OnInit, OnDestroy, CanLea
|
||||||
this.evaluateForm.addControl('text', this.fb.control(''));
|
this.evaluateForm.addControl('text', this.fb.control(''));
|
||||||
|
|
||||||
// Refresh workshop on sync.
|
// 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.
|
// Update just when all database is synced.
|
||||||
if (this.workshopId === data.workshopId) {
|
if (this.workshopId === data.workshopId) {
|
||||||
this.loaded = false;
|
this.loaded = false;
|
||||||
|
@ -331,7 +334,7 @@ export class AddonModWorkshopAssessmentPage implements OnInit, OnDestroy, CanLea
|
||||||
try {
|
try {
|
||||||
await Promise.all(promises);
|
await Promise.all(promises);
|
||||||
} finally {
|
} finally {
|
||||||
CoreEvents.trigger(AddonModWorkshopProvider.ASSESSMENT_INVALIDATED, null, this.siteId);
|
CoreEvents.trigger(ADDON_MOD_WORKSHOP_ASSESSMENT_INVALIDATED, null, this.siteId);
|
||||||
|
|
||||||
await this.fetchAssessmentData();
|
await this.fetchAssessmentData();
|
||||||
}
|
}
|
||||||
|
@ -396,7 +399,7 @@ export class AddonModWorkshopAssessmentPage implements OnInit, OnDestroy, CanLea
|
||||||
};
|
};
|
||||||
|
|
||||||
return AddonModWorkshop.invalidateAssessmentData(this.workshopId, this.assessmentId).finally(() => {
|
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) {
|
} catch (error) {
|
||||||
CoreDomUtils.showErrorModalDefault(error, 'Cannot save assessment evaluation');
|
CoreDomUtils.showErrorModalDefault(error, 'Cannot save assessment evaluation');
|
||||||
|
|
|
@ -30,18 +30,20 @@ import { Translate } from '@singletons';
|
||||||
import { CoreEvents } from '@singletons/events';
|
import { CoreEvents } from '@singletons/events';
|
||||||
import { CoreForms } from '@singletons/form';
|
import { CoreForms } from '@singletons/form';
|
||||||
import {
|
import {
|
||||||
AddonModWorkshopProvider,
|
|
||||||
AddonModWorkshop,
|
AddonModWorkshop,
|
||||||
AddonModWorkshopSubmissionType,
|
|
||||||
AddonModWorkshopSubmissionChangedEventData,
|
AddonModWorkshopSubmissionChangedEventData,
|
||||||
AddonModWorkshopAction,
|
|
||||||
AddonModWorkshopGetWorkshopAccessInformationWSResponse,
|
AddonModWorkshopGetWorkshopAccessInformationWSResponse,
|
||||||
AddonModWorkshopData,
|
AddonModWorkshopData,
|
||||||
} from '../../services/workshop';
|
} from '../../services/workshop';
|
||||||
import { AddonModWorkshopHelper, AddonModWorkshopSubmissionDataWithOfflineData } from '../../services/workshop-helper';
|
import { AddonModWorkshopHelper, AddonModWorkshopSubmissionDataWithOfflineData } from '../../services/workshop-helper';
|
||||||
import { AddonModWorkshopOffline } from '../../services/workshop-offline';
|
import { AddonModWorkshopOffline } from '../../services/workshop-offline';
|
||||||
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
|
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.
|
* Page that displays the workshop edit submission.
|
||||||
|
@ -473,7 +475,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy, Ca
|
||||||
Promise.resolve();
|
Promise.resolve();
|
||||||
|
|
||||||
await promise.finally(() => {
|
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.
|
// Delete the local files from the tmp folder.
|
||||||
CoreFileUploader.clearTmpFiles(inputData.attachmentfiles);
|
CoreFileUploader.clearTmpFiles(inputData.attachmentfiles);
|
||||||
|
|
|
@ -31,11 +31,8 @@ import { CoreEventObserver, CoreEvents } from '@singletons/events';
|
||||||
import { CoreForms } from '@singletons/form';
|
import { CoreForms } from '@singletons/form';
|
||||||
import { AddonModWorkshopAssessmentStrategyComponent } from '../../components/assessment-strategy/assessment-strategy';
|
import { AddonModWorkshopAssessmentStrategyComponent } from '../../components/assessment-strategy/assessment-strategy';
|
||||||
import {
|
import {
|
||||||
AddonModWorkshopProvider,
|
|
||||||
AddonModWorkshop,
|
AddonModWorkshop,
|
||||||
AddonModWorkshopPhase,
|
|
||||||
AddonModWorkshopSubmissionChangedEventData,
|
AddonModWorkshopSubmissionChangedEventData,
|
||||||
AddonModWorkshopAction,
|
|
||||||
AddonModWorkshopData,
|
AddonModWorkshopData,
|
||||||
AddonModWorkshopGetWorkshopAccessInformationWSResponse,
|
AddonModWorkshopGetWorkshopAccessInformationWSResponse,
|
||||||
AddonModWorkshopAssessmentSavedChangedEventData,
|
AddonModWorkshopAssessmentSavedChangedEventData,
|
||||||
|
@ -46,10 +43,18 @@ import {
|
||||||
AddonModWorkshopSubmissionDataWithOfflineData,
|
AddonModWorkshopSubmissionDataWithOfflineData,
|
||||||
} from '../../services/workshop-helper';
|
} from '../../services/workshop-helper';
|
||||||
import { AddonModWorkshopOffline } from '../../services/workshop-offline';
|
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 { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
|
||||||
import { CoreTime } from '@singletons/time';
|
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.
|
* 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('grade', this.fb.control(''));
|
||||||
this.feedbackForm.addControl('text', 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.eventReceived(data);
|
||||||
}, this.siteId);
|
}, this.siteId);
|
||||||
|
|
||||||
// Refresh workshop on sync.
|
// 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.
|
// Update just when all database is synced.
|
||||||
this.eventReceived(data);
|
this.eventReceived(data);
|
||||||
}, this.siteId);
|
}, this.siteId);
|
||||||
|
@ -447,7 +452,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy, CanLea
|
||||||
try {
|
try {
|
||||||
await Promise.all(promises);
|
await Promise.all(promises);
|
||||||
} finally {
|
} finally {
|
||||||
CoreEvents.trigger(AddonModWorkshopProvider.ASSESSMENT_INVALIDATED, null, this.siteId);
|
CoreEvents.trigger(ADDON_MOD_WORKSHOP_ASSESSMENT_INVALIDATED, null, this.siteId);
|
||||||
|
|
||||||
await this.fetchSubmissionData();
|
await this.fetchSubmissionData();
|
||||||
|
|
||||||
|
@ -535,7 +540,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy, CanLea
|
||||||
submissionId: this.submissionId,
|
submissionId: this.submissionId,
|
||||||
};
|
};
|
||||||
|
|
||||||
CoreEvents.trigger(AddonModWorkshopProvider.SUBMISSION_CHANGED, data, this.siteId);
|
CoreEvents.trigger(ADDON_MOD_WORKSHOP_SUBMISSION_CHANGED, data, this.siteId);
|
||||||
});
|
});
|
||||||
} catch (message) {
|
} catch (message) {
|
||||||
CoreDomUtils.showErrorModalDefault(message, 'Cannot save submission evaluation');
|
CoreDomUtils.showErrorModalDefault(message, 'Cannot save submission evaluation');
|
||||||
|
@ -572,7 +577,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy, CanLea
|
||||||
submissionId: this.submissionId,
|
submissionId: this.submissionId,
|
||||||
};
|
};
|
||||||
|
|
||||||
CoreEvents.trigger(AddonModWorkshopProvider.SUBMISSION_CHANGED, data, this.siteId);
|
CoreEvents.trigger(ADDON_MOD_WORKSHOP_SUBMISSION_CHANGED, data, this.siteId);
|
||||||
|
|
||||||
this.forceLeavePage();
|
this.forceLeavePage();
|
||||||
}
|
}
|
||||||
|
@ -595,7 +600,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy, CanLea
|
||||||
submissionId: this.submissionId,
|
submissionId: this.submissionId,
|
||||||
};
|
};
|
||||||
|
|
||||||
CoreEvents.trigger(AddonModWorkshopProvider.SUBMISSION_CHANGED, data, this.siteId);
|
CoreEvents.trigger(ADDON_MOD_WORKSHOP_SUBMISSION_CHANGED, data, this.siteId);
|
||||||
|
|
||||||
await this.refreshAllData();
|
await this.refreshAllData();
|
||||||
});
|
});
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
import { CoreSiteSchema } from '@services/sites';
|
import { CoreSiteSchema } from '@services/sites';
|
||||||
import { AddonModWorkshopAction } from '../workshop';
|
import { AddonModWorkshopAction } from '../../constants';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database variables for AddonModWorkshopOfflineProvider.
|
* Database variables for AddonModWorkshopOfflineProvider.
|
||||||
|
|
|
@ -25,7 +25,6 @@ import { CoreWSExternalFile, CoreWSFile } from '@services/ws';
|
||||||
import { makeSingleton } from '@singletons';
|
import { makeSingleton } from '@singletons';
|
||||||
import {
|
import {
|
||||||
AddonModWorkshop,
|
AddonModWorkshop,
|
||||||
AddonModWorkshopPhase,
|
|
||||||
AddonModWorkshopGradesData,
|
AddonModWorkshopGradesData,
|
||||||
AddonModWorkshopData,
|
AddonModWorkshopData,
|
||||||
AddonModWorkshopGetWorkshopAccessInformationWSResponse,
|
AddonModWorkshopGetWorkshopAccessInformationWSResponse,
|
||||||
|
@ -33,6 +32,7 @@ import {
|
||||||
import { AddonModWorkshopHelper } from '../workshop-helper';
|
import { AddonModWorkshopHelper } from '../workshop-helper';
|
||||||
import { AddonModWorkshopSync } from '../workshop-sync';
|
import { AddonModWorkshopSync } from '../workshop-sync';
|
||||||
import { AddonModWorkshopPrefetchHandlerService } from '@addons/mod/workshop/services/handlers/prefetch';
|
import { AddonModWorkshopPrefetchHandlerService } from '@addons/mod/workshop/services/handlers/prefetch';
|
||||||
|
import { AddonModWorkshopPhase } from '../../constants';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler to prefetch workshops.
|
* Handler to prefetch workshops.
|
||||||
|
|
|
@ -26,8 +26,6 @@ import { CoreFormFields } from '@singletons/form';
|
||||||
import { AddonModWorkshopAssessmentStrategyFieldErrors } from '../components/assessment-strategy/assessment-strategy';
|
import { AddonModWorkshopAssessmentStrategyFieldErrors } from '../components/assessment-strategy/assessment-strategy';
|
||||||
import { AddonWorkshopAssessmentStrategyDelegate } from './assessment-strategy-delegate';
|
import { AddonWorkshopAssessmentStrategyDelegate } from './assessment-strategy-delegate';
|
||||||
import {
|
import {
|
||||||
AddonModWorkshopExampleMode,
|
|
||||||
AddonModWorkshopPhase,
|
|
||||||
AddonModWorkshopUserOptions,
|
AddonModWorkshopUserOptions,
|
||||||
AddonModWorkshopData,
|
AddonModWorkshopData,
|
||||||
AddonModWorkshop,
|
AddonModWorkshop,
|
||||||
|
@ -36,12 +34,16 @@ import {
|
||||||
AddonModWorkshopPhaseTaskData,
|
AddonModWorkshopPhaseTaskData,
|
||||||
AddonModWorkshopSubmissionAssessmentData,
|
AddonModWorkshopSubmissionAssessmentData,
|
||||||
AddonModWorkshopGetAssessmentFormDefinitionData,
|
AddonModWorkshopGetAssessmentFormDefinitionData,
|
||||||
AddonModWorkshopAction,
|
|
||||||
AddonModWorkshopOverallFeedbackMode,
|
|
||||||
AddonModWorkshopGetAssessmentFormFieldsParsedData,
|
AddonModWorkshopGetAssessmentFormFieldsParsedData,
|
||||||
} from './workshop';
|
} from './workshop';
|
||||||
import { AddonModWorkshopOffline, AddonModWorkshopOfflineSubmission } from './workshop-offline';
|
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.
|
* Helper to gather some common functions for workshop.
|
||||||
|
|
|
@ -31,7 +31,7 @@ import {
|
||||||
EVALUATE_SUBMISSIONS_TABLE,
|
EVALUATE_SUBMISSIONS_TABLE,
|
||||||
SUBMISSIONS_TABLE,
|
SUBMISSIONS_TABLE,
|
||||||
} from './database/workshop';
|
} from './database/workshop';
|
||||||
import { AddonModWorkshopAction } from './workshop';
|
import { AddonModWorkshopAction } from '../constants';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service to handle offline workshop.
|
* Service to handle offline workshop.
|
||||||
|
|
|
@ -26,9 +26,7 @@ import { CoreUtils } from '@services/utils/utils';
|
||||||
import { Translate, makeSingleton } from '@singletons';
|
import { Translate, makeSingleton } from '@singletons';
|
||||||
import { CoreEvents } from '@singletons/events';
|
import { CoreEvents } from '@singletons/events';
|
||||||
import { AddonModWorkshop,
|
import { AddonModWorkshop,
|
||||||
AddonModWorkshopAction,
|
|
||||||
AddonModWorkshopData,
|
AddonModWorkshopData,
|
||||||
AddonModWorkshopSubmissionType,
|
|
||||||
} from './workshop';
|
} from './workshop';
|
||||||
import { AddonModWorkshopHelper } from './workshop-helper';
|
import { AddonModWorkshopHelper } from './workshop-helper';
|
||||||
import { AddonModWorkshopOffline,
|
import { AddonModWorkshopOffline,
|
||||||
|
@ -37,7 +35,12 @@ import { AddonModWorkshopOffline,
|
||||||
AddonModWorkshopOfflineEvaluateSubmission,
|
AddonModWorkshopOfflineEvaluateSubmission,
|
||||||
AddonModWorkshopOfflineSubmission,
|
AddonModWorkshopOfflineSubmission,
|
||||||
} from './workshop-offline';
|
} 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.
|
* Service to sync workshops.
|
||||||
|
@ -45,9 +48,6 @@ import { ADDON_MOD_WORKSHOP_COMPONENT } from '@addons/mod/workshop/constants';
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class AddonModWorkshopSyncProvider extends CoreSyncBaseProvider<AddonModWorkshopSyncResult> {
|
export class AddonModWorkshopSyncProvider extends CoreSyncBaseProvider<AddonModWorkshopSyncResult> {
|
||||||
|
|
||||||
static readonly AUTO_SYNCED = 'addon_mod_workshop_autom_synced';
|
|
||||||
static readonly MANUAL_SYNCED = 'addon_mod_workshop_manual_synced';
|
|
||||||
|
|
||||||
protected componentTranslatableString = 'workshop';
|
protected componentTranslatableString = 'workshop';
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -94,7 +94,7 @@ export class AddonModWorkshopSyncProvider extends CoreSyncBaseProvider<AddonModW
|
||||||
|
|
||||||
if (data && data.updated) {
|
if (data && data.updated) {
|
||||||
// Sync done. Send event.
|
// Sync done. Send event.
|
||||||
CoreEvents.trigger(AddonModWorkshopSyncProvider.AUTO_SYNCED, {
|
CoreEvents.trigger(ADDON_MOD_WORKSHOP_AUTO_SYNCED, {
|
||||||
workshopId: workshopId,
|
workshopId: workshopId,
|
||||||
warnings: data.warnings,
|
warnings: data.warnings,
|
||||||
}, siteId);
|
}, siteId);
|
||||||
|
|
|
@ -26,49 +26,23 @@ import { CoreStatusWithWarningsWSResponse, CoreWS, CoreWSExternalFile, CoreWSExt
|
||||||
import { makeSingleton, Translate } from '@singletons';
|
import { makeSingleton, Translate } from '@singletons';
|
||||||
import { CoreFormFields } from '@singletons/form';
|
import { CoreFormFields } from '@singletons/form';
|
||||||
import { AddonModWorkshopOffline } from './workshop-offline';
|
import { AddonModWorkshopOffline } from './workshop-offline';
|
||||||
import { AddonModWorkshopAutoSyncData, AddonModWorkshopSyncProvider } from './workshop-sync';
|
import { AddonModWorkshopAutoSyncData } from './workshop-sync';
|
||||||
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_PER_PAGE,
|
||||||
|
ADDON_MOD_WORKSHOP_SUBMISSION_CHANGED,
|
||||||
|
AddonModWorkshopAction,
|
||||||
|
AddonModWorkshopAssessmentMode,
|
||||||
|
AddonModWorkshopExampleMode,
|
||||||
|
AddonModWorkshopOverallFeedbackMode,
|
||||||
|
AddonModWorkshopPhase,
|
||||||
|
AddonModWorkshopSubmissionType,
|
||||||
|
} from '@addons/mod/workshop/constants';
|
||||||
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
|
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
|
||||||
|
|
||||||
const ROOT_CACHE_KEY = 'mmaModWorkshop:';
|
|
||||||
|
|
||||||
export enum AddonModWorkshopPhase {
|
|
||||||
PHASE_SETUP = 10,
|
|
||||||
PHASE_SUBMISSION = 20,
|
|
||||||
PHASE_ASSESSMENT = 30,
|
|
||||||
PHASE_EVALUATION = 40,
|
|
||||||
PHASE_CLOSED = 50,
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum AddonModWorkshopSubmissionType {
|
|
||||||
SUBMISSION_TYPE_DISABLED = 0,
|
|
||||||
SUBMISSION_TYPE_AVAILABLE = 1,
|
|
||||||
SUBMISSION_TYPE_REQUIRED = 2,
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum AddonModWorkshopExampleMode {
|
|
||||||
EXAMPLES_VOLUNTARY = 0,
|
|
||||||
EXAMPLES_BEFORE_SUBMISSION = 1,
|
|
||||||
EXAMPLES_BEFORE_ASSESSMENT = 2,
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum AddonModWorkshopAction {
|
|
||||||
ADD = 'add',
|
|
||||||
DELETE = 'delete',
|
|
||||||
UPDATE = 'update',
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum AddonModWorkshopAssessmentMode {
|
|
||||||
ASSESSMENT = 'assessment',
|
|
||||||
PREVIEW = 'preview',
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum AddonModWorkshopOverallFeedbackMode {
|
|
||||||
DISABLED = 0,
|
|
||||||
ENABLED_OPTIONAL = 1,
|
|
||||||
ENABLED_REQUIRED = 2,
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module '@singletons/events' {
|
declare module '@singletons/events' {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,10 +51,10 @@ declare module '@singletons/events' {
|
||||||
* @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
|
* @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
|
||||||
*/
|
*/
|
||||||
export interface CoreEventsData {
|
export interface CoreEventsData {
|
||||||
[AddonModWorkshopSyncProvider.AUTO_SYNCED]: AddonModWorkshopAutoSyncData;
|
[ADDON_MOD_WORKSHOP_AUTO_SYNCED]: AddonModWorkshopAutoSyncData;
|
||||||
[AddonModWorkshopProvider.SUBMISSION_CHANGED]: AddonModWorkshopSubmissionChangedEventData;
|
[ADDON_MOD_WORKSHOP_SUBMISSION_CHANGED]: AddonModWorkshopSubmissionChangedEventData;
|
||||||
[AddonModWorkshopProvider.ASSESSMENT_SAVED]: AddonModWorkshopAssessmentSavedChangedEventData;
|
[ADDON_MOD_WORKSHOP_ASSESSMENT_SAVED]: AddonModWorkshopAssessmentSavedChangedEventData;
|
||||||
[AddonModWorkshopProvider.ASSESSMENT_INVALIDATED]: AddonModWorkshopAssessmentInvalidatedChangedEventData;
|
[ADDON_MOD_WORKSHOP_ASSESSMENT_INVALIDATED]: AddonModWorkshopAssessmentInvalidatedChangedEventData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,11 +64,7 @@ declare module '@singletons/events' {
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class AddonModWorkshopProvider {
|
export class AddonModWorkshopProvider {
|
||||||
|
|
||||||
static readonly PER_PAGE = 10;
|
protected static readonly ROOT_CACHE_KEY = 'mmaModWorkshop:';
|
||||||
|
|
||||||
static readonly SUBMISSION_CHANGED = 'addon_mod_workshop_submission_changed';
|
|
||||||
static readonly ASSESSMENT_SAVED = 'addon_mod_workshop_assessment_saved';
|
|
||||||
static readonly ASSESSMENT_INVALIDATED = 'addon_mod_workshop_assessment_invalidated';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get cache key for workshop data WS calls.
|
* Get cache key for workshop data WS calls.
|
||||||
|
@ -103,7 +73,7 @@ export class AddonModWorkshopProvider {
|
||||||
* @returns Cache key.
|
* @returns Cache key.
|
||||||
*/
|
*/
|
||||||
protected getWorkshopDataCacheKey(courseId: number): string {
|
protected getWorkshopDataCacheKey(courseId: number): string {
|
||||||
return ROOT_CACHE_KEY + 'workshop:' + courseId;
|
return AddonModWorkshopProvider.ROOT_CACHE_KEY + 'workshop:' + courseId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -113,7 +83,7 @@ export class AddonModWorkshopProvider {
|
||||||
* @returns Cache key.
|
* @returns Cache key.
|
||||||
*/
|
*/
|
||||||
protected getWorkshopDataPrefixCacheKey(workshopId: number): string {
|
protected getWorkshopDataPrefixCacheKey(workshopId: number): string {
|
||||||
return ROOT_CACHE_KEY + workshopId;
|
return AddonModWorkshopProvider.ROOT_CACHE_KEY + workshopId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -562,7 +532,7 @@ export class AddonModWorkshopProvider {
|
||||||
workshopid: workshopId,
|
workshopid: workshopId,
|
||||||
groupid: options.groupId,
|
groupid: options.groupId,
|
||||||
page: options.page || 0,
|
page: options.page || 0,
|
||||||
perpage: options.perPage || AddonModWorkshopProvider.PER_PAGE,
|
perpage: options.perPage || ADDON_MOD_WORKSHOP_PER_PAGE,
|
||||||
};
|
};
|
||||||
|
|
||||||
const preSets: CoreSiteWSPreSets = {
|
const preSets: CoreSiteWSPreSets = {
|
||||||
|
@ -593,7 +563,7 @@ export class AddonModWorkshopProvider {
|
||||||
return this.fetchGradeReportsRecursive(workshopId, [], {
|
return this.fetchGradeReportsRecursive(workshopId, [], {
|
||||||
...options, // Include all options.
|
...options, // Include all options.
|
||||||
page: 0,
|
page: 0,
|
||||||
perPage: options.perPage || AddonModWorkshopProvider.PER_PAGE,
|
perPage: options.perPage || ADDON_MOD_WORKSHOP_PER_PAGE,
|
||||||
siteId: options.siteId || CoreSites.getCurrentSiteId(),
|
siteId: options.siteId || CoreSites.getCurrentSiteId(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -612,7 +582,7 @@ export class AddonModWorkshopProvider {
|
||||||
options: AddonModWorkshopGetGradesReportOptions = {},
|
options: AddonModWorkshopGetGradesReportOptions = {},
|
||||||
): Promise<AddonModWorkshopGradesData[]> {
|
): Promise<AddonModWorkshopGradesData[]> {
|
||||||
options.page = options.page ?? 0;
|
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);
|
const report = await this.getGradesReport(workshopId, options);
|
||||||
|
|
||||||
|
@ -1933,7 +1903,7 @@ export type AddonModWorkshopGetSubmissionsOptions = AddonModWorkshopUserOptions
|
||||||
* Options to pass to fetchAllGradeReports.
|
* Options to pass to fetchAllGradeReports.
|
||||||
*/
|
*/
|
||||||
export type AddonModWorkshopFetchAllGradesReportOptions = AddonModWorkshopGroupOptions & {
|
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.
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -60,4 +60,4 @@ const routes: Routes = [
|
||||||
AddonModWorkshopEditSubmissionPage,
|
AddonModWorkshopEditSubmissionPage,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class AddonModWorkshopLazyModule {}
|
export default class AddonModWorkshopLazyModule {}
|
||||||
|
|
|
@ -66,7 +66,7 @@ export async function getModWorkshopComponentModules(): Promise<unknown[]> {
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{
|
{
|
||||||
path: ADDON_MOD_WORKSHOP_PAGE_NAME,
|
path: ADDON_MOD_WORKSHOP_PAGE_NAME,
|
||||||
loadChildren: () => import('./workshop-lazy.module').then(m => m.AddonModWorkshopLazyModule),
|
loadChildren: () => import('./workshop-lazy.module'),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue