Commit b8bb8fe8 authored by David Monllaó's avatar David Monllaó
Browse files

MDL-60434 analytics: Remove legacy is_valid method

This method was used when the API was tied to students at risk model,
this method does not make sense any more as it is up to each target
to define what is a valid course.
parent 84940517
......@@ -365,20 +365,6 @@ class course implements \core_analytics\analysable {
return $this->course;
}
/**
* Is the course valid to extract indicators from it?
*
* @return bool
*/
public function is_valid() {
if (!$this->was_started() || !$this->is_finished()) {
return false;
}
return true;
}
/**
* Has the course started?
*
......
......@@ -86,7 +86,6 @@ class core_analytics_course_testcase extends advanced_testcase {
$courseman = new \core_analytics\course($this->course->id);
$this->assertFalse($courseman->was_started());
$this->assertFalse($courseman->is_finished());
$this->assertFalse($courseman->is_valid());
// Nothing should change when assigning as teacher.
for ($i = 0; $i < 10; $i++) {
......@@ -94,7 +93,8 @@ class core_analytics_course_testcase extends advanced_testcase {
$this->getDataGenerator()->enrol_user($user->id, $this->course->id, $this->teacherroleid);
}
$courseman = new \core_analytics\course($this->course->id);
$this->assertFalse($courseman->is_valid());
$this->assertFalse($courseman->was_started());
$this->assertFalse($courseman->is_finished());
// More students now.
for ($i = 0; $i < 10; $i++) {
......@@ -102,7 +102,8 @@ class core_analytics_course_testcase extends advanced_testcase {
$this->getDataGenerator()->enrol_user($user->id, $this->course->id, $this->studentroleid);
}
$courseman = new \core_analytics\course($this->course->id);
$this->assertFalse($courseman->is_valid());
$this->assertFalse($courseman->was_started());
$this->assertFalse($courseman->is_finished());
// Valid start date unknown end date.
$this->course->startdate = gmmktime('0', '0', '0', 10, 24, 2015);
......@@ -110,7 +111,6 @@ class core_analytics_course_testcase extends advanced_testcase {
$courseman = new \core_analytics\course($this->course->id);
$this->assertTrue($courseman->was_started());
$this->assertFalse($courseman->is_finished());
$this->assertFalse($courseman->is_valid());
// Valid start and end date.
$this->course->enddate = gmmktime('0', '0', '0', 8, 27, 2016);
......@@ -118,7 +118,6 @@ class core_analytics_course_testcase extends advanced_testcase {
$courseman = new \core_analytics\course($this->course->id);
$this->assertTrue($courseman->was_started());
$this->assertTrue($courseman->is_finished());
$this->assertTrue($courseman->is_valid());
// Valid start and ongoing course.
$this->course->enddate = gmmktime('0', '0', '0', 8, 27, 2286);
......@@ -126,7 +125,6 @@ class core_analytics_course_testcase extends advanced_testcase {
$courseman = new \core_analytics\course($this->course->id);
$this->assertTrue($courseman->was_started());
$this->assertFalse($courseman->is_finished());
$this->assertFalse($courseman->is_valid());
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment