Skip to content

Commit

Permalink
update asset labelingState when load local project (microsoft#660)
Browse files Browse the repository at this point in the history
  • Loading branch information
yongbing-chen authored Oct 21, 2020
1 parent 28c54fc commit 1aa3daa
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/electron/providers/storage/localFileSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 1aa3daa

Please sign in to comment.