From a31afb606a4236e185134d2b91e730bc60e84a55 Mon Sep 17 00:00:00 2001 From: MiraGeowerkstatt Date: Wed, 14 Feb 2024 16:05:04 +0100 Subject: [PATCH] Rename kind to borehole_type --- src/api-legacy/v1/action.py | 6 ++--- src/api-legacy/v1/borehole/editinglist.py | 4 ++-- src/api-legacy/v1/borehole/export/exporter.py | 2 +- .../v1/borehole/export/profile/bdms_pdf.py | 4 ++-- src/api-legacy/v1/borehole/get.py | 2 +- src/api-legacy/v1/borehole/list.py | 6 ++--- src/api-legacy/v1/borehole/patch.py | 4 ++-- src/api/BdmsContext.cs | 2 +- src/api/BdmsContextExtensions.cs | 6 ++--- src/api/Controllers/UploadController.cs | 2 +- src/api/Models/Borehole.cs | 8 +++---- src/client/public/locale/common.json | 2 +- src/client/public/locale/de/common.json | 2 +- src/client/public/locale/en/common.json | 2 +- src/client/public/locale/fr/common.json | 2 +- src/client/public/locale/it/common.json | 2 +- src/client/src/api-lib/reducers/index.js | 2 +- .../src/commons/detail/detailsComponent.js | 23 +++++++++++-------- .../src/commons/detail/meta/metaComponent.js | 2 +- .../segments/boreholeGeneralSegment.js | 10 ++++---- .../src/commons/form/multiple/multipleForm.js | 4 ++-- .../commons/search/data/boreholeSearchData.js | 8 +++---- .../search/editor/searchEditorState.js | 2 +- src/client/src/commons/search/searchState.js | 2 +- .../src/commons/table/boreholeEditorTable.js | 4 ++-- src/client/src/commons/table/boreholeTable.js | 18 ++++++++------- .../pages/settings/data/boreholeEditorData.js | 4 ++-- src/client/src/pages/settings/settingState.js | 4 ++-- tests/Controllers/BoreholeControllerTest.cs | 6 ++--- 29 files changed, 76 insertions(+), 69 deletions(-) diff --git a/src/api-legacy/v1/action.py b/src/api-legacy/v1/action.py index 3fdcf8434..3d7f9674c 100644 --- a/src/api-legacy/v1/action.py +++ b/src/api-legacy/v1/action.py @@ -72,7 +72,7 @@ def getordering(self, orderby, direction): elif orderby == 'length': _orderby = 'total_depth' - elif orderby == 'kind': + elif orderby == 'borehole_type': _orderby = 'kind_id_cli' elif orderby == 'restriction_until': @@ -499,8 +499,8 @@ def filterBorehole(self, filter={}): project_name_bho ILIKE %s """ % self.getIdx()) - if 'kind' in keys and filter['kind'] not in ['', None]: - params.append(int(filter['kind'])) + if 'borehole_type' in keys and filter['borehole_type'] not in ['', None]: + params.append(int(filter['borehole_type'])) where.append(""" kind_id_cli = %s """ % self.getIdx()) diff --git a/src/api-legacy/v1/borehole/editinglist.py b/src/api-legacy/v1/borehole/editinglist.py index 0600bc58a..a7180feee 100644 --- a/src/api-legacy/v1/borehole/editinglist.py +++ b/src/api-legacy/v1/borehole/editinglist.py @@ -83,7 +83,7 @@ async def execute( ) END AS lock, original_name_bho as original_name, - kind_id_cli as kind, + kind_id_cli as borehole_type, restriction_id_cli as restriction, to_char( restriction_until_bho, @@ -185,7 +185,7 @@ async def execute( array_agg( json_build_object( 'id', id, - 'kind', kind, + 'borehole_type', borehole_type, 'layers', layers, 'date', date ) diff --git a/src/api-legacy/v1/borehole/export/exporter.py b/src/api-legacy/v1/borehole/export/exporter.py index 9feb6ce56..6d17b2b8a 100644 --- a/src/api-legacy/v1/borehole/export/exporter.py +++ b/src/api-legacy/v1/borehole/export/exporter.py @@ -128,7 +128,7 @@ async def get(self, *args, **kwargs): COALESCE( cli_kind.text_cli_{lan}, cli_kind.text_cli_{fallback} - ) as kind, + ) as borehole_type, location_x_bho as location_e, location_y_bho as location_n, COALESCE(elevation_z_bho, 0) as elevation_z, diff --git a/src/api-legacy/v1/borehole/export/profile/bdms_pdf.py b/src/api-legacy/v1/borehole/export/profile/bdms_pdf.py index 3b0812cb1..127b8a616 100644 --- a/src/api-legacy/v1/borehole/export/profile/bdms_pdf.py +++ b/src/api-legacy/v1/borehole/export/profile/bdms_pdf.py @@ -657,8 +657,8 @@ def renderProfilePDF(self, lang, scale=1000): self.drawLeftTextBox2( 2*column_width, current_y, column_width, box_height, - 'none', 'contentB', _('kind'), - 'content', '{}'.format(self.profile['kind'] or '-') + 'none', 'contentB', _('borehole_type'), + 'content', '{}'.format(self.profile['borehole_type'] or '-') ) current_y += box_height diff --git a/src/api-legacy/v1/borehole/get.py b/src/api-legacy/v1/borehole/get.py index 549361e49..bbd0f1adb 100644 --- a/src/api-legacy/v1/borehole/get.py +++ b/src/api-legacy/v1/borehole/get.py @@ -261,7 +261,7 @@ def get_sql(sql_lock='', file_permission=''): array_agg( json_build_object( 'id', id, - 'kind', kind, + 'borehole_type', borehole_type, 'name', "name", 'primary', "primary", 'layers', layers, diff --git a/src/api-legacy/v1/borehole/list.py b/src/api-legacy/v1/borehole/list.py index dbe655d68..2cd7ef5d8 100644 --- a/src/api-legacy/v1/borehole/list.py +++ b/src/api-legacy/v1/borehole/list.py @@ -22,7 +22,7 @@ def get_sql_text(language='en', cols=None): COALESCE( knd.text_cli_{language}, knd.text_cli_{fallback} - ) as kind, + ) as borehole_type, COALESCE( rest.text_cli_{language}, @@ -215,7 +215,7 @@ def get_sql_geolcode(cols=None, join=None, where=None): original_name_bho as original_name, project_name_bho as project_name, alternate_name_bho as alternate_name, - knd.geolcode as kind, + knd.geolcode as borehole_type, rest.geolcode as restriction, to_char( @@ -381,7 +381,7 @@ def get_sql(): ) t ) as creator, original_name_bho as original_name, - kind_id_cli as kind, + kind_id_cli as borehole_type, restriction_id_cli as restriction, to_char( restriction_until_bho, diff --git a/src/api-legacy/v1/borehole/patch.py b/src/api-legacy/v1/borehole/patch.py index cf98f373a..cdb7e1545 100644 --- a/src/api-legacy/v1/borehole/patch.py +++ b/src/api-legacy/v1/borehole/patch.py @@ -113,7 +113,7 @@ def get_column(field): elif field == 'national_interest': column = 'national_interest' - elif field == 'kind': + elif field == 'borehole_type': column = 'kind_id_cli' elif field == 'spatial_reference_system': @@ -271,7 +271,7 @@ async def execute(self, id, field, value, user): elif field in [ 'restriction', - 'kind', + 'borehole_type', 'spatial_reference_system', 'location_precision', 'elevation_precision', diff --git a/src/api/BdmsContext.cs b/src/api/BdmsContext.cs index 82931d5bf..34e7e0560 100644 --- a/src/api/BdmsContext.cs +++ b/src/api/BdmsContext.cs @@ -118,7 +118,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) modelBuilder.Entity().HasOne(l => l.Chronostratigraphy).WithMany().HasForeignKey(l => l.ChronostratigraphyId); modelBuilder.Entity().HasOne(l => l.Cuttings).WithMany().HasForeignKey(l => l.CuttingsId); modelBuilder.Entity().HasOne(l => l.DrillingMethod).WithMany().HasForeignKey(l => l.DrillingMethodId); - modelBuilder.Entity().HasOne(l => l.Kind).WithMany().HasForeignKey(l => l.KindId); + modelBuilder.Entity().HasOne(l => l.Type).WithMany().HasForeignKey(l => l.TypeId); modelBuilder.Entity().HasOne(l => l.Hrs).WithMany().HasForeignKey(l => l.HrsId); modelBuilder.Entity().HasOne(l => l.LithologyTopBedrock).WithMany().HasForeignKey(l => l.LithologyTopBedrockId); modelBuilder.Entity().HasOne(l => l.Lithostratigraphy).WithMany().HasForeignKey(l => l.LithostratigraphyId); diff --git a/src/api/BdmsContextExtensions.cs b/src/api/BdmsContextExtensions.cs index cac1af931..e8ba17e5a 100644 --- a/src/api/BdmsContextExtensions.cs +++ b/src/api/BdmsContextExtensions.cs @@ -58,7 +58,7 @@ public static void SeedData(this BdmsContext context) // local codelists, ordered by id because the order after migrations is not guaranteed List codelists = context.Codelists.OrderBy(c => c.Id).ToList(); - List kindIds = codelists.Where(c => c.Schema == "kind").Select(s => s.Id).ToList(); + List kindIds = codelists.Where(c => c.Schema == "borehole_type").Select(s => s.Id).ToList(); List srsIds = codelists.Where(c => c.Schema == "spatial_reference_system").Select(s => s.Id).ToList(); List hrsIds = codelists.Where(c => c.Schema == "height_reference_system").Select(s => s.Id).ToList(); List restrictionIds = codelists.Where(c => c.Schema == "restriction").Select(s => s.Id).ToList(); @@ -129,8 +129,8 @@ public static void SeedData(this BdmsContext context) .RuleFor(o => o.LocationYLV03, f => { if (borehole_ids % 10 < 5) return f.Random.Int(66750, 310750).OrNull(f, .1f); else return f.Random.Double(66750, 310750).OrNull(f, .1f); }) .RuleFor(o => o.OriginalReferenceSystem, f => f.PickRandom(ReferenceSystem.LV95, ReferenceSystem.LV03)) .RuleFor(o => o.ElevationZ, f => f.Random.Double(0, 4500)) - .RuleFor(o => o.KindId, f => f.PickRandom(kindIds).OrNull(f, .6f)) - .RuleFor(o => o.Kind, _ => default!) + .RuleFor(o => o.TypeId, f => f.PickRandom(kindIds).OrNull(f, .6f)) + .RuleFor(o => o.Type, _ => default!) .RuleFor(o => o.HrsId, f => f.PickRandom(hrsIds).OrNull(f, .1f)) .RuleFor(o => o.Hrs, _ => default!) .RuleFor(o => o.TotalDepth, f => f.Random.Double(0, 2000)) diff --git a/src/api/Controllers/UploadController.cs b/src/api/Controllers/UploadController.cs index 650c9e7d5..259090c29 100644 --- a/src/api/Controllers/UploadController.cs +++ b/src/api/Controllers/UploadController.cs @@ -461,7 +461,7 @@ public CsvImportBoreholeMap() Map(m => m.LockedById).Optional(); Map(m => m.WorkgroupId).Optional(); Map(m => m.IsPublic).Optional(); - Map(m => m.KindId).Optional(); + Map(m => m.TypeId).Optional(); Map(m => m.ElevationZ).Optional(); Map(m => m.HrsId).Optional(); Map(m => m.TotalDepth).Optional(); diff --git a/src/api/Models/Borehole.cs b/src/api/Models/Borehole.cs index c5fecc2b2..02a46a20f 100644 --- a/src/api/Models/Borehole.cs +++ b/src/api/Models/Borehole.cs @@ -71,15 +71,15 @@ public class Borehole : IChangeTracking, IIdentifyable public bool? IsPublic { get; set; } /// - /// Gets or sets the 's kind id. + /// Gets or sets the 's type id. /// [Column("kind_id_cli")] - public int? KindId { get; set; } + public int? TypeId { get; set; } /// - /// Gets or sets the 's kind. + /// Gets or sets the 's type. /// - public Codelist? Kind { get; set; } + public Codelist? Type { get; set; } /// /// Gets or sets the 's X-location using LV95 coordinates. diff --git a/src/client/public/locale/common.json b/src/client/public/locale/common.json index 26feeda2e..3437369a5 100644 --- a/src/client/public/locale/common.json +++ b/src/client/public/locale/common.json @@ -181,7 +181,7 @@ "invertedDepth": "", "inProgress": "", "italian": "", - "kind": "", + "borehole_type": "", "kindCasingLayer": "", "kindFilling": "", "kindInstrument": "", diff --git a/src/client/public/locale/de/common.json b/src/client/public/locale/de/common.json index f916c583e..4f382ff21 100644 --- a/src/client/public/locale/de/common.json +++ b/src/client/public/locale/de/common.json @@ -193,7 +193,7 @@ "instrument": "Instrumentierung", "invertedDepth": "Umgekehrte Tiefen", "italian": "Italienisch", - "kind": "Bohrtyp", + "borehole_type": "Bohrtyp", "kindCasingLayer": "Rohrtyp", "kindFilling": "Hinterfüllungs-/Verfüllungstyp", "kindInstrument": "Instrumentierungstyp", diff --git a/src/client/public/locale/en/common.json b/src/client/public/locale/en/common.json index 6ec718737..03c6f6e38 100644 --- a/src/client/public/locale/en/common.json +++ b/src/client/public/locale/en/common.json @@ -193,7 +193,7 @@ "instrument": "Instrumentation", "invertedDepth": "Inverted depths", "italian": "Italian", - "kind": "Borehole type", + "borehole_type": "Borehole type", "kindCasingLayer": "Casing type", "kindFilling": "Type of backfill / sealing", "kindInstrument": "Type of instrument", diff --git a/src/client/public/locale/fr/common.json b/src/client/public/locale/fr/common.json index 39c904303..89c138146 100644 --- a/src/client/public/locale/fr/common.json +++ b/src/client/public/locale/fr/common.json @@ -193,7 +193,7 @@ "instrument": "Instrumentation", "invertedDepth": "Profondeurs inversées", "italian": "Italien", - "kind": "Type de forage", + "borehole_type": "Type de forage", "kindCasingLayer": "Type de tubage", "kindFilling": "Type de remplissage", "kindInstrument": "Type d'instrument", diff --git a/src/client/public/locale/it/common.json b/src/client/public/locale/it/common.json index e4000108f..004a0b520 100644 --- a/src/client/public/locale/it/common.json +++ b/src/client/public/locale/it/common.json @@ -193,7 +193,7 @@ "instrument": "Strumentazione", "invertedDepth": "Profondità invertite", "italian": "Italiano", - "kind": "Tipologia di perforazione", + "borehole_type": "Tipologia di perforazione", "kindCasingLayer": "Tipo di tubazione", "kindFilling": "Tipo di riempimento", "kindInstrument": "Tipo di strumentazione", diff --git a/src/client/src/api-lib/reducers/index.js b/src/client/src/api-lib/reducers/index.js index 1096c7308..0be286574 100644 --- a/src/client/src/api-lib/reducers/index.js +++ b/src/client/src/api-lib/reducers/index.js @@ -323,7 +323,7 @@ export function borehole() { id: null, visible: false, lock: null, - kind: null, + borehole_type: null, restriction: null, restriction_until: null, national_interest: null, diff --git a/src/client/src/commons/detail/detailsComponent.js b/src/client/src/commons/detail/detailsComponent.js index b29148623..0e253281e 100644 --- a/src/client/src/commons/detail/detailsComponent.js +++ b/src/client/src/commons/detail/detailsComponent.js @@ -38,15 +38,17 @@ class DetailsComponent extends React.Component { margin: "0px 0px 0.4em", }}> {(() => { - if (!this.props.domains.data.hasOwnProperty("kind")) { + if ( + !this.props.domains.data.hasOwnProperty("borehole_type") + ) { return null; } - const kind = this.props.domains.data["kind"].find( - function (element) { - return element.id === detail.borehole.kind; - }, - ); + const borehole_type = this.props.domains.data[ + "borehole_type" + ].find(function (element) { + return element.id === detail.borehole.borehole_type; + }); const restriction = this.props.domains.data[ "restriction" @@ -63,14 +65,14 @@ class DetailsComponent extends React.Component { } } - if (kind !== undefined) { + if (borehole_type !== undefined) { return ( +
- {this.getDomainRow("kind", data.kind)} + {this.getDomainRow("borehole_type", data.borehole_type)} {this.getDomainRow( "extended.purpose", data.extended.purpose, diff --git a/src/client/src/commons/form/borehole/segments/boreholeGeneralSegment.js b/src/client/src/commons/form/borehole/segments/boreholeGeneralSegment.js index dcab19aae..7ce0c63a8 100644 --- a/src/client/src/commons/form/borehole/segments/boreholeGeneralSegment.js +++ b/src/client/src/commons/form/borehole/segments/boreholeGeneralSegment.js @@ -26,16 +26,16 @@ const BoreholeGeneralSegment = props => {
{/* drilling type in Borehole */} - + { - updateChange("kind", selected.id, false); + updateChange("borehole_type", selected.id, false); }} - schema="kind" - selected={borehole.data.kind} + schema="borehole_type" + selected={borehole.data.borehole_type} readOnly={!isEditable} /> diff --git a/src/client/src/commons/form/multiple/multipleForm.js b/src/client/src/commons/form/multiple/multipleForm.js index 8c536d017..6e14d05ac 100644 --- a/src/client/src/commons/form/multiple/multipleForm.js +++ b/src/client/src/commons/form/multiple/multipleForm.js @@ -54,7 +54,7 @@ class MultipleForm extends React.Component { api: "reference_elevation_type", value: null, }, - kind: { api: "kind", value: null }, + borehole_type: { api: "borehole_type", value: null }, drilling_method: { api: "extended.drilling_method", value: null }, purpose: { api: "extended.purpose", value: null }, cuttings: { api: "custom.cuttings", value: null }, @@ -418,7 +418,7 @@ class MultipleForm extends React.Component { ), ])} {this.getGroup([ - this.getDomain("kind"), + this.getDomain("borehole_type"), this.getDomain("drilling_method"), this.getDomain("purpose"), ])} diff --git a/src/client/src/commons/search/data/boreholeSearchData.js b/src/client/src/commons/search/data/boreholeSearchData.js index 628c5c230..ea3a83225 100644 --- a/src/client/src/commons/search/data/boreholeSearchData.js +++ b/src/client/src/commons/search/data/boreholeSearchData.js @@ -4,12 +4,12 @@ export const boreholeSearchData = [ { id: 0, type: "Dropdown", - label: "kind", - value: "kind", - schema: "kind", + label: "borehole_type", + value: "borehole_type", + schema: "borehole_type", multiple: false, search: false, - isVisibleValue: "kind", + isVisibleValue: "borehole_type", }, { id: 1, diff --git a/src/client/src/commons/search/editor/searchEditorState.js b/src/client/src/commons/search/editor/searchEditorState.js index f0b7d0b75..2c6f3a213 100644 --- a/src/client/src/commons/search/editor/searchEditorState.js +++ b/src/client/src/commons/search/editor/searchEditorState.js @@ -11,7 +11,7 @@ const initialState = { workgroup: "all", original_name: "", alternate_name: "", - kind: null, + borehole_type: null, method: null, restriction: null, project_name: "", diff --git a/src/client/src/commons/search/searchState.js b/src/client/src/commons/search/searchState.js index 938125786..8b2d14495 100644 --- a/src/client/src/commons/search/searchState.js +++ b/src/client/src/commons/search/searchState.js @@ -15,7 +15,7 @@ const initialState = { original_name: "", alternate_name: "", project_name: "", - kind: null, + borehole_type: null, method: null, purpose: null, landuse: null, diff --git a/src/client/src/commons/table/boreholeEditorTable.js b/src/client/src/commons/table/boreholeEditorTable.js index 7d18b6660..c20bb1185 100644 --- a/src/client/src/commons/table/boreholeEditorTable.js +++ b/src/client/src/commons/table/boreholeEditorTable.js @@ -240,7 +240,7 @@ class BoreholeEditorTable extends TTable { {this.getHeaderLabel("creationdate")} {this.getHeaderLabel("createdBy")} {this.getHeaderLabel("original_name")} - {this.getHeaderLabel("kind")} + {this.getHeaderLabel("borehole_type")} {this.getHeaderLabel("restriction")} {this.getHeaderLabel("elevation_z")} {this.getHeaderLabel("drilling_end_date")} @@ -296,7 +296,7 @@ class BoreholeEditorTable extends TTable { {item.original_name} , - + , diff --git a/src/client/src/commons/table/boreholeTable.js b/src/client/src/commons/table/boreholeTable.js index 97943180e..599f9905d 100644 --- a/src/client/src/commons/table/boreholeTable.js +++ b/src/client/src/commons/table/boreholeTable.js @@ -53,7 +53,7 @@ class BoreholeTable extends TableComponent { {this.getIcon("original_name")} - {this.getIcon("kind", true)} + {this.getIcon("borehole_type", true)} {this.getIcon("restriction")} @@ -78,13 +78,15 @@ class BoreholeTable extends TableComponent { return [ {(() => { - if (!this.props.domains.data.hasOwnProperty("kind")) { + if (!this.props.domains.data.hasOwnProperty("borehole_type")) { return null; } - const kind = this.props.domains.data["kind"].find(function (element) { - return element.id === item.kind; - }); + const borehole_type = this.props.domains.data["borehole_type"].find( + function (element) { + return element.id === item.borehole_type; + }, + ); const restriction = this.props.domains.data["restriction"].find( function (element) { @@ -101,14 +103,14 @@ class BoreholeTable extends TableComponent { } } - if (kind !== undefined) { + if (borehole_type !== undefined) { return ( - + , diff --git a/src/client/src/pages/settings/data/boreholeEditorData.js b/src/client/src/pages/settings/data/boreholeEditorData.js index b103852e7..be7b5b5b4 100644 --- a/src/client/src/pages/settings/data/boreholeEditorData.js +++ b/src/client/src/pages/settings/data/boreholeEditorData.js @@ -1,8 +1,8 @@ export const boreholeEditorData = [ { id: 0, - label: "kind", - value: "kind", + label: "borehole_type", + value: "borehole_type", }, { id: 1, diff --git a/src/client/src/pages/settings/settingState.js b/src/client/src/pages/settings/settingState.js index b101f3b1c..a8fae28b7 100644 --- a/src/client/src/pages/settings/settingState.js +++ b/src/client/src/pages/settings/settingState.js @@ -45,7 +45,7 @@ const initialState = { filter: { mapfilter: true, zoom2selected: true, - kind: true, + borehole_type: true, restriction: true, restriction_until: true, national_interest: true, @@ -112,7 +112,7 @@ const initialState = { }, }, efilter: { - kind: true, + borehole_type: true, restriction: true, restriction_until: true, national_interest: true, diff --git a/tests/Controllers/BoreholeControllerTest.cs b/tests/Controllers/BoreholeControllerTest.cs index 5ddf4e66d..7c3b81a21 100644 --- a/tests/Controllers/BoreholeControllerTest.cs +++ b/tests/Controllers/BoreholeControllerTest.cs @@ -48,7 +48,7 @@ public async Task Copy() Assert.AreEqual(DefaultWorkgroupId, copiedBorehole.Workgroup.Id); Assert.AreEqual(1, copiedBorehole.Workflows.Count); Assert.AreEqual(Role.Editor, copiedBorehole.Workflows.First().Role); - Assert.AreSame(originalBorehole.Kind, copiedBorehole.Kind); + Assert.AreSame(originalBorehole.Type, copiedBorehole.Type); Assert.AreEqual(originalBorehole.Country, copiedBorehole.Country); Assert.AreEqual(originalBorehole.Canton, copiedBorehole.Canton); Assert.AreEqual(originalBorehole.Municipality, copiedBorehole.Municipality); @@ -101,7 +101,7 @@ private Borehole GetBorehole(int id) .Include(b => b.CreatedBy) .Include(b => b.UpdatedBy) .Include(b => b.LockedBy) - .Include(b => b.Kind) + .Include(b => b.Type) .Single(b => b.Id == id); } @@ -120,7 +120,7 @@ private int GetBoreholeIdToCopy() .Include(b => b.CreatedBy) .Include(b => b.UpdatedBy) .Include(b => b.LockedBy) - .Include(b => b.Kind) + .Include(b => b.Type) // Conditions .Where(b =>