Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
johnvanbreda committed Jul 19, 2017
2 parents f088f7e + ec751cc commit e715ada
Show file tree
Hide file tree
Showing 16 changed files with 363 additions and 244 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.idea/*
/nbproject/private/
/nbproject/*
.DS_Store
4 changes: 2 additions & 2 deletions application/config/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
/**
* @var string The application files version number.
*/
$config['version'] = '1.36.2';
$config['release_date'] = '2017-07-17';
$config['version'] = '1.37.0';
$config['release_date'] = '2017-07-19';
$config['repository'] = 'https://github.com/Indicia-Team/warehouse/releases';

2 changes: 2 additions & 0 deletions application/libraries/XMLReportReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,8 @@ private function autogenColumns() {
$countSql[] = $def['internal_sql'];
}
}
} elseif ($col === 'date' && $def['datatype'] === 'date' && $this->vagueDateProcessing) {
$sql[] = 'null as date';
}
}
if (count($distinctSql)>0) {
Expand Down
2 changes: 1 addition & 1 deletion media
14 changes: 13 additions & 1 deletion modules/cache_builder/config/cache_builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -1342,6 +1342,12 @@
), reduce_precision(coalesce(s.geom, l.centroid_geom), o.confidential, greatest(o.sensitivity_precision, s.privacy_precision),
case when s.entered_sref_system is null then l.centroid_sref_system else s.entered_sref_system end)
),
output_sref_system=get_output_system(
reduce_precision(coalesce(s.geom, l.centroid_geom), o.confidential, greatest(o.sensitivity_precision, s.privacy_precision),
case when s.entered_sref_system is null then l.centroid_sref_system else s.entered_sref_system end),
case when s.entered_sref_system is null then l.centroid_sref_system else s.entered_sref_system end,
'4326'
),
verifier=pv.surname || ', ' || pv.first_name,
licence_code=li.code,
attr_sex_stage=CASE a_sex_stage.data_type
Expand Down Expand Up @@ -1545,7 +1551,7 @@

$config['occurrences']['insert']['nonfunctional'] = "
INSERT INTO cache_occurrences_nonfunctional(
id, comment, sensitivity_precision, privacy_precision, output_sref, licence_code)
id, comment, sensitivity_precision, privacy_precision, output_sref, output_sref_system, licence_code)
SELECT o.id,
o.comment, o.sensitivity_precision,
s.privacy_precision,
Expand Down Expand Up @@ -1584,6 +1590,12 @@
), reduce_precision(coalesce(s.geom, l.centroid_geom), o.confidential, greatest(o.sensitivity_precision, s.privacy_precision),
case when s.entered_sref_system is null then l.centroid_sref_system else s.entered_sref_system end)
),
get_output_system(
reduce_precision(coalesce(s.geom, l.centroid_geom), o.confidential, greatest(o.sensitivity_precision, s.privacy_precision),
case when s.entered_sref_system is null then l.centroid_sref_system else s.entered_sref_system end),
case when s.entered_sref_system is null then l.centroid_sref_system else s.entered_sref_system end,
'4326'
),
li.code
FROM occurrences o
#join_needs_update#
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE cache_occurrences_nonfunctional ADD COLUMN output_sref_system character varying;
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-- #slow script#

UPDATE cache_occurrences_nonfunctional onf
SET output_sref_system=get_output_system(
reduce_precision(coalesce(s.geom, l.centroid_geom), o.confidential, greatest(o.sensitivity_precision, s.privacy_precision),
case when s.entered_sref_system is null then l.centroid_sref_system else s.entered_sref_system end),
case when s.entered_sref_system is null then l.centroid_sref_system else s.entered_sref_system end,
'4326'
)
FROM occurrences o
JOIN samples s ON s.id=o.sample_id AND s.deleted=false
LEFT JOIN locations l ON l.id=s.location_id AND l.deleted=false
WHERE onf.id=o.id;
32 changes: 16 additions & 16 deletions modules/indicia_svc_data/tests/controllers/services/reportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public function testRequestReportGetJson() {
$response = self::getResponse($url);
// valid json response will decode
$response = json_decode($response, true);
$this->assertFalse(isset($response['error']), "testRequestReportGetJson returned error. See log for details");
$this->assertFalse(isset($response['error']), "testRequestReportGetJson returned error. $response[error]");
$this->assertNotCount(0, $response, "Database contains no records to report on");
$this->assertTrue(isset($response[0]['title']), 'Report get JSON response not as expected');
}
Expand All @@ -285,7 +285,7 @@ public function testRequestReportPostJson() {
$response = self::getResponse($url, TRUE, $params);
// valid json response will decode
$response = json_decode($response, true);
$this->assertFalse(isset($response['error']), "testRequestReportPostJson returned error. See log for details");
$this->assertFalse(isset($response['error']), "testRequestReportPostJson returned error. $response[error]");
$this->assertTrue(isset($response[0]['title']), 'Report post JSON response not as expected');
}

Expand All @@ -302,7 +302,7 @@ public function testRequestReportGetXML() {
$response = self::getResponse($url);
// valid xml response will decode
$response = new SimpleXmlElement($response, true);
$this->assertFalse(isset($response->error), "testRequestReportGetXML returned error. See log for details");
$this->assertFalse(isset($response->error), "testRequestReportGetXML returned error. $response->");
$this->assertTrue(isset($response->record[0]->title), 'Report get XML response not as expected');
}

Expand All @@ -319,7 +319,7 @@ public function testRequestReportPostXML() {
$response = self::getResponse($url, TRUE, $params);
// valid xml response will decode
$response = new SimpleXmlElement($response, true);
$this->assertFalse(isset($response->error), "testRequestReportPostXML returned error. See log for details");
$this->assertFalse(isset($response->error), "testRequestReportPostXML returned error. $response->error");
$this->assertTrue(isset($response->record[0]->title), 'Report post XML response not as expected');
}

Expand All @@ -340,7 +340,7 @@ public function testAdvancedReport() {
$response = self::getResponse($url, TRUE, $params);
// valid json response will decode
$response = json_decode($response, true);
$this->assertFalse(isset($response['error']), "testAdvancedReport returned error. See log for details");
$this->assertFalse(isset($response['error']), "testAdvancedReport returned error. $response[error]");
$this->assertCount(1, $response, 'Advanced report response should only include 1 record');
$this->assertTrue(isset($response[0]['name']), 'Advanced report did not return a name column');
$this->assertEquals('Test location', $response[0]['name'],
Expand All @@ -366,7 +366,7 @@ public function testAdvancedReportByAttrId() {
$response = self::getResponse($url, TRUE, $params);
// valid json response will decode
$response = json_decode($response, true);
$this->assertFalse(isset($response['error']), "testAdvancedReportByAttrId returned error. See log for details");
$this->assertFalse(isset($response['error']), "testAdvancedReportByAttrId returned error. $response[error]");
$this->assertTrue(array_key_exists('attr_location_1', $response[0]),
'Advanced report should return column for test_text by ID');
}
Expand All @@ -384,7 +384,7 @@ public function testReportRequestsParams() {
$response = self::getResponse($url, TRUE, $params);
// valid json response will decode
$response = json_decode($response, true);
$this->assertFalse(isset($response['error']), "testReportRequestsParams returned error. See log for details");
$this->assertFalse(isset($response['error']), "testReportRequestsParams returned error. $response[error]");
$this->assertTrue(isset($response['parameterRequest']), 'Report should request parameters');
}

Expand All @@ -408,7 +408,7 @@ public function testLookupCustomAttrs() {
Kohana::log('debug', "Running unit test, Controllers_Services_Report_Test::testLookupCustomAttrs");
$response = $this->getReportResponse(
'library/locations/locations_list.xml', array('locattrs' => 'Test lookup', 'location_type_id' => 2));
$this->assertFalse(isset($response['error']), "testLookupCustomAttrs returned error. See log for details");
$this->assertFalse(isset($response['error']), "testLookupCustomAttrs returned error. $response[error]");
$this->assertCount(1, $response, 'Report response should only include 1 record');
$this->assertTrue(array_key_exists('attr_location_test_lookup', $response[0]),
'Locations report should return column for test_lookup');
Expand All @@ -425,7 +425,7 @@ public function testReportLibraryLocationsFilterableRecordCountsLeague() {
'library/locations/filterable_record_counts_league.xml', array('location_type_id' => 2));
// Simply testing that the report parses and the SQL runs
$this->assertFalse(isset($response['error']),
"testReportLibraryLocationsFilterableRecordCountsLeague returned error. See log for details");
"testReportLibraryLocationsFilterableRecordCountsLeague returned error. $response[error]");
}

public function testReportLibraryLocationsFilterableRecordCountsLeagueLinked() {
Expand All @@ -435,7 +435,7 @@ public function testReportLibraryLocationsFilterableRecordCountsLeagueLinked() {
'library/locations/filterable_record_counts_league_linked.xml', array('location_type_id' => 2));
// Simply testing that the report parses and the SQL runs
$this->assertFalse(isset($response['error']),
"testReportLibraryLocationsFilterableRecordCountsLeague returned error. See log for details");
"testReportLibraryLocationsFilterableRecordCountsLeague returned error. $response[error]");
}

public function testReportLibraryLocationsFilterableSpeciesCountsLeague() {
Expand All @@ -445,7 +445,7 @@ public function testReportLibraryLocationsFilterableSpeciesCountsLeague() {
'library/locations/filterable_species_counts_league.xml', array('location_type_id' => 2));
// Simply testing that the report parses and the SQL runs
$this->assertFalse(isset($response['error']),
"testReportLibraryLocationsFilterableRecordCountsLeague returned error. See log for details");
"testReportLibraryLocationsFilterableRecordCountsLeague returned error. $response[error]");
}

public function testReportLibraryLocationsFilterableSpeciesCountsLeagueLinked() {
Expand All @@ -455,7 +455,7 @@ public function testReportLibraryLocationsFilterableSpeciesCountsLeagueLinked()
'library/locations/filterable_species_counts_league_linked.xml', array('location_type_id' => 2));
// Simply testing that the report parses and the SQL runs
$this->assertFalse(isset($response['error']),
"testReportLibraryLocationsFilterableRecordCountsLeague returned error. See log for details");
"testReportLibraryLocationsFilterableRecordCountsLeague returned error. $response[error]");
}

public function testReportLibraryLocationsLocationsList() {
Expand All @@ -465,15 +465,15 @@ public function testReportLibraryLocationsLocationsList() {
'library/locations/locations_list.xml', array('location_type_id' => 2, 'locattrs' => ''));
// Simply testing that the report parses and the SQL runs
$this->assertFalse(isset($response['error']), 'testReportLibraryLocationsLocationsList returned error ' .
'when passed integer location type id. See log for details');
"when passed integer location type id. $response[error]");
$this->assertCount(1, $response, 'Report response should only include 1 record');
$this->assertEquals($response[0]['name'], 'Test location',
'Locations list report returned incorrect location name.');
$response = $this->getReportResponse(
'library/locations/locations_list.xml', array('location_type_id' => 'Test location type', 'locattrs' => ''));
// Simply testing that the report parses and the SQL runs
$this->assertFalse(isset($response['error']), 'testReportLibraryLocationsLocationsList returned error ' .
'when passed a string location type id. See log for details');
"when passed a string location type id. $response[error]");
$this->assertCount(1, $response, 'Report response should only include 1 record');
$this->assertEquals($response[0]['name'], 'Test location',
'Locations list report returned incorrect location name.');
Expand All @@ -486,15 +486,15 @@ public function testReportLibraryLocationsLocationsList2() {
'library/locations/locations_list_2.xml', array('location_type_id' => 2, 'locattrs' => ''));
// Simply testing that the report parses and the SQL runs
$this->assertFalse(isset($response['error']),
"testReportLibraryLocationsLocationsList2 returned an error. See log for details");
"testReportLibraryLocationsLocationsList2 returned an error. $response[error]");
$this->assertCount(1, $response, 'Report response should only include 1 record');
$this->assertEquals($response[0]['name'], 'Test location',
'Locations list report returned incorrect location name.');
$response = $this->getReportResponse(
'library/locations/locations_list_2.xml', array('location_type_id' => 99999, 'locattrs' => ''));
// Simply testing that the report parses and the SQL runs
$this->assertFalse(isset($response['error']), 'testReportLibraryLocationsLocationsList2 returned an error '.
'when filtering for a missing location type ID. See log for details');
"when filtering for a missing location type ID. $response[error]");
$this->assertCount(0, $response, 'Report response be empty, location type filter failed');
}

Expand Down
Loading

0 comments on commit e715ada

Please sign in to comment.