commit
49fb34c951
|
@ -149,7 +149,7 @@
|
|||
<!-- Numeric grade. -->
|
||||
<ion-item text-wrap *ngIf="grade.method == 'simple' && !grade.scale">
|
||||
<ion-label stacked><h2>{{ 'addon.mod_assign.gradeoutof' | translate: {$a: gradeInfo.grade} }}</h2></ion-label>
|
||||
<ion-input *ngIf="!grade.disabled" type="number" [(ngModel)]="grade.grade" min="0" [max]="gradeInfo.grade" [lang]="grade.lang"></ion-input>
|
||||
<ion-input *ngIf="!grade.disabled" [type]="grade.type" [(ngModel)]="grade.grade" min="0" [max]="gradeInfo.grade" [lang]="grade.lang"></ion-input>
|
||||
<p item-content *ngIf="grade.disabled">{{ 'addon.mod_assign.gradelocked' | translate }}</p>
|
||||
</ion-item>
|
||||
|
||||
|
|
|
@ -472,7 +472,8 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy {
|
|||
applyToAll: false,
|
||||
scale: false,
|
||||
lang: false,
|
||||
disabled: false
|
||||
disabled: false,
|
||||
type: this.domUtils.numberInputSupportsComma() ? 'number' : 'text'
|
||||
};
|
||||
|
||||
this.originalGrades = {
|
||||
|
@ -506,7 +507,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy {
|
|||
if (feedback.grade && feedback.grade.grade && !this.grade.grade) {
|
||||
const parsedGrade = parseFloat(feedback.grade.grade);
|
||||
this.grade.grade = parsedGrade || parsedGrade == 0 ? parsedGrade : null;
|
||||
this.grade.gradebookGrade = this.grade.grade;
|
||||
this.grade.gradebookGrade = this.utils.formatFloat(this.grade.grade);
|
||||
this.originalGrades.grade = this.grade.grade;
|
||||
}
|
||||
} else {
|
||||
|
@ -585,7 +586,8 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy {
|
|||
if (data && (!feedback || !feedback.gradeddate || feedback.gradeddate < data.timemodified)) {
|
||||
// If grade has been modified from gradebook, do not use offline.
|
||||
if (this.grade.modified < data.timemodified) {
|
||||
this.grade.grade = data.grade;
|
||||
this.grade.grade = !this.grade.scale && this.grade.type == 'text' ?
|
||||
this.utils.formatFloat(data.grade) : data.grade;
|
||||
this.gradingStatusTranslationId = 'addon.mod_assign.gradenotsynced';
|
||||
this.gradingColor = '';
|
||||
this.originalGrades.grade = this.grade.grade;
|
||||
|
@ -772,8 +774,6 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy {
|
|||
userId: this.currentUserId
|
||||
}, this.siteId);
|
||||
});
|
||||
}).catch((error) => {
|
||||
this.domUtils.showErrorModalDefault(error, 'core.error', true);
|
||||
}).finally(() => {
|
||||
// Select submission view.
|
||||
this.tabs.selectTab(0);
|
||||
|
@ -802,6 +802,10 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy {
|
|||
if (this.gradeInfo.scale) {
|
||||
this.grade.scale = this.utils.makeMenuFromList(this.gradeInfo.scale, this.translate.instant('core.nograde'));
|
||||
} else {
|
||||
// If the grade uses a text input, format it.
|
||||
this.grade.grade = this.grade.type == 'text' ? this.utils.formatFloat(this.grade.grade) : this.grade.grade;
|
||||
this.originalGrades.grade = this.grade.grade;
|
||||
|
||||
// Get current language to format grade input field.
|
||||
this.langProvider.getCurrentLanguage().then((lang) => {
|
||||
this.grade.lang = lang;
|
||||
|
@ -829,11 +833,11 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy {
|
|||
|
||||
// Not using outcomes or scale, get the numeric grade.
|
||||
if (this.grade.scale) {
|
||||
this.grade.gradebookGrade = this.gradesHelper.getGradeValueFromLabel(
|
||||
this.grade.scale, grade.gradeformatted);
|
||||
this.grade.gradebookGrade = this.utils.formatFloat(this.gradesHelper.getGradeValueFromLabel(
|
||||
this.grade.scale, grade.gradeformatted));
|
||||
} else {
|
||||
const parsedGrade = parseFloat(grade.gradeformatted);
|
||||
this.grade.gradebookGrade = parsedGrade || parsedGrade == 0 ? parsedGrade : null;
|
||||
this.grade.gradebookGrade = parsedGrade || parsedGrade == 0 ? this.utils.formatFloat(parsedGrade) : null;
|
||||
}
|
||||
|
||||
this.grade.disabled = grade.gradeislocked || grade.gradeisoverridden;
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { IonicPage, NavController, NavParams } from 'ionic-angular';
|
||||
import { CoreAppProvider } from '@providers/app';
|
||||
import { CoreDomUtilsProvider } from '@providers/utils/dom';
|
||||
import { CoreCourseProvider } from '@core/course/providers/course';
|
||||
import { AddonModAssignProvider } from '../../providers/assign';
|
||||
import { AddonModAssignSubmissionComponent } from '../../components/submission/submission';
|
||||
|
@ -44,7 +45,8 @@ export class AddonModAssignSubmissionReviewPage implements OnInit {
|
|||
protected forceLeave = false; // To allow leaving the page without checking for changes.
|
||||
|
||||
constructor(navParams: NavParams, protected navCtrl: NavController, protected courseProvider: CoreCourseProvider,
|
||||
protected appProvider: CoreAppProvider, protected assignProvider: AddonModAssignProvider) {
|
||||
protected appProvider: CoreAppProvider, protected assignProvider: AddonModAssignProvider,
|
||||
protected domUtils: CoreDomUtilsProvider) {
|
||||
|
||||
this.moduleId = navParams.get('moduleId');
|
||||
this.courseId = navParams.get('courseId');
|
||||
|
@ -162,6 +164,8 @@ export class AddonModAssignSubmissionReviewPage implements OnInit {
|
|||
this.forceLeave = true;
|
||||
this.navCtrl.pop();
|
||||
}
|
||||
}).catch((error) => {
|
||||
this.domUtils.showErrorModalDefault(error, 'core.error', true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -603,6 +603,15 @@ export class CoreDomUtilsProvider {
|
|||
return movedChildren;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether input number supports writing comma as a decimal separator.
|
||||
*
|
||||
* @return {boolean} Whether input number supports writing comma as a decimal separator.
|
||||
*/
|
||||
numberInputSupportsComma(): boolean {
|
||||
return !this.platform.is('android') || this.platform.version().major > 5;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search and remove a certain element from inside another element.
|
||||
*
|
||||
|
|
|
@ -471,7 +471,7 @@ export class CoreUtilsProvider {
|
|||
* @return {string} Locale float.
|
||||
*/
|
||||
formatFloat(float: any): string {
|
||||
if (typeof float == 'undefined') {
|
||||
if (typeof float == 'undefined' || float === null) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue