Code Duplication    Length = 8-10 lines in 2 locations

includes/class-sensei-grading-main.php 2 locations

@@ 152-161 (lines=10) @@
149
			'status' => 'any',
150
		);
151
152
		if( $this->lesson_id ) {
153
			$activity_args['post_id'] = $this->lesson_id;
154
		}
155
		elseif( $this->course_id ) {
156
			// Currently not possible to restrict to a single Course, as that requires WP_Comment to support multiple
157
			// post_ids (i.e. every lesson within the Course), WP 4.1 ( https://core.trac.wordpress.org/changeset/29808 )
158
			if ( version_compare($wp_version, '4.1', '>=') ) {
159
				$activity_args['post__in'] = Sensei()->course->course_lessons( $this->course_id, 'any', 'ids' );
160
			}
161
		}
162
		// Sub select to group of learners
163
		if ( $this->user_ids ) {
164
			$activity_args['user_id'] = (array) $this->user_ids;
@@ 358-365 (lines=8) @@
355
		$query_args = array(
356
			'page' => $this->page_slug,
357
		);
358
		if( $this->course_id ) {
359
			// Currently not possible to restrict to a single Course, as that requires WP_Comment to support multiple
360
			// post_ids (i.e. every lesson within the Course), WP 4.1 ( https://core.trac.wordpress.org/changeset/29808 )
361
			$query_args['course_id'] = $this->course_id;
362
			if ( version_compare($wp_version, '4.1', '>=') ) {
363
				$count_args['post__in'] = Sensei()->course->course_lessons( $this->course_id, 'any', 'ids' );
364
			}
365
		}
366
		if( $this->lesson_id ) {
367
			$query_args['lesson_id'] = $this->lesson_id;
368
			// Restrict to a single lesson