MOBILE-4616 assign: Move assign constants to a file
parent
3400d18792
commit
af4e07df36
|
@ -82,4 +82,4 @@ const routes: Routes = [
|
|||
AddonModAssignEditPage,
|
||||
],
|
||||
})
|
||||
export class AddonModAssignLazyModule {}
|
||||
export default class AddonModAssignLazyModule {}
|
||||
|
|
|
@ -23,15 +23,15 @@ import { CorePushNotificationsDelegate } from '@features/pushnotifications/servi
|
|||
import { CoreCronDelegate } from '@services/cron';
|
||||
import { CORE_SITE_SCHEMAS } from '@services/sites';
|
||||
import { AddonModAssignFeedbackModule } from './feedback/feedback.module';
|
||||
import { AddonModAssignProvider } from './services/assign';
|
||||
import { OFFLINE_SITE_SCHEMA } from './services/database/assign';
|
||||
import { AddonModAssignIndexLinkHandler } from './services/handlers/index-link';
|
||||
import { AddonModAssignListLinkHandler } from './services/handlers/list-link';
|
||||
import { AddonModAssignModuleHandler, AddonModAssignModuleHandlerService } from './services/handlers/module';
|
||||
import { AddonModAssignModuleHandler } from './services/handlers/module';
|
||||
import { AddonModAssignPrefetchHandler } from './services/handlers/prefetch';
|
||||
import { AddonModAssignPushClickHandler } from './services/handlers/push-click';
|
||||
import { AddonModAssignSyncCronHandler } from './services/handlers/sync-cron';
|
||||
import { AddonModAssignSubmissionModule } from './submission/submission.module';
|
||||
import { ADDON_MOD_ASSIGN_COMPONENT, ADDON_MOD_ASSIGN_PAGE_NAME } from './constants';
|
||||
|
||||
/**
|
||||
* Get mod assign services.
|
||||
|
@ -69,8 +69,8 @@ export async function getModAssignComponentModules(): Promise<unknown[]> {
|
|||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: AddonModAssignModuleHandlerService.PAGE_NAME,
|
||||
loadChildren: () => import('./assign-lazy.module').then(m => m.AddonModAssignLazyModule),
|
||||
path: ADDON_MOD_ASSIGN_PAGE_NAME,
|
||||
loadChildren: () => import('./assign-lazy.module'),
|
||||
},
|
||||
];
|
||||
|
||||
|
@ -97,7 +97,7 @@ const routes: Routes = [
|
|||
CoreCronDelegate.register(AddonModAssignSyncCronHandler.instance);
|
||||
CorePushNotificationsDelegate.registerClickHandler(AddonModAssignPushClickHandler.instance);
|
||||
|
||||
CoreCourseHelper.registerModuleReminderClick(AddonModAssignProvider.COMPONENT);
|
||||
CoreCourseHelper.registerModuleReminderClick(ADDON_MOD_ASSIGN_COMPONENT);
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
|
@ -29,7 +29,8 @@ import {
|
|||
} from '../services/assign';
|
||||
import { AddonModAssignHelper, AddonModAssignSubmissionFormatted } from '../services/assign-helper';
|
||||
import { AddonModAssignOffline } from '../services/assign-offline';
|
||||
import { AddonModAssignSync, AddonModAssignSyncProvider } from '../services/assign-sync';
|
||||
import { AddonModAssignSync } from '../services/assign-sync';
|
||||
import { ADDON_MOD_ASSIGN_MANUAL_SYNCED } from '../constants';
|
||||
|
||||
/**
|
||||
* Provides a collection of assignment submissions.
|
||||
|
@ -116,7 +117,7 @@ export class AddonModAssignSubmissionsSource extends CoreRoutedItemsManagerSourc
|
|||
|
||||
if (result && result.updated) {
|
||||
CoreEvents.trigger(
|
||||
AddonModAssignSyncProvider.MANUAL_SYNCED,
|
||||
ADDON_MOD_ASSIGN_MANUAL_SYNCED,
|
||||
{
|
||||
assignId: this.assign.id,
|
||||
warnings: result.warnings,
|
||||
|
|
|
@ -20,11 +20,11 @@ import {
|
|||
AddonModAssignAssign,
|
||||
AddonModAssignSubmission,
|
||||
AddonModAssignPlugin,
|
||||
AddonModAssignProvider,
|
||||
AddonModAssign,
|
||||
} from '../../services/assign';
|
||||
import { AddonModAssignHelper, AddonModAssignPluginConfig } from '../../services/assign-helper';
|
||||
import { AddonModAssignFeedbackDelegate } from '../../services/feedback-delegate';
|
||||
import { ADDON_MOD_ASSIGN_COMPONENT } from '../../constants';
|
||||
|
||||
/**
|
||||
* Component that displays an assignment feedback plugin.
|
||||
|
@ -48,7 +48,7 @@ export class AddonModAssignFeedbackPluginComponent implements OnInit {
|
|||
data?: AddonModAssignFeedbackPluginData; // Data to pass to the component.
|
||||
|
||||
// Data to render the plugin if it isn't supported.
|
||||
component = AddonModAssignProvider.COMPONENT;
|
||||
component = ADDON_MOD_ASSIGN_COMPONENT;
|
||||
text = '';
|
||||
files: CoreWSFile[] = [];
|
||||
notSupported = false;
|
||||
|
|
|
@ -32,18 +32,26 @@ import { AddonModAssignListFilterName } from '../../classes/submissions-source';
|
|||
import {
|
||||
AddonModAssign,
|
||||
AddonModAssignAssign,
|
||||
AddonModAssignProvider,
|
||||
AddonModAssignSubmissionGradingSummary,
|
||||
} from '../../services/assign';
|
||||
import { AddonModAssignOffline } from '../../services/assign-offline';
|
||||
import {
|
||||
AddonModAssignAutoSyncData,
|
||||
AddonModAssignSync,
|
||||
AddonModAssignSyncProvider,
|
||||
AddonModAssignSyncResult,
|
||||
} from '../../services/assign-sync';
|
||||
import { AddonModAssignModuleHandlerService } from '../../services/handlers/module';
|
||||
import { AddonModAssignSubmissionComponent } from '../submission/submission';
|
||||
import {
|
||||
ADDON_MOD_ASSIGN_AUTO_SYNCED,
|
||||
ADDON_MOD_ASSIGN_COMPONENT,
|
||||
ADDON_MOD_ASSIGN_GRADED_EVENT,
|
||||
ADDON_MOD_ASSIGN_PAGE_NAME,
|
||||
ADDON_MOD_ASSIGN_STARTED_EVENT,
|
||||
ADDON_MOD_ASSIGN_SUBMISSION_SAVED_EVENT,
|
||||
ADDON_MOD_ASSIGN_SUBMITTED_FOR_GRADING_EVENT,
|
||||
ADDON_MOD_ASSIGN_WARN_GROUPS_OPTIONAL,
|
||||
ADDON_MOD_ASSIGN_WARN_GROUPS_REQUIRED,
|
||||
} from '../../constants';
|
||||
|
||||
/**
|
||||
* Component that displays an assignment.
|
||||
|
@ -56,7 +64,7 @@ export class AddonModAssignIndexComponent extends CoreCourseModuleMainActivityCo
|
|||
|
||||
@ViewChild(AddonModAssignSubmissionComponent) submissionComponent?: AddonModAssignSubmissionComponent;
|
||||
|
||||
component = AddonModAssignProvider.COMPONENT;
|
||||
component = ADDON_MOD_ASSIGN_COMPONENT;
|
||||
pluginName = 'assign';
|
||||
|
||||
assign?: AddonModAssignAssign; // The assign object.
|
||||
|
@ -82,7 +90,7 @@ export class AddonModAssignIndexComponent extends CoreCourseModuleMainActivityCo
|
|||
|
||||
protected currentUserId!: number; // Current user ID.
|
||||
protected currentSite!: CoreSite; // Current site.
|
||||
protected syncEventName = AddonModAssignSyncProvider.AUTO_SYNCED;
|
||||
protected syncEventName = ADDON_MOD_ASSIGN_AUTO_SYNCED;
|
||||
|
||||
// Observers.
|
||||
protected savedObserver?: CoreEventObserver;
|
||||
|
@ -108,7 +116,7 @@ export class AddonModAssignIndexComponent extends CoreCourseModuleMainActivityCo
|
|||
|
||||
// Listen to events.
|
||||
this.savedObserver = CoreEvents.on(
|
||||
AddonModAssignProvider.SUBMISSION_SAVED_EVENT,
|
||||
ADDON_MOD_ASSIGN_SUBMISSION_SAVED_EVENT,
|
||||
(data) => {
|
||||
if (this.assign && data.assignmentId == this.assign.id && data.userId == this.currentUserId) {
|
||||
// Assignment submission saved, refresh data.
|
||||
|
@ -119,7 +127,7 @@ export class AddonModAssignIndexComponent extends CoreCourseModuleMainActivityCo
|
|||
);
|
||||
|
||||
this.submittedObserver = CoreEvents.on(
|
||||
AddonModAssignProvider.SUBMITTED_FOR_GRADING_EVENT,
|
||||
ADDON_MOD_ASSIGN_SUBMITTED_FOR_GRADING_EVENT,
|
||||
(data) => {
|
||||
if (this.assign && data.assignmentId == this.assign.id && data.userId == this.currentUserId) {
|
||||
// Assignment submitted, check completion.
|
||||
|
@ -132,14 +140,14 @@ export class AddonModAssignIndexComponent extends CoreCourseModuleMainActivityCo
|
|||
this.siteId,
|
||||
);
|
||||
|
||||
this.gradedObserver = CoreEvents.on(AddonModAssignProvider.GRADED_EVENT, (data) => {
|
||||
this.gradedObserver = CoreEvents.on(ADDON_MOD_ASSIGN_GRADED_EVENT, (data) => {
|
||||
if (this.assign && data.assignmentId == this.assign.id && data.userId == this.currentUserId) {
|
||||
// Assignment graded, refresh data.
|
||||
this.showLoadingAndRefresh(true, false);
|
||||
}
|
||||
}, this.siteId);
|
||||
|
||||
this.startedObserver = CoreEvents.on(AddonModAssignProvider.STARTED_EVENT, (data) => {
|
||||
this.startedObserver = CoreEvents.on(ADDON_MOD_ASSIGN_STARTED_EVENT, (data) => {
|
||||
if (this.assign && data.assignmentId == this.assign.id) {
|
||||
// Assignment submission started, refresh data.
|
||||
this.showLoadingAndRefresh(false, false);
|
||||
|
@ -276,10 +284,10 @@ export class AddonModAssignIndexComponent extends CoreCourseModuleMainActivityCo
|
|||
this.summary.warnofungroupedusers = 'ungroupedusers';
|
||||
} else {
|
||||
switch (this.summary.warnofungroupedusers) {
|
||||
case AddonModAssignProvider.WARN_GROUPS_REQUIRED:
|
||||
case ADDON_MOD_ASSIGN_WARN_GROUPS_REQUIRED:
|
||||
this.summary.warnofungroupedusers = 'ungroupedusers';
|
||||
break;
|
||||
case AddonModAssignProvider.WARN_GROUPS_OPTIONAL:
|
||||
case ADDON_MOD_ASSIGN_WARN_GROUPS_OPTIONAL:
|
||||
this.summary.warnofungroupedusers = 'ungroupedusersoptional';
|
||||
break;
|
||||
default:
|
||||
|
@ -311,7 +319,7 @@ export class AddonModAssignIndexComponent extends CoreCourseModuleMainActivityCo
|
|||
}
|
||||
|
||||
CoreNavigator.navigateToSitePath(
|
||||
AddonModAssignModuleHandlerService.PAGE_NAME + `/${this.courseId}/${this.module.id}/submission`,
|
||||
ADDON_MOD_ASSIGN_PAGE_NAME + `/${this.courseId}/${this.module.id}/submission`,
|
||||
{
|
||||
params,
|
||||
},
|
||||
|
|
|
@ -18,13 +18,13 @@ import {
|
|||
AddonModAssignAssign,
|
||||
AddonModAssignSubmission,
|
||||
AddonModAssignPlugin,
|
||||
AddonModAssignProvider,
|
||||
AddonModAssign,
|
||||
} from '../../services/assign';
|
||||
import { AddonModAssignHelper, AddonModAssignPluginConfig } from '../../services/assign-helper';
|
||||
import { AddonModAssignSubmissionDelegate } from '../../services/submission-delegate';
|
||||
import { CoreFileEntry } from '@services/file-helper';
|
||||
import type { AddonModAssignSubmissionPluginBaseComponent } from '@addons/mod/assign/classes/base-submission-plugin-component';
|
||||
import { ADDON_MOD_ASSIGN_COMPONENT } from '../../constants';
|
||||
|
||||
/**
|
||||
* Component that displays an assignment submission plugin.
|
||||
|
@ -47,7 +47,7 @@ export class AddonModAssignSubmissionPluginComponent implements OnInit {
|
|||
data?: AddonModAssignSubmissionPluginData; // Data to pass to the component.
|
||||
|
||||
// Data to render the plugin if it isn't supported.
|
||||
component = AddonModAssignProvider.COMPONENT;
|
||||
component = ADDON_MOD_ASSIGN_COMPONENT;
|
||||
text = '';
|
||||
files: CoreFileEntry[] = [];
|
||||
notSupported = false;
|
||||
|
|
|
@ -16,7 +16,6 @@ import { Component, Input, OnInit, OnDestroy, ViewChild, Optional, ViewChildren,
|
|||
import { CoreEvents, CoreEventObserver } from '@singletons/events';
|
||||
import { CoreSites } from '@services/sites';
|
||||
import {
|
||||
AddonModAssignProvider,
|
||||
AddonModAssignAssign,
|
||||
AddonModAssignSubmissionFeedback,
|
||||
AddonModAssignSubmissionAttempt,
|
||||
|
@ -33,7 +32,6 @@ import {
|
|||
AddonModAssignAutoSyncData,
|
||||
AddonModAssignManualSyncData,
|
||||
AddonModAssignSync,
|
||||
AddonModAssignSyncProvider,
|
||||
} from '../../services/assign-sync';
|
||||
import { CoreTabsComponent } from '@components/tabs/tabs';
|
||||
import { CoreTabComponent } from '@components/tabs/tab';
|
||||
|
@ -56,11 +54,19 @@ import { CoreError } from '@classes/errors/error';
|
|||
import { CoreGroups } from '@services/groups';
|
||||
import { CoreSync } from '@services/sync';
|
||||
import { AddonModAssignSubmissionPluginComponent } from '../submission-plugin/submission-plugin';
|
||||
import { AddonModAssignModuleHandlerService } from '../../services/handlers/module';
|
||||
import { CanLeave } from '@guards/can-leave';
|
||||
import { CoreTime } from '@singletons/time';
|
||||
import { isSafeNumber, SafeNumber } from '@/core/utils/types';
|
||||
import { CoreIonicColorNames } from '@singletons/colors';
|
||||
import {
|
||||
ADDON_MOD_ASSIGN_AUTO_SYNCED,
|
||||
ADDON_MOD_ASSIGN_COMPONENT,
|
||||
ADDON_MOD_ASSIGN_GRADED_EVENT,
|
||||
ADDON_MOD_ASSIGN_MANUAL_SYNCED,
|
||||
ADDON_MOD_ASSIGN_PAGE_NAME,
|
||||
ADDON_MOD_ASSIGN_SUBMITTED_FOR_GRADING_EVENT,
|
||||
ADDON_MOD_ASSIGN_UNLIMITED_ATTEMPTS,
|
||||
} from '../../constants';
|
||||
|
||||
/**
|
||||
* Component that displays an assignment submission.
|
||||
|
@ -137,7 +143,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
|
|||
statusNew = AddonModAssignSubmissionStatusValues.NEW;
|
||||
statusReopened = AddonModAssignSubmissionStatusValues.REOPENED;
|
||||
attemptReopenMethodNone = AddonModAssignAttemptReopenMethodValues.NONE;
|
||||
unlimitedAttempts = AddonModAssignProvider.UNLIMITED_ATTEMPTS;
|
||||
unlimitedAttempts = ADDON_MOD_ASSIGN_UNLIMITED_ATTEMPTS;
|
||||
|
||||
protected siteId: string; // Current site ID.
|
||||
protected currentUserId: number; // Current user ID.
|
||||
|
@ -161,7 +167,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
|
|||
this.maxAttemptsText = Translate.instant('addon.mod_assign.unlimitedattempts');
|
||||
|
||||
// Refresh data if this assign is synchronized and it's grading.
|
||||
const events = [AddonModAssignSyncProvider.AUTO_SYNCED, AddonModAssignSyncProvider.MANUAL_SYNCED];
|
||||
const events = [ADDON_MOD_ASSIGN_AUTO_SYNCED, ADDON_MOD_ASSIGN_MANUAL_SYNCED];
|
||||
this.syncObserver = CoreEvents.onMultiple<AddonModAssignAutoSyncData | AddonModAssignManualSyncData>(
|
||||
events,
|
||||
async (data) => {
|
||||
|
@ -341,7 +347,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
|
|||
|
||||
if (!this.assign.submissiondrafts && this.userSubmission) {
|
||||
// No drafts allowed, so it was submitted. Trigger event.
|
||||
CoreEvents.trigger(AddonModAssignProvider.SUBMITTED_FOR_GRADING_EVENT, {
|
||||
CoreEvents.trigger(ADDON_MOD_ASSIGN_SUBMITTED_FOR_GRADING_EVENT, {
|
||||
assignmentId: this.assign.id,
|
||||
submissionId: this.userSubmission.id,
|
||||
userId: this.currentUserId,
|
||||
|
@ -389,7 +395,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
|
|||
}
|
||||
|
||||
CoreNavigator.navigateToSitePath(
|
||||
AddonModAssignModuleHandlerService.PAGE_NAME + '/' + this.courseId + '/' + this.moduleId + '/edit',
|
||||
ADDON_MOD_ASSIGN_PAGE_NAME + '/' + this.courseId + '/' + this.moduleId + '/edit',
|
||||
{
|
||||
params: {
|
||||
blindId: this.blindId,
|
||||
|
@ -528,7 +534,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
|
|||
const result = await AddonModAssignSync.syncAssign(this.assign.id);
|
||||
|
||||
if (result && result.updated) {
|
||||
CoreEvents.trigger(AddonModAssignSyncProvider.MANUAL_SYNCED, {
|
||||
CoreEvents.trigger(ADDON_MOD_ASSIGN_MANUAL_SYNCED, {
|
||||
assignId: this.assign.id,
|
||||
warnings: result.warnings,
|
||||
gradesBlocked: result.gradesBlocked,
|
||||
|
@ -703,7 +709,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
|
|||
await this.treatGradeInfo(assign);
|
||||
|
||||
const isManual = assign.attemptreopenmethod == AddonModAssignAttemptReopenMethodValues.MANUAL;
|
||||
const isUnlimited = assign.maxattempts == AddonModAssignProvider.UNLIMITED_ATTEMPTS;
|
||||
const isUnlimited = assign.maxattempts == ADDON_MOD_ASSIGN_UNLIMITED_ATTEMPTS;
|
||||
const isLessThanMaxAttempts = !!this.userSubmission && (this.userSubmission.attemptnumber < (assign.maxattempts - 1));
|
||||
|
||||
this.allowAddAttempt = isManual && (!this.userSubmission || isUnlimited || isLessThanMaxAttempts);
|
||||
|
@ -864,7 +870,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
|
|||
Translate.instant('core.grades.grade'),
|
||||
this.feedback.gradefordisplay,
|
||||
{
|
||||
component: AddonModAssignProvider.COMPONENT,
|
||||
component: ADDON_MOD_ASSIGN_COMPONENT,
|
||||
componentId: this.moduleId,
|
||||
},
|
||||
);
|
||||
|
@ -903,7 +909,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
|
|||
);
|
||||
|
||||
// Submitted, trigger event.
|
||||
CoreEvents.trigger(AddonModAssignProvider.SUBMITTED_FOR_GRADING_EVENT, {
|
||||
CoreEvents.trigger(ADDON_MOD_ASSIGN_SUBMITTED_FOR_GRADING_EVENT, {
|
||||
assignmentId: this.assign.id,
|
||||
submissionId: this.userSubmission.id,
|
||||
userId: this.currentUserId,
|
||||
|
@ -977,7 +983,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
|
|||
// Invalidate and refresh data.
|
||||
this.invalidateAndRefresh(true);
|
||||
|
||||
CoreEvents.trigger(AddonModAssignProvider.GRADED_EVENT, {
|
||||
CoreEvents.trigger(ADDON_MOD_ASSIGN_GRADED_EVENT, {
|
||||
assignmentId: this.assign.id,
|
||||
submissionId: this.submitId,
|
||||
userId: this.currentUserId,
|
||||
|
@ -1228,9 +1234,9 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
|
|||
const syncId = AddonModAssignSync.getGradeSyncId(this.assign.id, this.submitId);
|
||||
|
||||
if (block) {
|
||||
CoreSync.blockOperation(AddonModAssignProvider.COMPONENT, syncId);
|
||||
CoreSync.blockOperation(ADDON_MOD_ASSIGN_COMPONENT, syncId);
|
||||
} else {
|
||||
CoreSync.unblockOperation(AddonModAssignProvider.COMPONENT, syncId);
|
||||
CoreSync.unblockOperation(ADDON_MOD_ASSIGN_COMPONENT, syncId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,3 +13,20 @@
|
|||
// limitations under the License.
|
||||
|
||||
export const ADDON_MOD_ASSIGN_FEATURE_NAME = 'CoreCourseModuleDelegate_AddonModAssign';
|
||||
|
||||
export const ADDON_MOD_ASSIGN_COMPONENT = 'mmaModAssign';
|
||||
export const ADDON_MOD_ASSIGN_PAGE_NAME = 'mod_assign';
|
||||
|
||||
export const ADDON_MOD_ASSIGN_UNLIMITED_ATTEMPTS = -1;
|
||||
|
||||
// Group submissions warnings.
|
||||
export const ADDON_MOD_ASSIGN_WARN_GROUPS_REQUIRED = 'warnrequired';
|
||||
export const ADDON_MOD_ASSIGN_WARN_GROUPS_OPTIONAL = 'warnoptional';
|
||||
|
||||
// Events.
|
||||
export const ADDON_MOD_ASSIGN_SUBMISSION_SAVED_EVENT = 'addon_mod_assign_submission_saved';
|
||||
export const ADDON_MOD_ASSIGN_SUBMITTED_FOR_GRADING_EVENT = 'addon_mod_assign_submitted_for_grading';
|
||||
export const ADDON_MOD_ASSIGN_GRADED_EVENT = 'addon_mod_assign_graded';
|
||||
export const ADDON_MOD_ASSIGN_STARTED_EVENT = 'addon_mod_assign_started';
|
||||
export const ADDON_MOD_ASSIGN_AUTO_SYNCED = 'addon_mod_assign_autom_synced';
|
||||
export const ADDON_MOD_ASSIGN_MANUAL_SYNCED = 'addon_mod_assign_manual_synced';
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
import { Component, OnInit, ElementRef } from '@angular/core';
|
||||
import { FormBuilder, FormControl } from '@angular/forms';
|
||||
import { AddonModAssign, AddonModAssignProvider } from '@addons/mod/assign/services/assign';
|
||||
import { AddonModAssign } from '@addons/mod/assign/services/assign';
|
||||
import { CoreTextUtils } from '@services/utils/text';
|
||||
import {
|
||||
AddonModAssignFeedbackCommentsDraftData,
|
||||
|
@ -26,6 +26,7 @@ import { AddonModAssignOffline } from '@addons/mod/assign/services/assign-offlin
|
|||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { AddonModAssignFeedbackPluginBaseComponent } from '@addons/mod/assign/classes/base-feedback-plugin-component';
|
||||
import { ContextLevel } from '@/core/constants';
|
||||
import { ADDON_MOD_ASSIGN_COMPONENT } from '@addons/mod/assign/constants';
|
||||
/**
|
||||
* Component to render a comments feedback plugin.
|
||||
*/
|
||||
|
@ -36,7 +37,7 @@ import { ContextLevel } from '@/core/constants';
|
|||
export class AddonModAssignFeedbackCommentsComponent extends AddonModAssignFeedbackPluginBaseComponent implements OnInit {
|
||||
|
||||
control?: FormControl<string>;
|
||||
component = AddonModAssignProvider.COMPONENT;
|
||||
component = ADDON_MOD_ASSIGN_COMPONENT;
|
||||
text = '';
|
||||
isSent = false;
|
||||
loaded = false;
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
// limitations under the License.
|
||||
|
||||
import { AddonModAssignFeedbackPluginBaseComponent } from '@addons/mod/assign/classes/base-feedback-plugin-component';
|
||||
import { AddonModAssignProvider, AddonModAssign } from '@addons/mod/assign/services/assign';
|
||||
import { ADDON_MOD_ASSIGN_COMPONENT } from '@addons/mod/assign/constants';
|
||||
import { AddonModAssign } from '@addons/mod/assign/services/assign';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { CoreWSFile } from '@services/ws';
|
||||
|
||||
|
@ -26,7 +27,7 @@ import { CoreWSFile } from '@services/ws';
|
|||
})
|
||||
export class AddonModAssignFeedbackEditPdfComponent extends AddonModAssignFeedbackPluginBaseComponent implements OnInit {
|
||||
|
||||
component = AddonModAssignProvider.COMPONENT;
|
||||
component = ADDON_MOD_ASSIGN_COMPONENT;
|
||||
files: CoreWSFile[] = [];
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
// limitations under the License.
|
||||
|
||||
import { AddonModAssignFeedbackPluginBaseComponent } from '@addons/mod/assign/classes/base-feedback-plugin-component';
|
||||
import { AddonModAssign, AddonModAssignProvider } from '@addons/mod/assign/services/assign';
|
||||
import { ADDON_MOD_ASSIGN_COMPONENT } from '@addons/mod/assign/constants';
|
||||
import { AddonModAssign } from '@addons/mod/assign/services/assign';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { CoreWSFile } from '@services/ws';
|
||||
|
||||
|
@ -26,7 +27,7 @@ import { CoreWSFile } from '@services/ws';
|
|||
})
|
||||
export class AddonModAssignFeedbackFileComponent extends AddonModAssignFeedbackPluginBaseComponent implements OnInit {
|
||||
|
||||
component = AddonModAssignProvider.COMPONENT;
|
||||
component = ADDON_MOD_ASSIGN_COMPONENT;
|
||||
files: CoreWSFile[] = [];
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,7 +27,6 @@ import { CoreEvents } from '@singletons/events';
|
|||
import {
|
||||
AddonModAssignAssign,
|
||||
AddonModAssignSubmission,
|
||||
AddonModAssignProvider,
|
||||
AddonModAssign,
|
||||
AddonModAssignSubmissionStatusOptions,
|
||||
AddonModAssignGetSubmissionStatusWSResponse,
|
||||
|
@ -40,6 +39,12 @@ import { AddonModAssignSync } from '../../services/assign-sync';
|
|||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CoreWSExternalFile } from '@services/ws';
|
||||
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
|
||||
import {
|
||||
ADDON_MOD_ASSIGN_COMPONENT,
|
||||
ADDON_MOD_ASSIGN_STARTED_EVENT,
|
||||
ADDON_MOD_ASSIGN_SUBMISSION_SAVED_EVENT,
|
||||
ADDON_MOD_ASSIGN_SUBMITTED_FOR_GRADING_EVENT,
|
||||
} from '../../constants';
|
||||
|
||||
/**
|
||||
* Page that allows adding or editing an assigment submission.
|
||||
|
@ -65,7 +70,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave {
|
|||
timeLimitEndTime = 0; // If time limit is enabled, the end time for the timer.
|
||||
activityInstructions?: string; // Activity instructions.
|
||||
introAttachments?: CoreWSExternalFile[]; // Intro attachments.
|
||||
component = AddonModAssignProvider.COMPONENT;
|
||||
component = ADDON_MOD_ASSIGN_COMPONENT;
|
||||
|
||||
protected userId: number; // User doing the submission.
|
||||
protected isBlind = false; // Whether blind is used.
|
||||
|
@ -144,7 +149,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave {
|
|||
|
||||
if (!this.isDestroyed) {
|
||||
// Block the assignment.
|
||||
CoreSync.blockOperation(AddonModAssignProvider.COMPONENT, this.assign.id);
|
||||
CoreSync.blockOperation(ADDON_MOD_ASSIGN_COMPONENT, this.assign.id);
|
||||
}
|
||||
|
||||
// Wait for sync to be over (if any).
|
||||
|
@ -276,7 +281,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave {
|
|||
|
||||
await AddonModAssign.startSubmission(this.assign.id);
|
||||
|
||||
CoreEvents.trigger(AddonModAssignProvider.STARTED_EVENT, {
|
||||
CoreEvents.trigger(ADDON_MOD_ASSIGN_STARTED_EVENT, {
|
||||
assignmentId: this.assign.id,
|
||||
}, CoreSites.getCurrentSiteId());
|
||||
|
||||
|
@ -453,7 +458,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave {
|
|||
CoreForms.triggerFormSubmittedEvent(this.formElement, sent, CoreSites.getCurrentSiteId());
|
||||
|
||||
CoreEvents.trigger(
|
||||
AddonModAssignProvider.SUBMISSION_SAVED_EVENT,
|
||||
ADDON_MOD_ASSIGN_SUBMISSION_SAVED_EVENT,
|
||||
{
|
||||
assignmentId: this.assign!.id,
|
||||
submissionId: this.userSubmission!.id,
|
||||
|
@ -465,7 +470,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave {
|
|||
if (!this.assign!.submissiondrafts) {
|
||||
// No drafts allowed, so it was submitted. Trigger event.
|
||||
CoreEvents.trigger(
|
||||
AddonModAssignProvider.SUBMITTED_FOR_GRADING_EVENT,
|
||||
ADDON_MOD_ASSIGN_SUBMITTED_FOR_GRADING_EVENT,
|
||||
{
|
||||
assignmentId: this.assign!.id,
|
||||
submissionId: this.userSubmission!.id,
|
||||
|
@ -500,7 +505,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave {
|
|||
|
||||
// Unblock the assignment.
|
||||
if (this.assign) {
|
||||
CoreSync.unblockOperation(AddonModAssignProvider.COMPONENT, this.assign.id);
|
||||
CoreSync.unblockOperation(ADDON_MOD_ASSIGN_COMPONENT, this.assign.id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,13 +27,13 @@ import {
|
|||
AddonModAssignSubmissionForList,
|
||||
AddonModAssignSubmissionsSource,
|
||||
} from '../../classes/submissions-source';
|
||||
import { AddonModAssignAssign, AddonModAssignProvider } from '../../services/assign';
|
||||
import { AddonModAssignAssign } from '../../services/assign';
|
||||
import {
|
||||
AddonModAssignSyncProvider,
|
||||
AddonModAssignManualSyncData,
|
||||
AddonModAssignAutoSyncData,
|
||||
} from '../../services/assign-sync';
|
||||
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
|
||||
import { ADDON_MOD_ASSIGN_AUTO_SYNCED, ADDON_MOD_ASSIGN_GRADED_EVENT, ADDON_MOD_ASSIGN_MANUAL_SYNCED } from '../../constants';
|
||||
|
||||
/**
|
||||
* Page that displays a list of submissions of an assignment.
|
||||
|
@ -56,7 +56,7 @@ export class AddonModAssignSubmissionListPage implements AfterViewInit, OnDestro
|
|||
constructor() {
|
||||
// Update data if some grade changes.
|
||||
this.gradedObserver = CoreEvents.on(
|
||||
AddonModAssignProvider.GRADED_EVENT,
|
||||
ADDON_MOD_ASSIGN_GRADED_EVENT,
|
||||
(data) => {
|
||||
if (
|
||||
this.submissions.loaded &&
|
||||
|
@ -72,7 +72,7 @@ export class AddonModAssignSubmissionListPage implements AfterViewInit, OnDestro
|
|||
);
|
||||
|
||||
// Refresh data if this assign is synchronized.
|
||||
const events = [AddonModAssignSyncProvider.AUTO_SYNCED, AddonModAssignSyncProvider.MANUAL_SYNCED];
|
||||
const events = [ADDON_MOD_ASSIGN_AUTO_SYNCED, ADDON_MOD_ASSIGN_MANUAL_SYNCED];
|
||||
this.syncObserver = CoreEvents.onMultiple<AddonModAssignAutoSyncData | AddonModAssignManualSyncData>(
|
||||
events,
|
||||
(data) => {
|
||||
|
|
|
@ -17,7 +17,6 @@ import { CoreFileUploader, CoreFileUploaderStoreFilesResult } from '@features/fi
|
|||
import { CoreSites, CoreSitesCommonWSOptions } from '@services/sites';
|
||||
import { FileEntry, DirectoryEntry } from '@awesome-cordova-plugins/file/ngx';
|
||||
import {
|
||||
AddonModAssignProvider,
|
||||
AddonModAssignAssign,
|
||||
AddonModAssignSubmission,
|
||||
AddonModAssignParticipant,
|
||||
|
@ -37,6 +36,7 @@ import { AddonModAssignFeedbackDelegate } from './feedback-delegate';
|
|||
import { makeSingleton } from '@singletons';
|
||||
import { CoreFormFields } from '@singletons/form';
|
||||
import { CoreFileEntry } from '@services/file-helper';
|
||||
import { ADDON_MOD_ASSIGN_COMPONENT } from '../constants';
|
||||
|
||||
/**
|
||||
* Service that provides some helper functions for assign.
|
||||
|
@ -650,7 +650,7 @@ export class AddonModAssignHelperProvider {
|
|||
* @returns Promise resolved with the itemId.
|
||||
*/
|
||||
uploadFile(assignId: number, file: CoreFileEntry, itemId?: number, siteId?: string): Promise<number> {
|
||||
return CoreFileUploader.uploadOrReuploadFile(file, itemId, AddonModAssignProvider.COMPONENT, assignId, siteId);
|
||||
return CoreFileUploader.uploadOrReuploadFile(file, itemId, ADDON_MOD_ASSIGN_COMPONENT, assignId, siteId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -664,7 +664,7 @@ export class AddonModAssignHelperProvider {
|
|||
* @returns Promise resolved with the itemId.
|
||||
*/
|
||||
uploadFiles(assignId: number, files: CoreFileEntry[], siteId?: string): Promise<number> {
|
||||
return CoreFileUploader.uploadOrReuploadFiles(files, AddonModAssignProvider.COMPONENT, assignId, siteId);
|
||||
return CoreFileUploader.uploadOrReuploadFiles(files, ADDON_MOD_ASSIGN_COMPONENT, assignId, siteId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,7 +17,6 @@ import { CoreEvents } from '@singletons/events';
|
|||
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
|
||||
import { CoreSyncBlockedError } from '@classes/base-sync';
|
||||
import {
|
||||
AddonModAssignProvider,
|
||||
AddonModAssignAssign,
|
||||
AddonModAssignSubmission,
|
||||
AddonModAssign,
|
||||
|
@ -40,6 +39,7 @@ import { CoreNetworkError } from '@classes/errors/network-error';
|
|||
import { CoreGradesFormattedItem, CoreGradesHelper } from '@features/grades/services/grades-helper';
|
||||
import { AddonModAssignSubmissionDelegate } from './submission-delegate';
|
||||
import { AddonModAssignFeedbackDelegate } from './feedback-delegate';
|
||||
import { ADDON_MOD_ASSIGN_AUTO_SYNCED, ADDON_MOD_ASSIGN_COMPONENT } from '../constants';
|
||||
|
||||
/**
|
||||
* Service to sync assigns.
|
||||
|
@ -47,9 +47,6 @@ import { AddonModAssignFeedbackDelegate } from './feedback-delegate';
|
|||
@Injectable({ providedIn: 'root' })
|
||||
export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvider<AddonModAssignSyncResult> {
|
||||
|
||||
static readonly AUTO_SYNCED = 'addon_mod_assign_autom_synced';
|
||||
static readonly MANUAL_SYNCED = 'addon_mod_assign_manual_synced';
|
||||
|
||||
protected componentTranslatableString = 'assign';
|
||||
|
||||
constructor() {
|
||||
|
@ -129,7 +126,7 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid
|
|||
: await this.syncAssignIfNeeded(assignId, siteId);
|
||||
|
||||
if (result?.updated) {
|
||||
CoreEvents.trigger(AddonModAssignSyncProvider.AUTO_SYNCED, {
|
||||
CoreEvents.trigger(ADDON_MOD_ASSIGN_AUTO_SYNCED, {
|
||||
assignId: assignId,
|
||||
warnings: result.warnings,
|
||||
gradesBlocked: result.gradesBlocked,
|
||||
|
@ -170,7 +167,7 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid
|
|||
}
|
||||
|
||||
// Verify that assign isn't blocked.
|
||||
if (CoreSync.isBlocked(AddonModAssignProvider.COMPONENT, assignId, siteId)) {
|
||||
if (CoreSync.isBlocked(ADDON_MOD_ASSIGN_COMPONENT, assignId, siteId)) {
|
||||
this.logger.debug('Cannot sync assign ' + assignId + ' because it is blocked.');
|
||||
|
||||
throw new CoreSyncBlockedError(Translate.instant('core.errorsyncblocked', { $a: this.componentTranslate }));
|
||||
|
@ -193,7 +190,7 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid
|
|||
protected async performSyncAssign(assignId: number, siteId: string): Promise<AddonModAssignSyncResult> {
|
||||
// Sync offline logs.
|
||||
await CoreUtils.ignoreErrors(
|
||||
CoreCourseLogHelper.syncActivity(AddonModAssignProvider.COMPONENT, assignId, siteId),
|
||||
CoreCourseLogHelper.syncActivity(ADDON_MOD_ASSIGN_COMPONENT, assignId, siteId),
|
||||
);
|
||||
|
||||
const result: AddonModAssignSyncResult = {
|
||||
|
@ -433,7 +430,7 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid
|
|||
};
|
||||
|
||||
// Check if this grade sync is blocked.
|
||||
if (CoreSync.isBlocked(AddonModAssignProvider.COMPONENT, syncId, siteId)) {
|
||||
if (CoreSync.isBlocked(ADDON_MOD_ASSIGN_COMPONENT, syncId, siteId)) {
|
||||
this.logger.error(`Cannot sync grade for assign ${assign.id} and user ${userId} because it is blocked.!!!!`);
|
||||
|
||||
throw new CoreSyncBlockedError(Translate.instant(
|
||||
|
|
|
@ -31,14 +31,21 @@ import { AddonModAssignSubmissionDelegate } from './submission-delegate';
|
|||
import { CoreComments } from '@features/comments/services/comments';
|
||||
import { AddonModAssignSubmissionFormatted } from './assign-helper';
|
||||
import { CoreWSError } from '@classes/errors/wserror';
|
||||
import { AddonModAssignAutoSyncData, AddonModAssignManualSyncData, AddonModAssignSyncProvider } from './assign-sync';
|
||||
import { AddonModAssignAutoSyncData, AddonModAssignManualSyncData } from './assign-sync';
|
||||
import { CoreFormFields } from '@singletons/form';
|
||||
import { CoreFileHelper } from '@services/file-helper';
|
||||
import { CoreIonicColorNames } from '@singletons/colors';
|
||||
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
|
||||
import { ContextLevel } from '@/core/constants';
|
||||
|
||||
const ROOT_CACHE_KEY = 'mmaModAssign:';
|
||||
import {
|
||||
ADDON_MOD_ASSIGN_AUTO_SYNCED,
|
||||
ADDON_MOD_ASSIGN_COMPONENT,
|
||||
ADDON_MOD_ASSIGN_GRADED_EVENT,
|
||||
ADDON_MOD_ASSIGN_MANUAL_SYNCED,
|
||||
ADDON_MOD_ASSIGN_STARTED_EVENT,
|
||||
ADDON_MOD_ASSIGN_SUBMISSION_SAVED_EVENT,
|
||||
ADDON_MOD_ASSIGN_SUBMITTED_FOR_GRADING_EVENT,
|
||||
} from '../constants';
|
||||
|
||||
declare module '@singletons/events' {
|
||||
|
||||
|
@ -48,12 +55,12 @@ declare module '@singletons/events' {
|
|||
* @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
|
||||
*/
|
||||
export interface CoreEventsData {
|
||||
[AddonModAssignProvider.SUBMISSION_SAVED_EVENT]: AddonModAssignSubmissionSavedEventData;
|
||||
[AddonModAssignProvider.SUBMITTED_FOR_GRADING_EVENT]: AddonModAssignSubmittedForGradingEventData;
|
||||
[AddonModAssignProvider.GRADED_EVENT]: AddonModAssignGradedEventData;
|
||||
[AddonModAssignProvider.STARTED_EVENT]: AddonModAssignStartedEventData;
|
||||
[AddonModAssignSyncProvider.MANUAL_SYNCED]: AddonModAssignManualSyncData;
|
||||
[AddonModAssignSyncProvider.AUTO_SYNCED]: AddonModAssignAutoSyncData;
|
||||
[ADDON_MOD_ASSIGN_SUBMISSION_SAVED_EVENT]: AddonModAssignSubmissionSavedEventData;
|
||||
[ADDON_MOD_ASSIGN_SUBMITTED_FOR_GRADING_EVENT]: AddonModAssignSubmittedForGradingEventData;
|
||||
[ADDON_MOD_ASSIGN_GRADED_EVENT]: AddonModAssignGradedEventData;
|
||||
[ADDON_MOD_ASSIGN_STARTED_EVENT]: AddonModAssignStartedEventData;
|
||||
[ADDON_MOD_ASSIGN_MANUAL_SYNCED]: AddonModAssignManualSyncData;
|
||||
[ADDON_MOD_ASSIGN_AUTO_SYNCED]: AddonModAssignAutoSyncData;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -64,19 +71,7 @@ declare module '@singletons/events' {
|
|||
@Injectable({ providedIn: 'root' })
|
||||
export class AddonModAssignProvider {
|
||||
|
||||
static readonly COMPONENT = 'mmaModAssign';
|
||||
static readonly SUBMISSION_COMPONENT = 'mmaModAssignSubmission';
|
||||
static readonly UNLIMITED_ATTEMPTS = -1;
|
||||
|
||||
// Group submissions warnings.
|
||||
static readonly WARN_GROUPS_REQUIRED = 'warnrequired';
|
||||
static readonly WARN_GROUPS_OPTIONAL = 'warnoptional';
|
||||
|
||||
// Events.
|
||||
static readonly SUBMISSION_SAVED_EVENT = 'addon_mod_assign_submission_saved';
|
||||
static readonly SUBMITTED_FOR_GRADING_EVENT = 'addon_mod_assign_submitted_for_grading';
|
||||
static readonly GRADED_EVENT = 'addon_mod_assign_graded';
|
||||
static readonly STARTED_EVENT = 'addon_mod_assign_started';
|
||||
protected static readonly ROOT_CACHE_KEY = 'mmaModAssign:';
|
||||
|
||||
/**
|
||||
* Check if the user can submit in offline. This should only be used if submissionStatus.lastattempt.cansubmit cannot
|
||||
|
@ -179,7 +174,7 @@ export class AddonModAssignProvider {
|
|||
const preSets: CoreSiteWSPreSets = {
|
||||
cacheKey: this.getAssignmentCacheKey(courseId),
|
||||
updateFrequency: CoreSite.FREQUENCY_RARELY,
|
||||
component: AddonModAssignProvider.COMPONENT,
|
||||
component: ADDON_MOD_ASSIGN_COMPONENT,
|
||||
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
|
||||
};
|
||||
|
||||
|
@ -226,7 +221,7 @@ export class AddonModAssignProvider {
|
|||
* @returns Cache key.
|
||||
*/
|
||||
protected getAssignmentCacheKey(courseId: number): string {
|
||||
return ROOT_CACHE_KEY + 'assignment:' + courseId;
|
||||
return AddonModAssignProvider.ROOT_CACHE_KEY + 'assignment:' + courseId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -251,7 +246,7 @@ export class AddonModAssignProvider {
|
|||
const preSets: CoreSiteWSPreSets = {
|
||||
cacheKey: this.getAssignmentUserMappingsCacheKey(assignId),
|
||||
updateFrequency: CoreSite.FREQUENCY_OFTEN,
|
||||
component: AddonModAssignProvider.COMPONENT,
|
||||
component: ADDON_MOD_ASSIGN_COMPONENT,
|
||||
componentId: options.cmId,
|
||||
...CoreSites.getReadingStrategyPreSets(options.readingStrategy),
|
||||
};
|
||||
|
@ -279,7 +274,7 @@ export class AddonModAssignProvider {
|
|||
* @returns Cache key.
|
||||
*/
|
||||
protected getAssignmentUserMappingsCacheKey(assignId: number): string {
|
||||
return ROOT_CACHE_KEY + 'usermappings:' + assignId;
|
||||
return AddonModAssignProvider.ROOT_CACHE_KEY + 'usermappings:' + assignId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -297,7 +292,7 @@ export class AddonModAssignProvider {
|
|||
};
|
||||
const preSets: CoreSiteWSPreSets = {
|
||||
cacheKey: this.getAssignmentGradesCacheKey(assignId),
|
||||
component: AddonModAssignProvider.COMPONENT,
|
||||
component: ADDON_MOD_ASSIGN_COMPONENT,
|
||||
componentId: options.cmId,
|
||||
...CoreSites.getReadingStrategyPreSets(options.readingStrategy),
|
||||
};
|
||||
|
@ -326,7 +321,7 @@ export class AddonModAssignProvider {
|
|||
* @returns Cache key.
|
||||
*/
|
||||
protected getAssignmentGradesCacheKey(assignId: number): string {
|
||||
return ROOT_CACHE_KEY + 'assigngrades:' + assignId;
|
||||
return AddonModAssignProvider.ROOT_CACHE_KEY + 'assigngrades:' + assignId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -461,7 +456,7 @@ export class AddonModAssignProvider {
|
|||
const preSets: CoreSiteWSPreSets = {
|
||||
cacheKey: this.getSubmissionsCacheKey(assignId),
|
||||
updateFrequency: CoreSite.FREQUENCY_OFTEN,
|
||||
component: AddonModAssignProvider.COMPONENT,
|
||||
component: ADDON_MOD_ASSIGN_COMPONENT,
|
||||
componentId: options.cmId,
|
||||
...CoreSites.getReadingStrategyPreSets(options.readingStrategy),
|
||||
};
|
||||
|
@ -489,7 +484,7 @@ export class AddonModAssignProvider {
|
|||
* @returns Cache key.
|
||||
*/
|
||||
protected getSubmissionsCacheKey(assignId: number): string {
|
||||
return ROOT_CACHE_KEY + 'submissions:' + assignId;
|
||||
return AddonModAssignProvider.ROOT_CACHE_KEY + 'submissions:' + assignId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -529,7 +524,7 @@ export class AddonModAssignProvider {
|
|||
getCacheUsingCacheKey: true,
|
||||
filter: options.filter,
|
||||
rewriteurls: options.filter,
|
||||
component: AddonModAssignProvider.COMPONENT,
|
||||
component: ADDON_MOD_ASSIGN_COMPONENT,
|
||||
componentId: options.cmId,
|
||||
// Don't cache when getting text without filters.
|
||||
// @todo Change this to support offline editing.
|
||||
|
@ -659,7 +654,7 @@ export class AddonModAssignProvider {
|
|||
const preSets: CoreSiteWSPreSets = {
|
||||
cacheKey: this.listParticipantsCacheKey(assignId, groupId),
|
||||
updateFrequency: CoreSite.FREQUENCY_OFTEN,
|
||||
component: AddonModAssignProvider.COMPONENT,
|
||||
component: ADDON_MOD_ASSIGN_COMPONENT,
|
||||
componentId: options.cmId,
|
||||
...CoreSites.getReadingStrategyPreSets(options.readingStrategy),
|
||||
};
|
||||
|
@ -685,7 +680,7 @@ export class AddonModAssignProvider {
|
|||
* @returns Cache key.
|
||||
*/
|
||||
protected listParticipantsPrefixCacheKey(assignId: number): string {
|
||||
return ROOT_CACHE_KEY + 'participants:' + assignId;
|
||||
return AddonModAssignProvider.ROOT_CACHE_KEY + 'participants:' + assignId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -891,7 +886,7 @@ export class AddonModAssignProvider {
|
|||
await CoreCourseLogHelper.log(
|
||||
'mod_assign_view_submission_status',
|
||||
params,
|
||||
AddonModAssignProvider.COMPONENT,
|
||||
ADDON_MOD_ASSIGN_COMPONENT,
|
||||
assignid,
|
||||
siteId,
|
||||
);
|
||||
|
@ -912,7 +907,7 @@ export class AddonModAssignProvider {
|
|||
await CoreCourseLogHelper.log(
|
||||
'mod_assign_view_grading_table',
|
||||
params,
|
||||
AddonModAssignProvider.COMPONENT,
|
||||
ADDON_MOD_ASSIGN_COMPONENT,
|
||||
assignid,
|
||||
siteId,
|
||||
);
|
||||
|
@ -933,7 +928,7 @@ export class AddonModAssignProvider {
|
|||
await CoreCourseLogHelper.log(
|
||||
'mod_assign_view_assign',
|
||||
params,
|
||||
AddonModAssignProvider.COMPONENT,
|
||||
ADDON_MOD_ASSIGN_COMPONENT,
|
||||
assignid,
|
||||
siteId,
|
||||
);
|
||||
|
|
|
@ -17,6 +17,7 @@ import { Injectable, Type } from '@angular/core';
|
|||
import { CoreCourseModuleHandler } from '@features/course/services/module-delegate';
|
||||
import { makeSingleton } from '@singletons';
|
||||
import { CoreModuleHandlerBase } from '@features/course/classes/module-base-handler';
|
||||
import { ADDON_MOD_ASSIGN_PAGE_NAME } from '../../constants';
|
||||
|
||||
/**
|
||||
* Handler to support assign modules.
|
||||
|
@ -24,11 +25,9 @@ import { CoreModuleHandlerBase } from '@features/course/classes/module-base-hand
|
|||
@Injectable({ providedIn: 'root' })
|
||||
export class AddonModAssignModuleHandlerService extends CoreModuleHandlerBase implements CoreCourseModuleHandler {
|
||||
|
||||
static readonly PAGE_NAME = 'mod_assign';
|
||||
|
||||
name = 'AddonModAssign';
|
||||
modName = 'assign';
|
||||
protected pageName = AddonModAssignModuleHandlerService.PAGE_NAME;
|
||||
protected pageName = ADDON_MOD_ASSIGN_PAGE_NAME;
|
||||
|
||||
supportedFeatures = {
|
||||
[CoreConstants.FEATURE_GROUPS]: true,
|
||||
|
|
|
@ -18,7 +18,6 @@ import { makeSingleton } from '@singletons';
|
|||
import {
|
||||
AddonModAssign,
|
||||
AddonModAssignAssign,
|
||||
AddonModAssignProvider,
|
||||
AddonModAssignSubmission,
|
||||
AddonModAssignSubmissionStatusOptions,
|
||||
} from '../assign';
|
||||
|
@ -35,6 +34,7 @@ import { AddonModAssignSync, AddonModAssignSyncResult } from '../assign-sync';
|
|||
import { CoreUser } from '@features/user/services/user';
|
||||
import { CoreGradesHelper } from '@features/grades/services/grades-helper';
|
||||
import { CoreCourses } from '@features/courses/services/courses';
|
||||
import { ADDON_MOD_ASSIGN_COMPONENT } from '../../constants';
|
||||
|
||||
/**
|
||||
* Handler to prefetch assigns.
|
||||
|
@ -44,7 +44,7 @@ export class AddonModAssignPrefetchHandlerService extends CoreCourseActivityPref
|
|||
|
||||
name = 'AddonModAssign';
|
||||
modName = 'assign';
|
||||
component = AddonModAssignProvider.COMPONENT;
|
||||
component = ADDON_MOD_ASSIGN_COMPONENT;
|
||||
updatesNames = /^configuration$|^.*files$|^submissions$|^grades$|^gradeitems$|^outcomes$|^comments$/;
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import { AddonModAssign, AddonModAssignProvider } from '@addons/mod/assign/services/assign';
|
||||
import { AddonModAssign } from '@addons/mod/assign/services/assign';
|
||||
import { AddonModAssignHelper } from '@addons/mod/assign/services/assign-helper';
|
||||
import { AddonModAssignOffline } from '@addons/mod/assign/services/assign-offline';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
@ -23,6 +23,7 @@ import { AddonModAssignSubmissionFileHandlerService } from '../services/handler'
|
|||
import { FileEntry } from '@awesome-cordova-plugins/file/ngx';
|
||||
import { AddonModAssignSubmissionPluginBaseComponent } from '@addons/mod/assign/classes/base-submission-plugin-component';
|
||||
import { CoreFileEntry } from '@services/file-helper';
|
||||
import { ADDON_MOD_ASSIGN_COMPONENT } from '@addons/mod/assign/constants';
|
||||
|
||||
/**
|
||||
* Component to render a file submission plugin.
|
||||
|
@ -33,7 +34,7 @@ import { CoreFileEntry } from '@services/file-helper';
|
|||
})
|
||||
export class AddonModAssignSubmissionFileComponent extends AddonModAssignSubmissionPluginBaseComponent implements OnInit {
|
||||
|
||||
component = AddonModAssignProvider.COMPONENT;
|
||||
component = ADDON_MOD_ASSIGN_COMPONENT;
|
||||
files: CoreFileEntry[] = [];
|
||||
|
||||
maxSize?: number;
|
||||
|
|
|
@ -16,7 +16,6 @@ import {
|
|||
AddonModAssignAssign,
|
||||
AddonModAssignSubmission,
|
||||
AddonModAssignPlugin,
|
||||
AddonModAssignProvider,
|
||||
AddonModAssign,
|
||||
} from '@addons/mod/assign/services/assign';
|
||||
import { AddonModAssignHelper } from '@addons/mod/assign/services/assign-helper';
|
||||
|
@ -32,6 +31,7 @@ import { makeSingleton } from '@singletons';
|
|||
import { AddonModAssignSubmissionFileComponent } from '../component/file';
|
||||
import { FileEntry } from '@awesome-cordova-plugins/file/ngx';
|
||||
import type { AddonModAssignSubmissionPluginBaseComponent } from '@addons/mod/assign/classes/base-submission-plugin-component';
|
||||
import { ADDON_MOD_ASSIGN_COMPONENT } from '@addons/mod/assign/constants';
|
||||
|
||||
/**
|
||||
* Handler for file submission plugin.
|
||||
|
@ -65,10 +65,10 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig
|
|||
* @inheritdoc
|
||||
*/
|
||||
clearTmpData(assign: AddonModAssignAssign): void {
|
||||
const files = CoreFileSession.getFiles(AddonModAssignProvider.COMPONENT, assign.id);
|
||||
const files = CoreFileSession.getFiles(ADDON_MOD_ASSIGN_COMPONENT, assign.id);
|
||||
|
||||
// Clear the files in session for this assign.
|
||||
CoreFileSession.clearFiles(AddonModAssignProvider.COMPONENT, assign.id);
|
||||
CoreFileSession.clearFiles(ADDON_MOD_ASSIGN_COMPONENT, assign.id);
|
||||
|
||||
// Now delete the local files from the tmp folder.
|
||||
CoreFileUploader.clearTmpFiles(files);
|
||||
|
@ -148,7 +148,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig
|
|||
// Check if there's any change.
|
||||
const hasChanged = await this.hasDataChanged(assign, submission, plugin);
|
||||
if (hasChanged) {
|
||||
const files = CoreFileSession.getFiles(AddonModAssignProvider.COMPONENT, assign.id);
|
||||
const files = CoreFileSession.getFiles(ADDON_MOD_ASSIGN_COMPONENT, assign.id);
|
||||
|
||||
return CoreFileHelper.getTotalFilesSize(files);
|
||||
} else {
|
||||
|
@ -183,7 +183,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig
|
|||
numFiles = pluginFiles && pluginFiles.length;
|
||||
}
|
||||
|
||||
const currentFiles = CoreFileSession.getFiles(AddonModAssignProvider.COMPONENT, assign.id);
|
||||
const currentFiles = CoreFileSession.getFiles(ADDON_MOD_ASSIGN_COMPONENT, assign.id);
|
||||
|
||||
if (currentFiles.length != numFiles) {
|
||||
// Number of files has changed.
|
||||
|
@ -230,7 +230,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig
|
|||
}
|
||||
|
||||
// Data has changed, we need to upload new files and re-upload all the existing files.
|
||||
const currentFiles = CoreFileSession.getFiles(AddonModAssignProvider.COMPONENT, assign.id);
|
||||
const currentFiles = CoreFileSession.getFiles(ADDON_MOD_ASSIGN_COMPONENT, assign.id);
|
||||
const error = CoreUtils.hasRepeatedFilenames(currentFiles);
|
||||
|
||||
if (error) {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// limitations under the License.
|
||||
|
||||
import { AddonModAssignSubmissionPluginBaseComponent } from '@addons/mod/assign/classes/base-submission-plugin-component';
|
||||
import { AddonModAssignProvider, AddonModAssign } from '@addons/mod/assign/services/assign';
|
||||
import { AddonModAssign } from '@addons/mod/assign/services/assign';
|
||||
import { AddonModAssignOffline } from '@addons/mod/assign/services/assign-offline';
|
||||
import { Component, OnInit, ElementRef } from '@angular/core';
|
||||
import { FormBuilder, FormControl } from '@angular/forms';
|
||||
|
@ -22,6 +22,7 @@ import { CoreTextUtils } from '@services/utils/text';
|
|||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { AddonModAssignSubmissionOnlineTextPluginData } from '../services/handler';
|
||||
import { ContextLevel } from '@/core/constants';
|
||||
import { ADDON_MOD_ASSIGN_COMPONENT } from '@addons/mod/assign/constants';
|
||||
|
||||
/**
|
||||
* Component to render an onlinetext submission plugin.
|
||||
|
@ -34,7 +35,7 @@ export class AddonModAssignSubmissionOnlineTextComponent extends AddonModAssignS
|
|||
|
||||
control?: FormControl<string>;
|
||||
words = 0;
|
||||
component = AddonModAssignProvider.COMPONENT;
|
||||
component = ADDON_MOD_ASSIGN_COMPONENT;
|
||||
text = '';
|
||||
loaded = false;
|
||||
wordLimitEnabled = false;
|
||||
|
|
Loading…
Reference in New Issue