Skip to content

Commit

Permalink
Merge pull request #240 from tnc-ca-geo/create-labels-fix
Browse files Browse the repository at this point in the history
Create labels fix
  • Loading branch information
nathanielrindlaub authored Aug 31, 2024
2 parents ecd2108 + 7486a01 commit 4acd85d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/features/review/labelMiddleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const labelMiddleware = (store) => (next) => (action) => {
editLabel('create', 'objects', {
objects: tempObjs.map(({ newObject, imgId }) => {
const obj = _.cloneDeep(newObject);
obj.labels = obj.labels.map((lbl) => ({ ...lbl, imageId: imgId }));
obj.labels = obj.labels.map((lbl) => ({ ...lbl, imageId: imgId, objectId: obj._id }));
return {
object: obj,
imageId: imgId,
Expand Down
4 changes: 3 additions & 1 deletion src/features/review/objectMiddleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,17 @@ export const objectMiddleware = (store) => (next) => (action) => {
const { images, userId } = action.payload;

action.payload.images = images.map((img) => {
const newObjectId = new ObjectID().toString();
img.newObject = img.newObject || {
_id: new ObjectID().toString(),
_id: newObjectId,
bbox: [0, 0, 1, 1],
locked: true,
labels: [
{
_id: new ObjectID().toString(),
imageId: img.imgId,
labelId: 'empty',
objectId: newObjectId,
bbox: [0, 0, 1, 1],
validation: { validated: true, userId },
conf: 1,
Expand Down

0 comments on commit 4acd85d

Please sign in to comment.