LLMS_Analytics::course_completion_percentage( $students )


Description Description


Source Source

File: includes/class.llms.analytics.php

	public static function course_completion_percentage( $students ) {

		if ( $students ) {

			$total_students  = count( $students );
			$total_done = 0;

			foreach ( $students as $student ) {
				if ( ! is_null( $student->completed_date ) ) {
					$total_done++;
				}
			}

			if ( 0 == $total_students ) {
				return 0;
			} else {
				return $total_done / $total_students;
			}
		}
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.