From 1aa3daaeeb1c8a4773e7b6236fc6462335e410f9 Mon Sep 17 00:00:00 2001 From: Alex Chen <68627897+yongbing-chen@users.noreply.github.com> Date: Wed, 21 Oct 2020 20:30:24 +0800 Subject: [PATCH] update asset labelingState when load local project (#660) --- src/electron/providers/storage/localFileSystem.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/electron/providers/storage/localFileSystem.ts b/src/electron/providers/storage/localFileSystem.ts index 2a683b6a2..55da5fe96 100644 --- a/src/electron/providers/storage/localFileSystem.ts +++ b/src/electron/providers/storage/localFileSystem.ts @@ -6,7 +6,7 @@ import path from "path"; import rimraf from "rimraf"; import { BrowserWindow, dialog } from "electron"; import { IStorageProvider } from "../../../providers/storage/storageProviderFactory"; -import { IAsset, AssetState, AssetType, StorageType } from "../../../models/applicationState"; +import { IAsset, AssetState, AssetType, StorageType, ILabelData, AssetLabelingState } from "../../../models/applicationState"; import { AssetService } from "../../../services/assetService"; import { constants } from "../../../common/constants"; import { strings } from "../../../common/strings"; @@ -180,6 +180,11 @@ export default class LocalFileSystem implements IStorageProvider { const ocrFileName = decodeURIComponent(`${file}${constants.ocrFileExtension}`); if (files.find((str) => str === labelFileName)) { asset.state = AssetState.Tagged; + const json = await this.readText(labelFileName); + const labelData = JSON.parse(json) as ILabelData; + if (labelData) { + asset.labelingState = labelData.labelingState || AssetLabelingState.ManuallyLabeled; + } } else if (files.find((str) => str === ocrFileName)) { asset.state = AssetState.Visited; } else {