diff --git a/CHANGELOG.md b/CHANGELOG.md
index 845536a91..fb3020882 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@
### Fixed
- Observations were not included in exported borehole JSON file.
+- Fixed bug where `Lithostratigraphhy Top Bedrock` and `Chronostratigraphhy Top Bedrock` were not displayed in form after updating them and navigating away.
## v2.1.993 - 2024-12-13
diff --git a/src/client/cypress/e2e/detailPage/boreholeform.cy.js b/src/client/cypress/e2e/detailPage/boreholeform.cy.js
index 708d59996..09b7e6aa8 100644
--- a/src/client/cypress/e2e/detailPage/boreholeform.cy.js
+++ b/src/client/cypress/e2e/detailPage/boreholeform.cy.js
@@ -3,6 +3,7 @@ import { clickOnRowWithText, showTableAndWaitForData, sortBy } from "../helpers/
import { evaluateInput, evaluateSelect, isDisabled, setInput, setSelect } from "../helpers/formHelpers";
import {
createBorehole,
+ getElementByDataCy,
goToRouteAndAcceptTerms,
handlePrompt,
newEditableBorehole,
@@ -92,8 +93,8 @@ describe("Test for the borehole form.", () => {
setSelect("depthPrecisionId", 1);
setSelect("statusId", 1);
setSelect("lithologyTopBedrockId", 1);
- setSelect("lithostratigraphyId", 1);
- setSelect("chronostratigraphyId", 1);
+ setSelect("lithostratigraphyTopBedrockId", 1);
+ setSelect("chronostratigraphyTopBedrockId", 1);
setSelect("hasGroundwater", 1);
setInput("totalDepth", 700);
@@ -102,14 +103,19 @@ describe("Test for the borehole form.", () => {
setInput("remarks", "This is a test remark");
// navigate away is blocked before saving
- cy.get('[data-cy="location-menu-item"]').click();
+ getElementByDataCy("location-menu-item").click();
const messageUnsavedChanges = "There are unsaved changes. Do you want to discard all changes?";
handlePrompt(messageUnsavedChanges, "cancel");
saveWithSaveBar();
- cy.get('[data-cy="location-menu-item"]').click();
+ getElementByDataCy("location-menu-item").click();
cy.contains("Boreholes.swissgeol.ch ID");
+ getElementByDataCy("borehole-menu-item").click();
+ evaluateSelect("lithostratigraphyTopBedrockId", "15300583");
+ evaluateSelect("chronostratigraphyTopBedrockId", "15001001");
+ cy.contains("Bodensee-Nagelfluh").should("exist");
+ cy.contains("Phanerozoic").should("exist");
});
});
diff --git a/src/client/src/api/borehole.ts b/src/client/src/api/borehole.ts
index 7ab4e2fb4..f64b8daf8 100644
--- a/src/client/src/api/borehole.ts
+++ b/src/client/src/api/borehole.ts
@@ -18,8 +18,8 @@ export interface Identifier extends BasicIdentifier {
export interface BoreholeV2 {
lithologyTopBedrockId: number;
- lithostratigraphyId: number;
- chronostratigraphyId: number;
+ lithostratigraphyTopBedrockId: number;
+ chronostratigraphyTopBedrockId: number;
hasGroundwater: boolean | null;
topBedrockWeatheredMd: number;
topBedrockFreshMd: number;
diff --git a/src/client/src/pages/detail/form/borehole/boreholeForm.tsx b/src/client/src/pages/detail/form/borehole/boreholeForm.tsx
index de0add108..ee6021e6e 100644
--- a/src/client/src/pages/detail/form/borehole/boreholeForm.tsx
+++ b/src/client/src/pages/detail/form/borehole/boreholeForm.tsx
@@ -33,8 +33,8 @@ export const BoreholeForm = forwardRef(({ borehole, editingEnabled, onSubmit }:
topBedrockFreshMd: borehole.topBedrockFreshMd,
topBedrockWeatheredMd: borehole.topBedrockWeatheredMd,
lithologyTopBedrockId: borehole.lithologyTopBedrockId,
- lithostratigraphyId: borehole.lithostratigraphyId,
- chronostratigraphyId: borehole.chronostratigraphyId,
+ lithostratigraphyTopBedrockId: borehole.lithostratigraphyTopBedrockId,
+ chronostratigraphyTopBedrockId: borehole.chronostratigraphyTopBedrockId,
hasGroundwater: borehole.hasGroundwater === true ? 1 : borehole.hasGroundwater === false ? 0 : 2,
remarks: borehole.remarks,
},
@@ -175,20 +175,20 @@ export const BoreholeForm = forwardRef(({ borehole, editingEnabled, onSubmit }:
selected={borehole.lithologyTopBedrockId}
/>
{
setCreating(true);
+ setFileType("");
handleBoreholeImport();
};
@@ -85,6 +86,7 @@ const ImportModal = ({
key="sb-em-5"
onClose={() => {
setModal(false);
+ setFileType("");
}}
open={modal}
size="large">
diff --git a/src/client/src/pages/overview/sidePanelContent/importer/importModalContent.tsx b/src/client/src/pages/overview/sidePanelContent/importer/importModalContent.tsx
index 00673c480..1531c18af 100644
--- a/src/client/src/pages/overview/sidePanelContent/importer/importModalContent.tsx
+++ b/src/client/src/pages/overview/sidePanelContent/importer/importModalContent.tsx
@@ -72,7 +72,7 @@ const ImportModalContent = ({ setSelectedFile, setFileType, fileType }: ImportMo
"StatusId;Remarks;TotalDepth;QtDepthId;TopBedrockFreshMd;" +
"TopBedrockWeatheredMd;" +
"HasGroundwater;LithologyTopBedrockId;" +
- "ChronostratigraphyId;LithostratigraphyId;",
+ "ChronostratigraphyTopBedrockId;LithostratigraphyTopBedrockId;",
)}