Exemple #1
0
        protected override void recalculateResult()
        {
            if (!this.years[0].IsUsable && !this.years[1].IsUsable && !this.years[2].IsUsable)
            {
                this.emitWarning(CourseWarnings.EmitCourseInsufficientData(this.getRef()));
                this.Result = Course.Degree.Unknown;
                return;
            }

            if (this.years[2].NeedsRetake)
            {
                this.Result = Course.Degree.Fail;
                this.emitWarning(CourseWarnings.EmitCourseRetakeSixFailure(this.getRef()));
                return;
            }
            else
            {
                this.emitWarning(CourseWarnings.EmitCourseRetakeSixFailure(this.getRef(), true));
            }

            if (Boolean.Parse(Properties.Resources.X_FAIL_ON_RETAKE))
            {
                if (this.years[0].NeedsRetake || this.years[1].NeedsRetake)
                {
                    this.Result = Course.Degree.Fail;
                    this.emitWarning(CourseWarnings.EmitCourseRetakeFailure(this.getRef()));
                    return;
                }
                else
                {
                    this.emitWarning(CourseWarnings.EmitCourseRetakeFailure(this.getRef(), true));
                }
            }

            if (Boolean.Parse(Properties.Resources.X_FAIL_ON_REF))
            {
                if (this.years[0].NeedsReferral || this.years[1].NeedsReferral || this.years[2].NeedsReferral)
                {
                    this.Result = Course.Degree.Fail;
                    this.emitWarning(CourseWarnings.EmitCourseReferralFailure(this.getRef()));
                    return;
                }
                else
                {
                    this.emitWarning(CourseWarnings.EmitCourseReferralFailure(this.getRef(), true));
                }
            }

            List <Tuple <double, double> > yearOne   = this.years[0].UsableModules;
            List <Tuple <double, double> > yearTwo   = this.years[1].UsableModules;
            List <Tuple <double, double> > yearThree = this.years[2].UsableModules;

            if (!this.years[1].IsUsable || !this.years[2].IsUsable)
            {
                if (Boolean.Parse(Properties.Resources.X_STOP_ON_MISSING))
                {
                    this.Result = Course.Degree.Unknown;
                    this.emitWarning(CourseWarnings.EmitCourseInsufficientData(this.getRef()));
                    return;
                }

                CourseCalculationHelper.InterpolateYearResult(yearOne, yearTwo, yearThree);
                this.emitWarning(CourseWarnings.EmitCourseInterpolated(this.getRef()));
            }
            else
            {
                this.emitWarning(CourseWarnings.EmitCourseInterpolated(this.getRef(), true));
            }

            this.emitWarning(CourseWarnings.EmitCourseInsufficientData(this.getRef(), true));
            this.Result = CourseCalculationHelper.Degree(yearTwo, yearThree);
        }