Skip to content

Commit

Permalink
[Oxfordshire] Fix double drain message.
Browse files Browse the repository at this point in the history
  • Loading branch information
dracos committed Feb 6, 2025
1 parent db6e184 commit 653bf43
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions web/cobrands/fixmystreet-uk-councils/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -1087,11 +1087,10 @@ fixmystreet.assets.oxfordshire.owned_asset_found = function(asset) {
};

fixmystreet.assets.oxfordshire.drain_construct_selected_asset_message = function(asset) {
var type = this.fixmystreet.http_options.params.TYPENAME.slice(0, -1);
var junctionInspectionLayer = window.fixmystreet.assets.layers.filter(function(elem) {
return elem.fixmystreet.body == "Oxfordshire County Council" &&
elem.fixmystreet.http_options &&
elem.fixmystreet.http_options.format.featureType == type + '_inspections';
elem.fixmystreet.http_options.format.featureType == 'junction_inspections';
});
var inspection;
if (junctionInspectionLayer[0]) {
Expand All @@ -1101,7 +1100,7 @@ fixmystreet.assets.oxfordshire.drain_construct_selected_asset_message = function
});
}
var last_clean = '';
var message = ' ';
var message = '';

Check warning on line 1103 in web/cobrands/fixmystreet-uk-councils/assets.js

View check run for this annotation

Codecov / codecov/patch

web/cobrands/fixmystreet-uk-councils/assets.js#L1103

Added line #L1103 was not covered by tests
if (inspection && inspection[0]) {
if (asset.attributes.last_inspected && (inspection[0].attributes.junction_cleaned === 'true' || inspection[0].attributes.channel_cleaned === 'true')) {
last_clean = occ_format_date(asset.attributes.last_inspected);
Expand All @@ -1127,7 +1126,7 @@ function occ_format_date(date_field) {
// may not have loaded. So make sure we poke for a check when the data comes
// in.
function occ_inspection_layer_loadend() {
var type = this.fixmystreet.http_options.params.TYPENAME.replace('_inspections', 's');
var type = this.fixmystreet.http_options.params.TYPENAME.replace(/_inspections/g, 's');

Check warning on line 1129 in web/cobrands/fixmystreet-uk-councils/assets.js

View check run for this annotation

Codecov / codecov/patch

web/cobrands/fixmystreet-uk-councils/assets.js#L1129

Added line #L1129 was not covered by tests
var layer = fixmystreet.assets.layers.filter(function(elem) {
return test_layer_typename(elem.fixmystreet, "Oxfordshire County Council", type);
});
Expand All @@ -1137,11 +1136,7 @@ function occ_inspection_layer_loadend() {
if (fixmystreet.cobrand == 'oxfordshire' || fixmystreet.cobrand == 'fixmystreet') {
$(function(){
var layer;
layer = fixmystreet.map.getLayersByName('Oxon Junction Inspections')[0];
if (layer) {
layer.events.register( 'loadend', layer, occ_inspection_layer_loadend);
}
layer = fixmystreet.map.getLayersByName('Oxon Channel Inspections')[0];
layer = fixmystreet.map.getLayersByName('Oxon Drain Inspections')[0];
if (layer) {
layer.events.register( 'loadend', layer, occ_inspection_layer_loadend);
}
Expand Down

0 comments on commit 653bf43

Please sign in to comment.