Skip to content

Commit

Permalink
Rename kind to borehole_type
Browse files Browse the repository at this point in the history
  • Loading branch information
MiraGeowerkstatt committed Feb 14, 2024
1 parent 92815a2 commit a31afb6
Show file tree
Hide file tree
Showing 29 changed files with 76 additions and 69 deletions.
6 changes: 3 additions & 3 deletions src/api-legacy/v1/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down Expand Up @@ -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())
Expand Down
4 changes: 2 additions & 2 deletions src/api-legacy/v1/borehole/editinglist.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -185,7 +185,7 @@ async def execute(
array_agg(
json_build_object(
'id', id,
'kind', kind,
'borehole_type', borehole_type,
'layers', layers,
'date', date
)
Expand Down
2 changes: 1 addition & 1 deletion src/api-legacy/v1/borehole/export/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/api-legacy/v1/borehole/export/profile/bdms_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/api-legacy/v1/borehole/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions src/api-legacy/v1/borehole/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/api-legacy/v1/borehole/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion src/api/BdmsContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
modelBuilder.Entity<Borehole>().HasOne(l => l.Chronostratigraphy).WithMany().HasForeignKey(l => l.ChronostratigraphyId);
modelBuilder.Entity<Borehole>().HasOne(l => l.Cuttings).WithMany().HasForeignKey(l => l.CuttingsId);
modelBuilder.Entity<Borehole>().HasOne(l => l.DrillingMethod).WithMany().HasForeignKey(l => l.DrillingMethodId);
modelBuilder.Entity<Borehole>().HasOne(l => l.Kind).WithMany().HasForeignKey(l => l.KindId);
modelBuilder.Entity<Borehole>().HasOne(l => l.Type).WithMany().HasForeignKey(l => l.TypeId);
modelBuilder.Entity<Borehole>().HasOne(l => l.Hrs).WithMany().HasForeignKey(l => l.HrsId);
modelBuilder.Entity<Borehole>().HasOne(l => l.LithologyTopBedrock).WithMany().HasForeignKey(l => l.LithologyTopBedrockId);
modelBuilder.Entity<Borehole>().HasOne(l => l.Lithostratigraphy).WithMany().HasForeignKey(l => l.LithostratigraphyId);
Expand Down
6 changes: 3 additions & 3 deletions src/api/BdmsContextExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Codelist> codelists = context.Codelists.OrderBy(c => c.Id).ToList();
List<int> kindIds = codelists.Where(c => c.Schema == "kind").Select(s => s.Id).ToList();
List<int> kindIds = codelists.Where(c => c.Schema == "borehole_type").Select(s => s.Id).ToList();
List<int> srsIds = codelists.Where(c => c.Schema == "spatial_reference_system").Select(s => s.Id).ToList();
List<int> hrsIds = codelists.Where(c => c.Schema == "height_reference_system").Select(s => s.Id).ToList();
List<int> restrictionIds = codelists.Where(c => c.Schema == "restriction").Select(s => s.Id).ToList();
Expand Down Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion src/api/Controllers/UploadController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions src/api/Models/Borehole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ public class Borehole : IChangeTracking, IIdentifyable
public bool? IsPublic { get; set; }

/// <summary>
/// Gets or sets the <see cref="Borehole"/>'s kind id.
/// Gets or sets the <see cref="Borehole"/>'s type id.
/// </summary>
[Column("kind_id_cli")]
public int? KindId { get; set; }
public int? TypeId { get; set; }

/// <summary>
/// Gets or sets the <see cref="Borehole"/>'s kind.
/// Gets or sets the <see cref="Borehole"/>'s type.
/// </summary>
public Codelist? Kind { get; set; }
public Codelist? Type { get; set; }

/// <summary>
/// Gets or sets the <see cref="Borehole"/>'s X-location using LV95 coordinates.
Expand Down
2 changes: 1 addition & 1 deletion src/client/public/locale/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
"invertedDepth": "",
"inProgress": "",
"italian": "",
"kind": "",
"borehole_type": "",
"kindCasingLayer": "",
"kindFilling": "",
"kindInstrument": "",
Expand Down
2 changes: 1 addition & 1 deletion src/client/public/locale/de/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/client/public/locale/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/client/public/locale/fr/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/client/public/locale/it/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/client/src/api-lib/reducers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
23 changes: 14 additions & 9 deletions src/client/src/commons/detail/detailsComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -63,14 +65,14 @@ class DetailsComponent extends React.Component {
}
}

if (kind !== undefined) {
if (borehole_type !== undefined) {
return (
<img
alt=""
src={
process.env.PUBLIC_URL +
"/img/" +
kind.code +
borehole_type.code +
"-" +
color +
".svg"
Expand All @@ -96,7 +98,10 @@ class DetailsComponent extends React.Component {
);
}
})()}{" "}
<DomainText id={detail.borehole.kind} schema={"kind"} />
<DomainText
id={detail.borehole.borehole_type}
schema={"borehole_type"}
/>
</div>
<div
style={{
Expand Down
2 changes: 1 addition & 1 deletion src/client/src/commons/detail/meta/metaComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ class MetaComponent extends React.Component {
flexDirection: "row",
}}>
<div style={flexRowStyle}>
{this.getDomainRow("kind", data.kind)}
{this.getDomainRow("borehole_type", data.borehole_type)}
{this.getDomainRow(
"extended.purpose",
data.extended.purpose,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ const BoreholeGeneralSegment = props => {
<Form autoComplete="off" error size={size}>
<Form.Group widths="equal">
{/* drilling type in Borehole */}
<Form.Field error={borehole.data.kind === null} required>
<Form.Field error={borehole.data.borehole_type === null} required>
<label>
<TranslationText id="kind" />
<TranslationText id="borehole_type" />
</label>
<DomainDropdown
onSelected={selected => {
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}
/>
</Form.Field>
Expand Down
4 changes: 2 additions & 2 deletions src/client/src/commons/form/multiple/multipleForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down Expand Up @@ -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"),
])}
Expand Down
8 changes: 4 additions & 4 deletions src/client/src/commons/search/data/boreholeSearchData.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/client/src/commons/search/editor/searchEditorState.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const initialState = {
workgroup: "all",
original_name: "",
alternate_name: "",
kind: null,
borehole_type: null,
method: null,
restriction: null,
project_name: "",
Expand Down
2 changes: 1 addition & 1 deletion src/client/src/commons/search/searchState.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const initialState = {
original_name: "",
alternate_name: "",
project_name: "",
kind: null,
borehole_type: null,
method: null,
purpose: null,
landuse: null,
Expand Down
4 changes: 2 additions & 2 deletions src/client/src/commons/table/boreholeEditorTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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")}
Expand Down Expand Up @@ -296,7 +296,7 @@ class BoreholeEditorTable extends TTable {
{item.original_name}
</Table.Cell>,
<Table.Cell key={this.uid + "_" + idx + "_" + colIdx++}>
<DomainText id={item.kind} schema="kind" />
<DomainText id={item.borehole_type} schema="borehole_type" />
</Table.Cell>,
<Table.Cell key={this.uid + "_" + idx + "_" + colIdx++}>
<DomainText id={item.restriction} schema="restriction" />
Expand Down
Loading

0 comments on commit a31afb6

Please sign in to comment.