Skip to content

Commit

Permalink
mixed bag of feedback issues, flip filter toggle state, intersecting …
Browse files Browse the repository at this point in the history
…geo validation, and a few minor others
  • Loading branch information
micheal-w-wells committed Nov 17, 2023
1 parent 67cfd8f commit 708b38b
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion appv2/src/UI/Map/Buttons/NewRecord.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const NewRecord = (props) => {
<IconButton
onClick={() => {
dispatch({ type: OPEN_NEW_RECORD_MENU });
history.push('/Records/Activity:')
history.push('/Records/Activity:/form')
}}
className={
'leaflet-control-zoom leaflet-bar leaflet-control ' +
Expand Down
2 changes: 1 addition & 1 deletion appv2/src/UI/Overlay/Records/RecordSet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export const RecordSet = (props) => {
});
}}
variant="contained">
{!viewFilters ? (
{viewFilters ? (
<>
<VisibilityIcon />
<FilterAltIcon />
Expand Down
2 changes: 1 addition & 1 deletion appv2/src/state/sagas/activity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ function* handle_URL_CHANGE(action) {
if (id && id.length === 36 && userSettingsState.activeActivity !== id)
yield put({ type: ACTIVITY_GET_REQUEST, payload: { activityID: id } });

if (userSettingsState.activeActivity) {
else if (userSettingsState.activeActivity) {
id = userSettingsState.activeActivity;
yield put({ type: ACTIVITY_GET_REQUEST, payload: { activityID: id } });
}
Expand Down
23 changes: 23 additions & 0 deletions appv2/src/state/sagas/activity/dataAccess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import { getFieldsToCopy } from 'rjsf/business-rules/formDataCopyFields';
import { getClosestWells } from 'util/closestWellsHelpers';
import { calc_utm } from 'util/utm';
import { calculateGeometryArea, calculateLatLng } from 'util/geometryHelpers';
import { kinks } from '@turf/turf';

export function* handle_ACTIVITY_GET_REQUEST(action) {
try {
Expand Down Expand Up @@ -110,6 +111,28 @@ export function* handle_ACTIVITY_UPDATE_GEO_REQUEST(action) {
if (latitude && longitude) utm = calc_utm(longitude, latitude);
const reported_area = calculateGeometryArea(action.payload.geometry);



const isPointGeometry = action.payload.geometry[0].geometry.type === 'Point';
if (!isPointGeometry) {
const hasSelfIntersections = kinks(action.payload.geometry[0].geometry).features.length > 0;
if (hasSelfIntersections) {
yield put({
type: ACTIVITY_TOGGLE_NOTIFICATION_SUCCESS,
payload: {
notification: {
visible: true,
message: 'Activity geometry intersects itself',
severity: 'error'
}
}
});

return;
}
}


let wellInformationArr = [];
if (reported_area < MAX_AREA) {
let nearestWells = null;
Expand Down

0 comments on commit 708b38b

Please sign in to comment.