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