/** * Determines if the course has had the minimum number of students in previous teachings. * First, looks into Moodle core tables for existing previous students. If it doesn't find any, it tries luck in * plugin's historic table. If it doesn't found neither here, means that the course has not previous students. * * @param int $courseid The course to determine if meets the minimum students. * @param int $currentyear The year of the given current course. * @param \block_mycourse_recommendations\database_helper $db The object with deals with database. * @return boolean If the given course has the minimum students or not. */ public static function meets_minimum_previous_students($courseid, $currentyear, $db) { $previousstudents = $db->get_previous_courses_students_number_core_tables($courseid, $currentyear); $minimum = false; if ($previousstudents >= self::MINIMUM_PREVIOUS_STUDENTS) { $minimum = true; } if (!$minimum) { $previousstudents = $db->get_previous_courses_resources_number_historic_tables($courseid, $currentyear); if ($previousstudents >= self::MINIMUM_PREVIOUS_STUDENTS) { $minimum = true; } } return $minimum; }