From 0fd354a7a42f2d0317f5add48b016e62acb29a5b Mon Sep 17 00:00:00 2001 From: Carissa Knipe Date: Thu, 11 Jul 2024 16:31:43 -0700 Subject: [PATCH] feat: Update depth presets for Capri (#732) Commits: * feat: Use new depth presets for Capri * refactor: Rename BLM_STANDARD to BLM * chore: bump client-shared commit hash --- package-lock.json | 5 +++-- package.json | 2 +- src/constants.ts | 21 ++++++++++----------- src/selectors.test.ts | 8 ++++---- src/selectors.ts | 4 ++-- src/soilId/soilIdTypes.ts | 2 +- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/package-lock.json b/package-lock.json index 37a307d8..2301b4f8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "munsell": "^1.1.5", "react": "18.2.0", "react-redux": "^8.1.3", - "terraso-backend": "github:techmatters/terraso-backend#b542062", + "terraso-backend": "github:techmatters/terraso-backend#10de1414a43d651af3db55fbac521495d0e2976f", "uuid": "^10.0.0" }, "devDependencies": { @@ -13708,7 +13708,8 @@ }, "node_modules/terraso-backend": { "version": "0.1.0", - "resolved": "git+ssh://git@github.com/techmatters/terraso-backend.git#b542062daed0b66b3149562474fbae18c889c633" + "resolved": "git+ssh://git@github.com/techmatters/terraso-backend.git#10de1414a43d651af3db55fbac521495d0e2976f", + "integrity": "sha512-NWW+HEeIZxfo+RnsGoqGVtRrw0co6+lK9SY27IxLLvpce9YwVQT3Mpt4rUj3YhjKUYpeSs06VjePfMfoswCR1A==" }, "node_modules/test-exclude": { "version": "6.0.0", diff --git a/package.json b/package.json index 62461809..0a989264 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "munsell": "^1.1.5", "react": "18.2.0", "react-redux": "^8.1.3", - "terraso-backend": "github:techmatters/terraso-backend#b542062", + "terraso-backend": "github:techmatters/terraso-backend#10de1414a43d651af3db55fbac521495d0e2976f", "uuid": "^10.0.0" }, "scripts": { diff --git a/src/constants.ts b/src/constants.ts index f451816a..8ed7df33 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -31,14 +31,6 @@ import { fromEntries, mapEntries } from 'terraso-client-shared/utils'; export const DEPTH_INTERVAL_PRESETS = mapEntries( { - LANDPKS: [ - { start: 0, end: 10 }, - { start: 10, end: 20 }, - { start: 20, end: 50 }, - { start: 50, end: 70 }, - { start: 70, end: 100 }, - { start: 100, end: 200 }, - ], NRCS: [ { start: 0, end: 5 }, { start: 5, end: 15 }, @@ -47,10 +39,17 @@ export const DEPTH_INTERVAL_PRESETS = mapEntries( { start: 60, end: 100 }, { start: 100, end: 200 }, ], + BLM: [ + { start: 0, end: 1 }, + { start: 1, end: 10 }, + { start: 10, end: 20 }, + { start: 20, end: 50 }, + { start: 50, end: 70 }, + ], } as const, depthIntervals => depthIntervals.map(depthInterval => ({ label: '', depthInterval })), -) satisfies Record<'LANDPKS' | 'NRCS', readonly LabelledDepthInterval[]>; +) satisfies Record<'NRCS' | 'BLM', readonly LabelledDepthInterval[]>; export const DEFAULT_ENABLED_SOIL_PIT_METHODS: SoilPitMethod[] = [ 'soilTexture', @@ -83,12 +82,12 @@ export const DEFAULT_PROJECT_SETTINGS: ProjectSoilSettings = { ]), ), soilPitRequired: true, - depthIntervalPreset: 'LANDPKS', + depthIntervalPreset: 'NRCS', depthIntervals: [], }; export const DEFAULT_SOIL_DATA: SoilData = { depthDependentData: [], depthIntervals: [], - depthIntervalPreset: 'LANDPKS', + depthIntervalPreset: 'NRCS', }; diff --git a/src/selectors.test.ts b/src/selectors.test.ts index 3b94a450..553d15a7 100644 --- a/src/selectors.test.ts +++ b/src/selectors.test.ts @@ -134,7 +134,7 @@ const createSoilData = ( [site.id]: { depthDependentData: [], depthIntervals: [], - depthIntervalPreset: 'LANDPKS', + depthIntervalPreset: 'NRCS', ...defaults, }, }; @@ -147,7 +147,7 @@ const createProjectSettings = ( return { [project.id]: { // carbonatesRequired: false, - depthIntervalPreset: 'LANDPKS', + depthIntervalPreset: 'NRCS', depthIntervals: [], // electricalConductivityRequired: false, // landUseLandCoverRequired: false, @@ -402,7 +402,7 @@ test('select predefined project selector', () => { const site = generateSite({ project }); const soilData = createSoilData(site); const projectSettings = createProjectSettings(project, { - depthIntervalPreset: 'LANDPKS', + depthIntervalPreset: 'NRCS', }); const aggregatedIntervals = renderSelectorHook( @@ -416,7 +416,7 @@ test('select predefined project selector', () => { expect( aggregatedIntervals.map(({ interval: { depthInterval } }) => depthInterval), ).toStrictEqual( - DEPTH_INTERVAL_PRESETS['LANDPKS'].map(({ depthInterval }) => depthInterval), + DEPTH_INTERVAL_PRESETS['NRCS'].map(({ depthInterval }) => depthInterval), ); }); diff --git a/src/selectors.ts b/src/selectors.ts index aac1f8f1..4dfb3702 100644 --- a/src/selectors.ts +++ b/src/selectors.ts @@ -225,8 +225,8 @@ export const selectUserRoleProject = createSelector( const projectIntervals = (settings: ProjectSoilSettings) => { switch (settings.depthIntervalPreset) { - case 'LANDPKS': case 'NRCS': + case 'BLM': return DEPTH_INTERVAL_PRESETS[settings.depthIntervalPreset]; case 'CUSTOM': return settings.depthIntervals; @@ -237,8 +237,8 @@ const projectIntervals = (settings: ProjectSoilSettings) => { const sitePresetIntervals = (soilData: SoilData) => { switch (soilData.depthIntervalPreset) { - case 'LANDPKS': case 'NRCS': + case 'BLM': return DEPTH_INTERVAL_PRESETS[soilData.depthIntervalPreset]; default: return []; diff --git a/src/soilId/soilIdTypes.ts b/src/soilId/soilIdTypes.ts index 338f1123..788897a1 100644 --- a/src/soilId/soilIdTypes.ts +++ b/src/soilId/soilIdTypes.ts @@ -167,8 +167,8 @@ export const surfaceCracks = [ export type ProjectDepthIntervalPreset = SoilIdProjectSoilSettingsDepthIntervalPresetChoices; export const DEPTH_PRESETS = [ - 'LANDPKS', 'NRCS', + 'BLM', 'CUSTOM', 'NONE', ] as const satisfies readonly ProjectDepthIntervalPreset[];