-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename gauging stations to monitoring stations (#1415)
https://eaflood.atlassian.net/browse/WATER-4679 When we first added gauging stations as a model to this project it was as part of our work to migrate the view licence page. Its summary tab will display any gauging stations the licence is linked to. Though that's not really true! It displays the 'Monitoring stations' a licence is linked to. If you click through one that is listed, the page you'll see will be on the URL `/monitoring-stations` (both legacy and ours). The results are displayed under the section titled 'Monitoring stations' if you use the main search. When we migrated the view licence page, we challenged why we still refer to them as 'Gauging stations' and whether we should update the UI to match. The answer we got back was that though 'Gauging stations' is commonly used by the users we speak to, they are only one type of station that we have in our system. So, when this feature was added it was agreed to use the generic term 'Monitoring stations'. What we now have is one of those discrepancies we often find in the legacy code which causes confusion. The DB and/or code are named differently from what we see in the UI. So, before we do anything too adventurous with them, this change updates anything named 'gauging station' to be 'monitoring station'.
- Loading branch information
1 parent
0b6d9a1
commit 3f56827
Showing
24 changed files
with
417 additions
and
321 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
'use strict' | ||
|
||
/** | ||
* Model for licence_monitoring_stations (water.licence_monitoring_stations) | ||
* @module LicenceMonitoringStationModel | ||
*/ | ||
|
||
const { Model } = require('objection') | ||
|
||
const BaseModel = require('./base.model.js') | ||
|
||
class LicenceMonitoringStationModel extends BaseModel { | ||
static get tableName () { | ||
return 'licenceMonitoringStations' | ||
} | ||
|
||
static get relationMappings () { | ||
return { | ||
monitoringStation: { | ||
relation: Model.BelongsToOneRelation, | ||
modelClass: 'monitoring-station.model', | ||
join: { | ||
from: 'licenceMonitoringStations.monitoringStationId', | ||
to: 'monitoringStations.id' | ||
} | ||
}, | ||
licence: { | ||
relation: Model.BelongsToOneRelation, | ||
modelClass: 'licence.model', | ||
join: { | ||
from: 'licenceMonitoringStations.licenceId', | ||
to: 'licences.id' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
module.exports = LicenceMonitoringStationModel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
db/migrations/public/20241016161831_rename-water-gauging-stations-view.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
'use strict' | ||
|
||
exports.up = function (knex) { | ||
return knex | ||
.schema | ||
.dropViewIfExists('gauging_stations') | ||
.createView('monitoring_stations', (view) => { | ||
view.as(knex('gauging_stations').withSchema('water').select([ | ||
'gauging_station_id AS id', | ||
'label', | ||
'lat', | ||
'long', | ||
'easting', | ||
'northing', | ||
'grid_reference', | ||
'catchment_name ', | ||
'river_name', | ||
'wiski_id', | ||
'station_reference', | ||
'status', | ||
'metadata', | ||
'hydrology_station_id', | ||
// 'is_test' | ||
'date_created AS created_at', | ||
'date_updated AS updated_at' | ||
])) | ||
}) | ||
} | ||
|
||
exports.down = function (knex) { | ||
return knex | ||
.schema | ||
.dropViewIfExists('monitoring_stations') | ||
.createView('gauging_stations', (view) => { | ||
view.as(knex('gauging_stations').withSchema('water').select([ | ||
'gauging_station_id AS id', | ||
'label', | ||
'lat', | ||
'long', | ||
'easting', | ||
'northing', | ||
'grid_reference', | ||
'catchment_name ', | ||
'river_name', | ||
'wiski_id', | ||
'station_reference', | ||
'status', | ||
'metadata', | ||
'hydrology_station_id', | ||
// 'is_test' | ||
'date_created AS created_at', | ||
'date_updated AS updated_at' | ||
])) | ||
}) | ||
} |
Oops, something went wrong.