Skip to content

Commit

Permalink
feat: add data submitter to sampling event data
Browse files Browse the repository at this point in the history
Closes #239
  • Loading branch information
stdavis committed Nov 6, 2024
1 parent c269bad commit 895ca11
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/components/location/Location.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import StartDistDirGeoDef from './StartDistDirGeoDef.jsx';
import StartEndGeoDef from './StartEndGeoDef.jsx';
import Station from './Station.jsx';
import VerifyMap from './VerifyMap.jsx';
import useAuthentication from '../../hooks/useAuthentication';

// successfullyVerifiedMsg: String
// message displayed on the verify location button after success
Expand All @@ -36,6 +37,17 @@ const Location = () => {
const [startEndParams, setStartEndParams] = useState(emptyStartEndParams);
const [startDistDirParams, setStartDistDirParams] = useState(emptyStartDistDirParams);
const [currentGeoDef, setCurrentGeoDef] = useState(START_END);
const { user } = useAuthentication();

useEffect(() => {
if (user) {
eventDispatch({
type: actionTypes.LOCATION,
meta: fieldNames.SUBMITTER,
payload: user.email,
});
}
}, [eventDispatch, user]);

const path = useRef(null);
const geometry = eventState[config.tableNames.samplingEvents].geometry;
Expand Down Expand Up @@ -198,7 +210,7 @@ const Location = () => {
paths.push(
path.map(function (c) {
return [c[1], c[0]];
})
}),
);
});
returnData.path = paths;
Expand Down Expand Up @@ -344,7 +356,7 @@ const Location = () => {
actionTypes.LOCATION,
config.tableNames.samplingEvents,
fieldName,
parser
parser,
);
};

Expand Down
1 change: 1 addition & 0 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const fieldNames = {
WEATHER: 'WEATHER',
PURPOSE: 'SURVEY_PURPOSE',
OBSERVERS: 'OBSERVERS',
SUBMITTER: 'SUBMITTER',
},
equipment: {
EVENT_ID: fldEVENT_ID,
Expand Down
1 change: 1 addition & 0 deletions src/hooks/samplingEventContext.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ const getBlankState = () => {
[config.fieldNames.samplingEvents.STATION_ID]: null,
[config.fieldNames.samplingEvents.SEGMENT_LENGTH]: null,
[config.fieldNames.samplingEvents.NUM_PASSES]: 1,
[config.fieldNames.samplingEvents.SUBMITTER]: null,
},
geometry: null,
},
Expand Down

0 comments on commit 895ca11

Please sign in to comment.