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 submiss…
Browse files Browse the repository at this point in the history
…ion (#223)

* fix: optic-7: sum lead time from previous draft on annotation submission

* remove consoloe

* move logic to prepare data and imporve session time calculation

* cleanup

* remove unused

* fix updated_at typo

* session time is always from loaded date

* lead time in seconds

* fix lead time ms to s conversion

* adjust lead time calculation, only convert session time to seconds
  • Loading branch information
Travis1282 authored Sep 11, 2023
1 parent ca3206e commit 4c702ac
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/sdk/lsf-sdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,6 @@ export class LSFWrapper {
c = cs.annotations.find(c => c.pk === draftAnnotationPk);
if (c) {
c.history.freeze();
console.log("Applying draft");
c.addVersions({ draft: draft.result });
c.deleteAllRegions({ deleteReadOnly: true });
} else {
Expand Down Expand Up @@ -799,11 +798,14 @@ export class LSFWrapper {
prepareData(annotation, { includeId, draft } = {}) {
const userGenerate =
!annotation.userGenerate || annotation.sentUserGenerate;

const sessionTime = (new Date() - annotation.loadedDate) / 1000;
const submittedTime = Number(annotation.leadTime ?? 0);
const draftTime = Number(this.task.drafts[0]?.lead_time ?? 0);
const lead_time = sessionTime + submittedTime + draftTime;

const result = {
// task execution time, always summed up with previous values
lead_time: (new Date() - annotation.loadedDate) / 1000 + Number(annotation.leadTime ?? 0),
// don't serialize annotations twice for drafts
lead_time,
result: (draft ? annotation.versions.draft : annotation.serializeAnnotation()) ?? [],
draft_id: annotation.draftId,
parent_prediction: annotation.parent_prediction,
Expand Down

0 comments on commit 4c702ac

Please sign in to comment.