Skip to content

Commit

Permalink
Merge branch 'main' into identifier-import
Browse files Browse the repository at this point in the history
  • Loading branch information
MiraGeowerkstatt authored Dec 20, 2024
2 parents 7c4de4f + 511652e commit dba3a55
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

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 @@ -76,6 +76,7 @@ const ImportModal = ({

const handleFormSubmit = async () => {
setCreating(true);
setFileType("");
handleBoreholeImport();
};

Expand All @@ -85,6 +86,7 @@ const ImportModal = ({
key="sb-em-5"
onClose={() => {
setModal(false);
setFileType("");
}}
open={modal}
size="large">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const ImportModalContent = ({ setSelectedFile, setFileType, fileType }: ImportMo
"StatusId;Remarks;TotalDepth;QtDepthId;TopBedrockFreshMd;" +
"TopBedrockWeatheredMd;" +
"HasGroundwater;LithologyTopBedrockId;" +
"ChronostratigraphyId;LithostratigraphyId;",
"ChronostratigraphyTopBedrockId;LithostratigraphyTopBedrockId;",
)}
</StackHalfWidth>
<FileDropzone
Expand Down

0 comments on commit dba3a55

Please sign in to comment.