Greenstand / Greenstand/treetracker-admin-client
Verify Captures and treeTrackerApi - inconsistencies in object fields
- Dominant language
- JavaScript
- Stars
- 36
- Forks
- 212
- PR merge metrics
- No merged PRs in 30d
Description
file **SidePanel.js**
```javascript
async function handleSubmit() {
const approveAction = switchApprove === 0
? {
isApproved: true,
morphology,
age,
captureApprovalTag,
rememberSelection,
}
: {
isApproved: false,
rejectionReason,
rememberSelection,
};
await props.onSubmit(approveAction);
...
}
```
this handler is taken from file **Verify.js**
```javascript
async function handleSubmit(approveAction) {
...
const result = await verifyContext.approveAll(approveAction);
...
}
```
**VerifyContext.js** contains a handler **approveAll** that calls **approve**
```javascript
const approve = async ({ approveAction, capture }) => {
...
if (approveAction.isApproved) {
...
await api.approveCaptureImage(
capture,
approveAction.morphology,
approveAction.age,
approveAction.captureApprovalTag,
approveAction.speciesId
);
...
}
```
file **treeTrackerApi.js** contain function **approveCaptureImage**
```javascript
approveCaptureImage(capture, morphology, age, captureApprovalTag, speciesId) {
...
// map legacy data to fields for new microservice
const newCapture = {
id: capture.uuid,
reference_id: capture.id,
session_id: capture.session_id, // no legacy equivalent
planterId: capture.planterId, // legacy only
grower_account_id: capture.grower_account_id, // no legacy equivalent
planting_organization_id: capture.organization_id,
device_configuration_id: capture.device_configuration_id, // no legacy equivalent
image_url: capture.imageUrl,
lat: capture.lat,
lon: capture.lon,
gps_accuracy: capture.gps_accuracy,
captured_at: capture.timeCreated,
note: capture.note,
age: age,
morphology,
species_id: speciesId,
};
...
```
**capture** from **Verifycontext.js approve()** function not contain fields **uuid, imageUrl, timeCreated**
in addition in function **approveCaptureImage** field **newCapture.reference_id** must be a number
**speciesId** must be a string
something is wrong here.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing handleSubmit in SidePanel.js and Verify.js into approveAll and approve in VerifyContext.js, then inspect approveCaptureImage in treeTrackerApi.js. Compare the capture fields and value types at each boundary; done means the approval flow passes consistent objects and the mapped fields satisfy the API contract.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100