Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix litostratigraphy and chronostratigraphy top bedrock display #1784

Merged
merged 7 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,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

Expand Down
14 changes: 10 additions & 4 deletions src/client/cypress/e2e/detailPage/boreholeform.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand All @@ -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");
});
});

Expand Down
4 changes: 2 additions & 2 deletions src/client/src/api/borehole.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions src/client/src/pages/detail/form/borehole/boreholeForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down Expand Up @@ -175,20 +175,20 @@ export const BoreholeForm = forwardRef(({ borehole, editingEnabled, onSubmit }:
selected={borehole.lithologyTopBedrockId}
/>
<FormDomainSelect
fieldName={"lithostratigraphyId"}
fieldName={"lithostratigraphyTopBedrockId"}
label={"lithostratigraphy_top_bedrock"}
schemaName={"custom.lithostratigraphy_top_bedrock"}
readonly={!editingEnabled}
selected={borehole.lithostratigraphyId}
selected={borehole.lithostratigraphyTopBedrockId}
/>
</FormContainer>
<FormContainer direction="row">
<FormDomainSelect
fieldName={"chronostratigraphyId"}
fieldName={"chronostratigraphyTopBedrockId"}
label={"chronostratigraphy_top_bedrock"}
schemaName={"custom.chronostratigraphy_top_bedrock"}
readonly={!editingEnabled}
selected={borehole.chronostratigraphyId}
selected={borehole.chronostratigraphyTopBedrockId}
/>
<FormBooleanSelect
canReset={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export interface BoreholeFormInputs {
topBedrockFreshMd: number | null;
topBedrockWeatheredMd: number | null;
lithologyTopBedrockId: number;
lithostratigraphyId: number;
chronostratigraphyId: number;
lithostratigraphyTopBedrockId: number;
chronostratigraphyTopBedrockId: number;
hasGroundwater: boolean | number | null;
remarks: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const ImportModalContent = ({ setSelectedFile, setFileType, fileType }: ImportMo
"StatusId;Remarks;TotalDepth;QtDepthId;TopBedrockFreshMd;" +
"TopBedrockWeatheredMd;" +
"HasGroundwater;LithologyTopBedrockId;" +
"ChronostratigraphyId;LithostratigraphyId;",
"ChronostratigraphyTopBedrockId;LithostratigraphyTopBedrockId;",
)}
</StackHalfWidth>
<FileDropzone
Expand Down
Loading