Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
fix: optic-7: sum lead time from previous draft on annotation submission
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis1282 committed Aug 18, 2023
1 parent 568c0be commit 2d66bd3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/sdk/lsf-sdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,12 @@ export class LSFWrapper {
if (c) {
c.history.freeze();
console.log("Applying draft");
c.addVersions({ draft: draft.result });
const draftWithLeadTime = draft.result.map((d, i) => {
if (i === 0) return { ...d, leadTime: draft.lead_time };
return d;
});

c.addVersions({ draft: draftWithLeadTime });
c.deleteAllRegions({ deleteReadOnly: true });
} else {
// that shouldn't happen
Expand All @@ -399,6 +404,7 @@ export class LSFWrapper {
}
} else {
// Annotation not found - restore annotation from draft
console.log("Restoring draft", draft.leadTime);
c = cs.addAnnotation({
draft: draft.result,
userGenerate: true,
Expand All @@ -407,6 +413,7 @@ export class LSFWrapper {
createdBy: draft.created_username,
createdAgo: draft.created_ago,
createdDate: draft.created_at,
lead_time: draft.lead_time,
});
}
cs.selectAnnotation(c.id);
Expand Down Expand Up @@ -511,6 +518,8 @@ export class LSFWrapper {
projectId: this.datamanager.store.project.id,
});

console.log(this.task.drafts);

this.lsf.setTaskHistory(_taskHistory);

await this.loadUserLabels();
Expand Down

0 comments on commit 2d66bd3

Please sign in to comment.