Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V2.0中labelCategories及connectionCategories的id为什么设计是从0开始连续自增的呢? #38

Closed
geminiyu233 opened this issue Sep 25, 2019 · 2 comments
Assignees
Labels

Comments

@geminiyu233
Copy link
Contributor

geminiyu233 commented Sep 25, 2019

在使用升级的V2.0后,我的data格式如下:

{
  "content": "文本内容",
  "labelCategories": [
        {
            "id": 0,
            "text": "名词",
            "color": "#eac0a2",
            "borderColor": "#a38671"
        },
        {
            "id":8,
            "text": "动词",
            "color": "#619dff",
            "borderColor": "#436db2"
        },
        {
            "id": 2,
            "text": "形容词",
            "color": "#9d61ff",
            "borderColor": "#6d43b2"
        },
        {
            "id": 99,
            "text": "副词",
            "color": "#ff9d61",
            "borderColor": "#b26d43"
        }
    ],
    "labels": [
        {
            "id": 0,
            "categoryId": 99,
            "startIndex": 0,
            "endIndex": 2
        },
        {
            "id": 1,
            "categoryId": 0,
            "startIndex": 3,
            "endIndex": 4
        }
    ],
    "connectionCategories": [
        {
            "id": 0,
            "text": "修饰"
        },
        {
            "id": 1,
            "text": "限定"
        },
        {
            "id": 2,
            "text": "是...的动作"
        }
    ],
    "connections": []
}

labelCategories及connectionCategories从数据库取出来的的id是乱序,并非是从0开始连续自增的,这样就会导致对label新增的时候,新增的label名称并非选中的label名,connections也是同样的。
对此我有两点问题:
1、不是很明白作者为什么要设计labelCategories及connectionCategories的id是从0开始连续自增的?
2、这样对版本迁移非常不友好呢,像我司开始用您的V1.0版本是允许labelCategories及connectionCategories的id随意的,升级V2.0版本后,若要按此规则的话,之前用V1.0版本标注的数据都不能用了呢,请问有什么解决办法吗?(目前我的办法是将后端传过来的数据labelCategories及connectionCategories的id处理成从0开始连续自增,在标注结束后,提交保存前,再对应还原数据库的labelCategories及connectionCategories的id)

@longfangsong longfangsong self-assigned this Sep 25, 2019
@geminiyu233 geminiyu233 changed the title labelCategories及connectionCategories的id为什么设计是从0开始连续自增的呢? V2.0中labelCategories及connectionCategories的id为什么设计是从0开始连续自增的呢? Sep 25, 2019
@longfangsong
Copy link
Collaborator

感谢报告bug(这确实可以被看作是bug)
将尽快修复
对您敢于使用Alpha版本并报告bug,作者表示万分感激

@longfangsong
Copy link
Collaborator

@geminiyu233
已经在2.0.0-beta中修复
uQliKU.png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants