Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// <summary>
- /// Checks if student completes a certain course taken requirement. The requirement is completed if the HistoricalCodeId of the required course is the same as
- /// a the HistoricalCodeId of an element from the studentCourses taken list. Or if current course registration period is preregistation and the HistoricalCodeId of the
- /// required coruse is the same as the HistoricalCodeId of an element from coursesInProgress list.
- /// </summary>
- /// <param name="requirement">The requirement entity.</param>
- /// <param name="studentCoursesTaken">All student taken courses.</param>
- /// <param name="currentRegPeriod">Current registration period.</param>
- /// <param name="coursesInProgress">All student courses INPROGRESS.</param>
- /// <returns> TRUE if the requirement is completed and FALSE if the requirement is not completed.</returns>
- private bool CheckIfCourseTakenRequirementIsCompleted(view_courseTakenRegReqs requirement, List<view_studentCoursesTaken> studentCoursesTaken, CourseRegPeriods currentRegPeriod, IEnumerable<view_studentCoursesTaken> coursesInProgress)
- {
- //1. Get the required course, the required grade and the required course code.
- var requiredCourseId = requirement.RequiredCourseId;
- var requiredGrade = requirement.MinimalGrade;
- var requiredHistoricalCodeId = requirement.RequiredHistoricalCodeId;
- //2. All possible at AUBG
- var possibleGrades = new List<string>
- {
- "F", "D", "D+", "C-", "C", "C+", "B-", "B", "B+", "A-", "A"
- };
- //3. Check if student has taken the course
- foreach (var studentCourseTaken in studentCoursesTaken)
- {
- //3.1. Does the requirement include a grade.
- bool checkForGrade = (requiredGrade != String.Empty) ? true : false;
- //TODO: Ask registrars about the different bases and grade requirement
- if (!checkForGrade)
- {
- //TODO-Lazov - what about pass-fail
- if ((requiredHistoricalCodeId == studentCourseTaken.HistoricalCodeId) && ((CourseBases)studentCourseTaken.BasisId == CourseBases.Credit))
- {
- return true;
- }
- }
- else
- {
- var requiredGradePosition = possibleGrades.IndexOf(requiredGrade);
- var achievedGradePosition = possibleGrades.IndexOf(studentCourseTaken.Grade);
- if ((requiredHistoricalCodeId == studentCourseTaken.HistoricalCodeId) && (requiredGradePosition <= achievedGradePosition) && ((CourseBases)studentCourseTaken.BasisId == CourseBases.Credit))
- {
- return true;
- }
- }
- }
- //TODO-Lazov There was another requirement about course allowing to be counted as taken if it's been currently been taken
- // If during pre-registration, then check if the student is not taking the course now
- if ((currentRegPeriod == CourseRegPeriods.PreRegistration) && (requirement.CountCoursesInProgress == true))
- {
- foreach (var course in coursesInProgress)
- {
- if ((requiredHistoricalCodeId == course.HistoricalCodeId))
- {
- return true;
- }
- }
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement