MOBILE-3787 assign: Add enums to different states
parent
03ccd02636
commit
7cdafca794
|
@ -18,13 +18,14 @@ import { CoreGroupInfo, CoreGroups } from '@services/groups';
|
|||
import { CoreSites } from '@services/sites';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { Translate } from '@singletons';
|
||||
import { CoreIonicColorNames } from '@singletons/colors';
|
||||
import { CoreEvents } from '@singletons/events';
|
||||
import {
|
||||
AddonModAssign,
|
||||
AddonModAssignAssign,
|
||||
AddonModAssignGrade,
|
||||
AddonModAssignProvider,
|
||||
AddonModAssignGradingStates,
|
||||
AddonModAssignSubmission,
|
||||
AddonModAssignSubmissionStatusValues,
|
||||
} from '../services/assign';
|
||||
import { AddonModAssignHelper, AddonModAssignSubmissionFormatted } from '../services/assign-helper';
|
||||
import { AddonModAssignOffline } from '../services/assign-offline';
|
||||
|
@ -38,15 +39,15 @@ export class AddonModAssignSubmissionsSource extends CoreRoutedItemsManagerSourc
|
|||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
static getSourceId(courseId: number, moduleId: number, selectedStatus?: string): string {
|
||||
selectedStatus = selectedStatus ?? '__empty__';
|
||||
static getSourceId(courseId: number, moduleId: number, selectedStatus?: AddonModAssignListFilterName): string {
|
||||
const statusId = selectedStatus ?? '__empty__';
|
||||
|
||||
return `submissions-${courseId}-${moduleId}-${selectedStatus}`;
|
||||
return `submissions-${courseId}-${moduleId}-${statusId}`;
|
||||
}
|
||||
|
||||
readonly COURSE_ID: number;
|
||||
readonly MODULE_ID: number;
|
||||
readonly SELECTED_STATUS: string | undefined;
|
||||
readonly SELECTED_STATUS: AddonModAssignListFilterName | undefined;
|
||||
|
||||
assign?: AddonModAssignAssign;
|
||||
groupId = 0;
|
||||
|
@ -62,7 +63,7 @@ export class AddonModAssignSubmissionsSource extends CoreRoutedItemsManagerSourc
|
|||
canviewsubmissions: false,
|
||||
};
|
||||
|
||||
constructor(courseId: number, moduleId: number, selectedStatus?: string) {
|
||||
constructor(courseId: number, moduleId: number, selectedStatus?: AddonModAssignListFilterName) {
|
||||
super();
|
||||
|
||||
this.COURSE_ID = courseId;
|
||||
|
@ -169,8 +170,8 @@ export class AddonModAssignSubmissionsSource extends CoreRoutedItemsManagerSourc
|
|||
: [];
|
||||
|
||||
// Filter the submissions to get only the ones with the right status and add some extra data.
|
||||
const getNeedGrading = this.SELECTED_STATUS == AddonModAssignProvider.NEED_GRADING;
|
||||
const searchStatus = getNeedGrading ? AddonModAssignProvider.SUBMISSION_STATUS_SUBMITTED : this.SELECTED_STATUS;
|
||||
const getNeedGrading = this.SELECTED_STATUS == AddonModAssignListFilterName.NEED_GRADING;
|
||||
const searchStatus = getNeedGrading ? AddonModAssignSubmissionStatusValues.SUBMITTED : this.SELECTED_STATUS;
|
||||
|
||||
const showSubmissions: AddonModAssignSubmissionForList[] = [];
|
||||
|
||||
|
@ -192,7 +193,7 @@ export class AddonModAssignSubmissionsSource extends CoreRoutedItemsManagerSourc
|
|||
// Load offline grades.
|
||||
const notSynced = !!gradeData && submission.timemodified < gradeData.timemodified;
|
||||
|
||||
if (submission.gradingstatus == 'graded' && !assign.markingworkflow) {
|
||||
if (submission.gradingstatus == AddonModAssignGradingStates.GRADED && !assign.markingworkflow) {
|
||||
// Get the last grade of the submission.
|
||||
const grade = grades
|
||||
.filter((grade) => grade.userid == submission.userid)
|
||||
|
@ -202,7 +203,7 @@ export class AddonModAssignSubmissionsSource extends CoreRoutedItemsManagerSourc
|
|||
);
|
||||
|
||||
if (grade && grade.timemodified < submission.timemodified) {
|
||||
submission.gradingstatus = AddonModAssignProvider.GRADED_FOLLOWUP_SUBMIT;
|
||||
submission.gradingstatus = AddonModAssignGradingStates.GRADED_FOLLOWUP_SUBMIT;
|
||||
}
|
||||
}
|
||||
submission.statusColor = AddonModAssign.getSubmissionStatusColor(submission.status);
|
||||
|
@ -217,7 +218,8 @@ export class AddonModAssignSubmissionsSource extends CoreRoutedItemsManagerSourc
|
|||
if (notSynced) {
|
||||
submission.gradingStatusTranslationId = 'addon.mod_assign.gradenotsynced';
|
||||
submission.gradingColor = '';
|
||||
} else if (submission.statusColor != 'danger' || submission.gradingColor != 'danger') {
|
||||
} else if (submission.statusColor != CoreIonicColorNames.DANGER ||
|
||||
submission.gradingColor != CoreIonicColorNames.DANGER) {
|
||||
// Show grading status if one of the statuses is not done.
|
||||
submission.gradingStatusTranslationId = AddonModAssign.getSubmissionGradingStatusTranslationId(
|
||||
submission.gradingstatus,
|
||||
|
@ -245,3 +247,13 @@ export type AddonModAssignSubmissionForList = AddonModAssignSubmissionFormatted
|
|||
statusTranslated?: string; // Calculated in the app. Translated text of the submission status.
|
||||
gradingStatusTranslationId?: string; // Calculated in the app. Key of the text of the submission grading status.
|
||||
};
|
||||
|
||||
/**
|
||||
* List filter by status name.
|
||||
*/
|
||||
export enum AddonModAssignListFilterName {
|
||||
ALL = '',
|
||||
NEED_GRADING = 'needgrading',
|
||||
DRAFT = 'draft',
|
||||
SUBMITTED = 'submitted',
|
||||
};
|
||||
|
|
|
@ -28,6 +28,7 @@ import { CoreTimeUtils } from '@services/utils/time';
|
|||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { Translate } from '@singletons';
|
||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
|
||||
import { AddonModAssignListFilterName } from '../../classes/submissions-source';
|
||||
import {
|
||||
AddonModAssign,
|
||||
AddonModAssignAssign,
|
||||
|
@ -75,9 +76,9 @@ export class AddonModAssignIndexComponent extends CoreCourseModuleMainActivityCo
|
|||
};
|
||||
|
||||
// Status.
|
||||
submissionStatusSubmitted = AddonModAssignProvider.SUBMISSION_STATUS_SUBMITTED;
|
||||
submissionStatusDraft = AddonModAssignProvider.SUBMISSION_STATUS_DRAFT;
|
||||
needGrading = AddonModAssignProvider.NEED_GRADING;
|
||||
submissionStatusSubmitted = AddonModAssignListFilterName.SUBMITTED;
|
||||
submissionStatusDraft = AddonModAssignListFilterName.DRAFT;
|
||||
needGrading = AddonModAssignListFilterName.NEED_GRADING;
|
||||
|
||||
protected currentUserId!: number; // Current user ID.
|
||||
protected currentSite!: CoreSite; // Current site.
|
||||
|
@ -311,7 +312,7 @@ export class AddonModAssignIndexComponent extends CoreCourseModuleMainActivityCo
|
|||
* @param status Status to see.
|
||||
* @param hasSubmissions If the status has any submission.
|
||||
*/
|
||||
goToSubmissionList(status?: string, hasSubmissions = false): void {
|
||||
goToSubmissionList(status?: AddonModAssignListFilterName, hasSubmissions = false): void {
|
||||
if (status !== undefined && !hasSubmissions) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,9 @@ import {
|
|||
AddonModAssign,
|
||||
AddonModAssignGetSubmissionStatusWSResponse,
|
||||
AddonModAssignSavePluginData,
|
||||
AddonModAssignGradingStates,
|
||||
AddonModAssignSubmissionStatusValues,
|
||||
AddonModAssignAttemptReopenMethodValues,
|
||||
} from '../../services/assign';
|
||||
import {
|
||||
AddonModAssignAutoSyncData,
|
||||
|
@ -125,9 +128,9 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
|
|||
showDates = false; // Whether to show some dates.
|
||||
|
||||
// Some constants.
|
||||
statusNew = AddonModAssignProvider.SUBMISSION_STATUS_NEW;
|
||||
statusReopened = AddonModAssignProvider.SUBMISSION_STATUS_REOPENED;
|
||||
attemptReopenMethodNone = AddonModAssignProvider.ATTEMPT_REOPEN_METHOD_NONE;
|
||||
statusNew = AddonModAssignSubmissionStatusValues.NEW;
|
||||
statusReopened = AddonModAssignSubmissionStatusValues.REOPENED;
|
||||
attemptReopenMethodNone = AddonModAssignAttemptReopenMethodValues.NONE;
|
||||
unlimitedAttempts = AddonModAssignProvider.UNLIMITED_ATTEMPTS;
|
||||
|
||||
protected siteId: string; // Current site ID.
|
||||
|
@ -214,7 +217,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
|
|||
}
|
||||
|
||||
// Not submitted.
|
||||
if (!this.userSubmission || this.userSubmission.status != AddonModAssignProvider.SUBMISSION_STATUS_SUBMITTED) {
|
||||
if (!this.userSubmission || this.userSubmission.status != AddonModAssignSubmissionStatusValues.SUBMITTED) {
|
||||
|
||||
if (response.lastattempt?.submissionsenabled || response.gradingsummary?.submissionsenabled) {
|
||||
this.timeRemaining = Translate.instant(
|
||||
|
@ -651,7 +654,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
|
|||
// Treat the grade info.
|
||||
await this.treatGradeInfo();
|
||||
|
||||
const isManual = this.assign!.attemptreopenmethod == AddonModAssignProvider.ATTEMPT_REOPEN_METHOD_MANUAL;
|
||||
const isManual = this.assign!.attemptreopenmethod == AddonModAssignAttemptReopenMethodValues.MANUAL;
|
||||
const isUnlimited = this.assign!.maxattempts == AddonModAssignProvider.UNLIMITED_ATTEMPTS;
|
||||
const isLessThanMaxAttempts = !!this.userSubmission && (this.userSubmission.attemptnumber < (this.assign!.maxattempts - 1));
|
||||
|
||||
|
@ -668,7 +671,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
|
|||
|
||||
if (this.lastAttempt?.gradingstatus == 'graded' && !this.assign!.markingworkflow && this.userSubmission && feedback) {
|
||||
if (feedback.gradeddate < this.userSubmission.timemodified) {
|
||||
this.lastAttempt.gradingstatus = AddonModAssignProvider.GRADED_FOLLOWUP_SUBMIT;
|
||||
this.lastAttempt.gradingstatus = AddonModAssignGradingStates.GRADED_FOLLOWUP_SUBMIT;
|
||||
|
||||
// Get grading text and color.
|
||||
this.gradingStatusTranslationId = AddonModAssign.getSubmissionGradingStatusTranslationId(
|
||||
|
@ -749,43 +752,43 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
|
|||
* @param status Submission status.
|
||||
*/
|
||||
protected setStatusNameAndClass(status: AddonModAssignGetSubmissionStatusWSResponse): void {
|
||||
const translateService = Translate.instance;
|
||||
|
||||
if (this.hasOffline || this.submittedOffline) {
|
||||
// Offline data.
|
||||
this.statusTranslated = translateService.instant('core.notsent');
|
||||
this.statusTranslated = Translate.instant('core.notsent');
|
||||
this.statusColor = 'warning';
|
||||
} else if (!this.assign!.teamsubmission) {
|
||||
|
||||
// Single submission.
|
||||
if (this.userSubmission && this.userSubmission.status != this.statusNew) {
|
||||
this.statusTranslated = translateService.instant('addon.mod_assign.submissionstatus_' + this.userSubmission.status);
|
||||
this.statusTranslated = Translate.instant('addon.mod_assign.submissionstatus_' + this.userSubmission.status);
|
||||
this.statusColor = AddonModAssign.getSubmissionStatusColor(this.userSubmission.status);
|
||||
} else {
|
||||
if (!status.lastattempt?.submissionsenabled) {
|
||||
this.statusTranslated = translateService.instant('addon.mod_assign.noonlinesubmissions');
|
||||
this.statusColor = AddonModAssign.getSubmissionStatusColor('noonlinesubmissions');
|
||||
this.statusTranslated = Translate.instant('addon.mod_assign.noonlinesubmissions');
|
||||
this.statusColor =
|
||||
AddonModAssign.getSubmissionStatusColor(AddonModAssignSubmissionStatusValues.NO_ONLINE_SUBMISSIONS);
|
||||
} else {
|
||||
this.statusTranslated = translateService.instant('addon.mod_assign.noattempt');
|
||||
this.statusColor = AddonModAssign.getSubmissionStatusColor('noattempt');
|
||||
this.statusTranslated = Translate.instant('addon.mod_assign.noattempt');
|
||||
this.statusColor = AddonModAssign.getSubmissionStatusColor(AddonModAssignSubmissionStatusValues.NO_ATTEMPT);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
// Team submission.
|
||||
if (!status.lastattempt?.submissiongroup && this.assign!.preventsubmissionnotingroup) {
|
||||
this.statusTranslated = translateService.instant('addon.mod_assign.nosubmission');
|
||||
this.statusColor = AddonModAssign.getSubmissionStatusColor('nosubmission');
|
||||
this.statusTranslated = Translate.instant('addon.mod_assign.nosubmission');
|
||||
this.statusColor = AddonModAssign.getSubmissionStatusColor(AddonModAssignSubmissionStatusValues.NO_SUBMISSION);
|
||||
} else if (this.userSubmission && this.userSubmission.status != this.statusNew) {
|
||||
this.statusTranslated = translateService.instant('addon.mod_assign.submissionstatus_' + this.userSubmission.status);
|
||||
this.statusTranslated = Translate.instant('addon.mod_assign.submissionstatus_' + this.userSubmission.status);
|
||||
this.statusColor = AddonModAssign.getSubmissionStatusColor(this.userSubmission.status);
|
||||
} else {
|
||||
if (!status.lastattempt?.submissionsenabled) {
|
||||
this.statusTranslated = translateService.instant('addon.mod_assign.noonlinesubmissions');
|
||||
this.statusColor = AddonModAssign.getSubmissionStatusColor('noonlinesubmissions');
|
||||
this.statusTranslated = Translate.instant('addon.mod_assign.noonlinesubmissions');
|
||||
this.statusColor =
|
||||
AddonModAssign.getSubmissionStatusColor(AddonModAssignSubmissionStatusValues.NO_ONLINE_SUBMISSIONS);
|
||||
} else {
|
||||
this.statusTranslated = translateService.instant('addon.mod_assign.nosubmission');
|
||||
this.statusColor = AddonModAssign.getSubmissionStatusColor('nosubmission');
|
||||
this.statusTranslated = Translate.instant('addon.mod_assign.nosubmission');
|
||||
this.statusColor = AddonModAssign.getSubmissionStatusColor(AddonModAssignSubmissionStatusValues.NO_SUBMISSION);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1180,7 +1183,7 @@ type AddonModAssignSubmissionGrade = {
|
|||
grade?: number | string;
|
||||
gradebookGrade?: string;
|
||||
modified?: number;
|
||||
gradingStatus?: string;
|
||||
gradingStatus?: AddonModAssignGradingStates;
|
||||
addAttempt: boolean;
|
||||
applyToAll: boolean;
|
||||
scale?: CoreMenuItem<number>[];
|
||||
|
|
|
@ -23,7 +23,11 @@ import { CoreSites } from '@services/sites';
|
|||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { Translate } from '@singletons';
|
||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
|
||||
import { AddonModAssignSubmissionForList, AddonModAssignSubmissionsSource } from '../../classes/submissions-source';
|
||||
import {
|
||||
AddonModAssignListFilterName,
|
||||
AddonModAssignSubmissionForList,
|
||||
AddonModAssignSubmissionsSource,
|
||||
} from '../../classes/submissions-source';
|
||||
import { AddonModAssignAssign, AddonModAssignProvider } from '../../services/assign';
|
||||
import {
|
||||
AddonModAssignSyncProvider,
|
||||
|
@ -85,7 +89,7 @@ export class AddonModAssignSubmissionListPage implements AfterViewInit, OnDestro
|
|||
const moduleId = CoreNavigator.getRequiredRouteNumberParam('cmId');
|
||||
const courseId = CoreNavigator.getRequiredRouteNumberParam('courseId');
|
||||
const groupId = CoreNavigator.getRouteNumberParam('groupId') || 0;
|
||||
const selectedStatus = CoreNavigator.getRouteParam('status');
|
||||
const selectedStatus = CoreNavigator.getRouteParam<AddonModAssignListFilterName>('status');
|
||||
const submissionsSource = CoreRoutedItemsManagerSourcesTracker.getOrCreateSource(
|
||||
AddonModAssignSubmissionsSource,
|
||||
[courseId, moduleId, selectedStatus],
|
||||
|
@ -143,7 +147,7 @@ export class AddonModAssignSubmissionListPage implements AfterViewInit, OnDestro
|
|||
this.title = Translate.instant(
|
||||
selectedStatus
|
||||
? (
|
||||
selectedStatus === AddonModAssignProvider.NEED_GRADING
|
||||
selectedStatus === AddonModAssignListFilterName.NEED_GRADING
|
||||
? 'addon.mod_assign.numberofsubmissionsneedgrading'
|
||||
: `addon.mod_assign.submissionstatus_${selectedStatus}`
|
||||
)
|
||||
|
|
|
@ -22,7 +22,7 @@ import { IonRefresher } from '@ionic/angular';
|
|||
import { CoreNavigator } from '@services/navigator';
|
||||
import { CoreScreen } from '@services/screen';
|
||||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { AddonModAssignSubmissionsSource } from '../../classes/submissions-source';
|
||||
import { AddonModAssignListFilterName, AddonModAssignSubmissionsSource } from '../../classes/submissions-source';
|
||||
import { AddonModAssignSubmissionComponent } from '../../components/submission/submission';
|
||||
import { AddonModAssign, AddonModAssignAssign } from '../../services/assign';
|
||||
|
||||
|
@ -53,7 +53,7 @@ export class AddonModAssignSubmissionReviewPage implements OnInit, OnDestroy, Ca
|
|||
constructor(protected route: ActivatedRoute) { }
|
||||
|
||||
/**
|
||||
* Component being initialized.
|
||||
* @inheritdoc
|
||||
*/
|
||||
ngOnInit(): void {
|
||||
this.route.queryParams.subscribe((params) => {
|
||||
|
@ -63,7 +63,7 @@ export class AddonModAssignSubmissionReviewPage implements OnInit, OnDestroy, Ca
|
|||
this.submitId = CoreNavigator.getRouteNumberParam('submitId') || 0;
|
||||
this.blindId = CoreNavigator.getRouteNumberParam('blindId', { params });
|
||||
const groupId = CoreNavigator.getRequiredRouteNumberParam('groupId');
|
||||
const selectedStatus = CoreNavigator.getRouteParam('selectedStatus');
|
||||
const selectedStatus = CoreNavigator.getRouteParam<AddonModAssignListFilterName>('selectedStatus');
|
||||
const submissionsSource = CoreRoutedItemsManagerSourcesTracker.getOrCreateSource(
|
||||
AddonModAssignSubmissionsSource,
|
||||
[this.courseId, this.moduleId, selectedStatus],
|
||||
|
|
|
@ -25,6 +25,7 @@ import {
|
|||
AddonModAssign,
|
||||
AddonModAssignPlugin,
|
||||
AddonModAssignSavePluginData,
|
||||
AddonModAssignSubmissionStatusValues,
|
||||
} from './assign';
|
||||
import { AddonModAssignOffline } from './assign-offline';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
|
@ -55,8 +56,8 @@ export class AddonModAssignHelperProvider {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (submission.status == AddonModAssignProvider.SUBMISSION_STATUS_NEW ||
|
||||
submission.status == AddonModAssignProvider.SUBMISSION_STATUS_REOPENED) {
|
||||
if (submission.status == AddonModAssignSubmissionStatusValues.NEW ||
|
||||
submission.status == AddonModAssignSubmissionStatusValues.REOPENED) {
|
||||
// It's a new submission, allow creating it in offline.
|
||||
return true;
|
||||
}
|
||||
|
@ -443,8 +444,8 @@ export class AddonModAssignHelperProvider {
|
|||
submission.groupname = participant.groupname;
|
||||
}
|
||||
|
||||
submission.status = submission.status ?? (participant.submitted ? AddonModAssignProvider.SUBMISSION_STATUS_SUBMITTED :
|
||||
AddonModAssignProvider.SUBMISSION_STATUS_NEW);
|
||||
submission.status = submission.status ?? (participant.submitted ? AddonModAssignSubmissionStatusValues.SUBMITTED :
|
||||
AddonModAssignSubmissionStatusValues.NEW);
|
||||
|
||||
return submission;
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ import { CoreWSError } from '@classes/errors/wserror';
|
|||
import { AddonModAssignAutoSyncData, AddonModAssignManualSyncData, AddonModAssignSyncProvider } from './assign-sync';
|
||||
import { CoreFormFields } from '@singletons/form';
|
||||
import { CoreFileHelper } from '@services/file-helper';
|
||||
import { CoreIonicColorNames } from '@singletons/colors';
|
||||
|
||||
const ROOT_CACHE_KEY = 'mmaModAssign:';
|
||||
|
||||
|
@ -64,23 +65,6 @@ export class AddonModAssignProvider {
|
|||
static readonly SUBMISSION_COMPONENT = 'mmaModAssignSubmission';
|
||||
static readonly UNLIMITED_ATTEMPTS = -1;
|
||||
|
||||
// Submission status.
|
||||
static readonly SUBMISSION_STATUS_NEW = 'new';
|
||||
static readonly SUBMISSION_STATUS_REOPENED = 'reopened';
|
||||
static readonly SUBMISSION_STATUS_DRAFT = 'draft';
|
||||
static readonly SUBMISSION_STATUS_SUBMITTED = 'submitted';
|
||||
|
||||
// "Re-open" methods (to retry the assign).
|
||||
static readonly ATTEMPT_REOPEN_METHOD_NONE = 'none';
|
||||
static readonly ATTEMPT_REOPEN_METHOD_MANUAL = 'manual';
|
||||
|
||||
// Grading status.
|
||||
static readonly GRADING_STATUS_GRADED = 'graded';
|
||||
static readonly GRADING_STATUS_NOT_GRADED = 'notgraded';
|
||||
static readonly MARKING_WORKFLOW_STATE_RELEASED = 'released';
|
||||
static readonly NEED_GRADING = 'needgrading';
|
||||
static readonly GRADED_FOLLOWUP_SUBMIT = 'gradedfollowupsubmit';
|
||||
|
||||
// Group submissions warnings.
|
||||
static readonly WARN_GROUPS_REQUIRED = 'warnrequired';
|
||||
static readonly WARN_GROUPS_OPTIONAL = 'warnoptional';
|
||||
|
@ -108,17 +92,17 @@ export class AddonModAssignProvider {
|
|||
const teamSubmission = submissionStatus.lastattempt?.teamsubmission;
|
||||
|
||||
if (teamSubmission) {
|
||||
if (teamSubmission.status === AddonModAssignProvider.SUBMISSION_STATUS_SUBMITTED) {
|
||||
if (teamSubmission.status === AddonModAssignSubmissionStatusValues.SUBMITTED) {
|
||||
// The assignment submission has been completed.
|
||||
return false;
|
||||
} else if (userSubmission && userSubmission.status === AddonModAssignProvider.SUBMISSION_STATUS_SUBMITTED) {
|
||||
} else if (userSubmission && userSubmission.status === AddonModAssignSubmissionStatusValues.SUBMITTED) {
|
||||
// The user has already clicked the submit button on the team submission.
|
||||
return false;
|
||||
} else if (assign.preventsubmissionnotingroup && !submissionStatus.lastattempt?.submissiongroup) {
|
||||
return false;
|
||||
}
|
||||
} else if (userSubmission) {
|
||||
if (userSubmission.status === AddonModAssignProvider.SUBMISSION_STATUS_SUBMITTED) {
|
||||
if (userSubmission.status === AddonModAssignSubmissionStatusValues.SUBMITTED) {
|
||||
// The assignment submission has been completed.
|
||||
return false;
|
||||
}
|
||||
|
@ -347,17 +331,17 @@ export class AddonModAssignProvider {
|
|||
* @param status Grading status name
|
||||
* @return The color name.
|
||||
*/
|
||||
getSubmissionGradingStatusColor(status?: string): string {
|
||||
getSubmissionGradingStatusColor(status?: AddonModAssignGradingStates): CoreIonicColorNames {
|
||||
if (!status) {
|
||||
return '';
|
||||
return CoreIonicColorNames.NONE;
|
||||
}
|
||||
|
||||
if (status == AddonModAssignProvider.GRADING_STATUS_GRADED ||
|
||||
status == AddonModAssignProvider.MARKING_WORKFLOW_STATE_RELEASED) {
|
||||
return 'success';
|
||||
if (status == AddonModAssignGradingStates.GRADED
|
||||
|| status == AddonModAssignGradingStates.MARKING_WORKFLOW_STATE_RELEASED) {
|
||||
return CoreIonicColorNames.SUCCESS;
|
||||
}
|
||||
|
||||
return 'danger';
|
||||
return CoreIonicColorNames.DANGER;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -366,13 +350,14 @@ export class AddonModAssignProvider {
|
|||
* @param status Grading Status name
|
||||
* @return The status translation identifier.
|
||||
*/
|
||||
getSubmissionGradingStatusTranslationId(status?: string): string | undefined {
|
||||
getSubmissionGradingStatusTranslationId(status?: AddonModAssignGradingStates): string | undefined {
|
||||
if (!status) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (status == AddonModAssignProvider.GRADING_STATUS_GRADED || status == AddonModAssignProvider.GRADING_STATUS_NOT_GRADED
|
||||
|| status == AddonModAssignProvider.GRADED_FOLLOWUP_SUBMIT) {
|
||||
if (status == AddonModAssignGradingStates.GRADED
|
||||
|| status == AddonModAssignGradingStates.NOT_GRADED
|
||||
|| status == AddonModAssignGradingStates.GRADED_FOLLOWUP_SUBMIT) {
|
||||
return 'addon.mod_assign.' + status;
|
||||
}
|
||||
|
||||
|
@ -604,20 +589,20 @@ export class AddonModAssignProvider {
|
|||
* @param status Status name
|
||||
* @return The color name.
|
||||
*/
|
||||
getSubmissionStatusColor(status: string): string {
|
||||
getSubmissionStatusColor(status: AddonModAssignSubmissionStatusValues): CoreIonicColorNames {
|
||||
switch (status) {
|
||||
case 'submitted':
|
||||
return 'success';
|
||||
case 'draft':
|
||||
return 'info';
|
||||
case 'new':
|
||||
case 'noattempt':
|
||||
case 'noonlinesubmissions':
|
||||
case 'nosubmission':
|
||||
case 'gradedfollowupsubmit':
|
||||
return 'danger';
|
||||
case AddonModAssignSubmissionStatusValues.SUBMITTED:
|
||||
return CoreIonicColorNames.SUCCESS;
|
||||
case AddonModAssignSubmissionStatusValues.DRAFT:
|
||||
return CoreIonicColorNames.INFO;
|
||||
case AddonModAssignSubmissionStatusValues.NEW:
|
||||
case AddonModAssignSubmissionStatusValues.NO_ATTEMPT:
|
||||
case AddonModAssignSubmissionStatusValues.NO_ONLINE_SUBMISSIONS:
|
||||
case AddonModAssignSubmissionStatusValues.NO_SUBMISSION:
|
||||
case AddonModAssignSubmissionStatusValues.GRADED_FOLLOWUP_SUBMIT:
|
||||
return CoreIonicColorNames.DANGER;
|
||||
default:
|
||||
return 'light';
|
||||
return CoreIonicColorNames.LIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -878,7 +863,7 @@ export class AddonModAssignProvider {
|
|||
}
|
||||
|
||||
if (submission) {
|
||||
if (assign.submissiondrafts && submission.status == AddonModAssignProvider.SUBMISSION_STATUS_SUBMITTED) {
|
||||
if (assign.submissiondrafts && submission.status == AddonModAssignSubmissionStatusValues.SUBMITTED) {
|
||||
// Drafts are tracked and the student has submitted the assignment.
|
||||
return false;
|
||||
}
|
||||
|
@ -975,8 +960,8 @@ export class AddonModAssignProvider {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (submission.gradingstatus != AddonModAssignProvider.GRADING_STATUS_GRADED &&
|
||||
submission.gradingstatus != AddonModAssignProvider.MARKING_WORKFLOW_STATE_RELEASED) {
|
||||
if (submission.gradingstatus != AddonModAssignGradingStates.GRADED &&
|
||||
submission.gradingstatus != AddonModAssignGradingStates.MARKING_WORKFLOW_STATE_RELEASED) {
|
||||
// Not graded.
|
||||
return true;
|
||||
}
|
||||
|
@ -1349,7 +1334,7 @@ export type AddonModAssignAssign = {
|
|||
blindmarking: number; // If enabled, hide identities until reveal identities actioned.
|
||||
hidegrader?: number; // @since 3.7. If enabled, hide grader to student.
|
||||
revealidentities: number; // Show identities for a blind marking assignment.
|
||||
attemptreopenmethod: string; // Method used to control opening new attempts.
|
||||
attemptreopenmethod: AddonModAssignAttemptReopenMethodValues; // Method used to control opening new attempts.
|
||||
maxattempts: number; // Maximum number of attempts allowed.
|
||||
markingworkflow: number; // Enable marking workflow.
|
||||
markingallocation: number; // Enable marking allocation.
|
||||
|
@ -1400,12 +1385,12 @@ export type AddonModAssignSubmission = {
|
|||
attemptnumber: number; // Attempt number.
|
||||
timecreated: number; // Submission creation time.
|
||||
timemodified: number; // Submission last modified time.
|
||||
status: string; // Submission status.
|
||||
status: AddonModAssignSubmissionStatusValues; // Submission status.
|
||||
groupid: number; // Group id.
|
||||
assignment?: number; // Assignment id.
|
||||
latest?: number; // Latest attempt.
|
||||
plugins?: AddonModAssignPlugin[]; // Plugins.
|
||||
gradingstatus?: string; // Grading status.
|
||||
gradingstatus?: AddonModAssignGradingStates; // Grading status.
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1454,7 +1439,7 @@ export type AddonModAssignSubmissionAttempt = {
|
|||
cansubmit: boolean; // Whether the user can submit.
|
||||
extensionduedate: number; // Extension due date.
|
||||
blindmarking: boolean; // Whether blind marking is enabled.
|
||||
gradingstatus: string; // Grading status.
|
||||
gradingstatus: AddonModAssignGradingStates; // Grading status.
|
||||
usergroups: number[]; // User groups in the course.
|
||||
};
|
||||
|
||||
|
@ -1749,3 +1734,41 @@ export type AddonModAssignSubmissionSavedEventData = AddonModAssignSubmittedForG
|
|||
* Data sent by GRADED_EVENT event.
|
||||
*/
|
||||
export type AddonModAssignGradedEventData = AddonModAssignSubmittedForGradingEventData;
|
||||
|
||||
/**
|
||||
* Submission status.
|
||||
* Constants on LMS starting with ASSIGN_SUBMISSION_STATUS_
|
||||
*/
|
||||
export enum AddonModAssignSubmissionStatusValues {
|
||||
SUBMITTED = 'submitted',
|
||||
DRAFT = 'draft',
|
||||
NEW = 'new',
|
||||
REOPENED = 'reopened',
|
||||
// Added by App Statuses.
|
||||
NO_ATTEMPT = 'noattempt',
|
||||
NO_ONLINE_SUBMISSIONS = 'noonlinesubmissions',
|
||||
NO_SUBMISSION = 'nosubmission',
|
||||
GRADED_FOLLOWUP_SUBMIT = 'gradedfollowupsubmit',
|
||||
};
|
||||
|
||||
/**
|
||||
* Grading status.
|
||||
* Constants on LMS starting with ASSIGN_GRADING_STATUS_
|
||||
*/
|
||||
export enum AddonModAssignGradingStates {
|
||||
GRADED = 'graded',
|
||||
NOT_GRADED = 'notgraded',
|
||||
// Added by App Statuses.
|
||||
MARKING_WORKFLOW_STATE_RELEASED = 'released', // with ASSIGN_MARKING_WORKFLOW_STATE_RELEASED
|
||||
GRADED_FOLLOWUP_SUBMIT = 'gradedfollowupsubmit',
|
||||
};
|
||||
|
||||
/**
|
||||
* Reopen attempt methods.
|
||||
* Constants on LMS starting with ASSIGN_ATTEMPT_REOPEN_METHOD_
|
||||
*/
|
||||
export enum AddonModAssignAttemptReopenMethodValues {
|
||||
NONE = 'none',
|
||||
MANUAL = 'manual',
|
||||
UNTILPASS = 'untilpass',
|
||||
};
|
||||
|
|
|
@ -21,6 +21,18 @@ interface ColorComponents {
|
|||
blue: number; // Blue component of an RGB color [0-255].
|
||||
}
|
||||
|
||||
/**
|
||||
* Ionic color names.
|
||||
*/
|
||||
export enum CoreIonicColorNames {
|
||||
SUCCESS = 'success',
|
||||
INFO = 'info',
|
||||
DANGER = 'danger',
|
||||
DARK = 'dark',
|
||||
LIGHT = 'light',
|
||||
NONE = '',
|
||||
};
|
||||
|
||||
/**
|
||||
* Singleton with helper functions for colors.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue