Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Grades that have been improved to 100% should not be displayed #52

Merged
merged 1 commit into from

2 participants

@mfairchild365

Fixes #49

@kabel kabel was assigned by mfairchild365
@mfairchild365

Thanks @kabel for helping with this fix

@kabel kabel merged commit 401e1f7 into UNLSiteMaster:master

1 check passed

Details default The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
27 src/SiteMaster/Core/Auditor/Site/Page/MetricGrades/ForScanAndMetric.php
@@ -35,14 +35,6 @@ public function getDefaultOptions()
return $options;
}
-
- public function getWhere()
- {
- return 'WHERE scanned_page.scans_id = ' .(int)$this->options['scans_id']
- . ' AND page_metric_grades.metrics_id = ' . (int)$this->options['metrics_id']
- . ' AND page_metric_grades.point_grade != page_metric_grades.points_available'
- . ' AND page_metric_grades.incomplete = "NO"';
- }
public function getLimit()
{
@@ -57,13 +49,20 @@ public function getLimit()
public function getSQL()
{
//Build the list
- $sql = "SELECT max(page_metric_grades.id) as id
+ $sql = "SELECT page_metric_grades.id as id
FROM page_metric_grades
- JOIN scanned_page ON (page_metric_grades.scanned_page_id = scanned_page.id)
- " . $this->getWhere() . "
- GROUP BY scanned_page.uri_hash
- ORDER BY page_metric_grades.point_grade ASC
- " . $this->getLimit();
+ JOIN (SELECT MAX(page_metric_grades.id) as id
+ FROM page_metric_grades
+ JOIN scanned_page ON (page_metric_grades.scanned_page_id = scanned_page.id)
+ WHERE scanned_page.scans_id = " .(int)$this->options['scans_id'] . "
+ AND page_metric_grades.metrics_id = " . (int)$this->options['metrics_id'] . "
+ AND page_metric_grades.incomplete = 'NO'
+ GROUP BY scanned_page.uri_hash
+ ) as grades ON (grades.id = page_metric_grades.id)
+ WHERE
+ page_metric_grades.point_grade != page_metric_grades.points_available
+ ORDER BY page_metric_grades.point_grade ASC
+ " . $this->getLimit();
return $sql;
}
View
12 tests/SiteMaster/Core/Auditor/ScanDBTest.php
@@ -366,6 +366,18 @@ public function getHotSpots()
$hot_spots = $scan->getHotSpots($metric->getMetricRecord()->id);
$this->assertEquals(array(2, 3), $hot_spots->getInnerIterator()->getArrayCopy(), 'Only the newest page scans should be returned');
+
+ //Now, fix /test so it has 100%. It should not show up in the hot spots
+ //Now do the same for a new page, simulating a single page scan with an improvement (less marks)
+ $page_4 = Page::createNewPage($scan->id, $site->id, self::INTEGRATION_TESTING_URL . 'test');
+
+ $metric->grade($page_4, true);
+ $page_4->grade();
+
+ //Get the hot spots
+ $hot_spots = $scan->getHotSpots($metric->getMetricRecord()->id);
+
+ $this->assertEquals(array(3), $hot_spots->getInnerIterator()->getArrayCopy(), 'Fixed pages should not show up in the list of hot sports');
}
public function setUpDB()
Something went wrong with that request. Please try again.