Procházet zdrojové kódy

Refactor: Use TaskStatus enum for task status handling (#646)

### What problem does this PR solve?

This commit changes the status 'not started' from being hard-coded to
being maintained by the TaskStatus enum. This enhancement ensures
consistency across the codebase and improves maintainability.

### Type of change

- [x] Refactoring
tags/v0.5.0
Moonlit před 1 rokem
rodič
revize
ca5acc151a
Žádný účet není propojen s e-mailovou adresou tvůrce revize
2 změnil soubory, kde provedl 3 přidání a 1 odebrání
  1. 2
    1
      api/apps/document_app.py
  2. 1
    0
      api/db/__init__.py

+ 2
- 1
api/apps/document_app.py Zobrazit soubor

@@ -367,7 +367,8 @@ def change_parser():
return get_data_error_result(retmsg="Not supported yet!")
e = DocumentService.update_by_id(doc.id,
{"parser_id": req["parser_id"], "progress": 0, "progress_msg": "", "run": "0"})
{"parser_id": req["parser_id"], "progress": 0, "progress_msg": "",
"run": TaskStatus.UNSTART.value})
if not e:
return get_data_error_result(retmsg="Document not found!")
if "parser_config" in req:

+ 1
- 0
api/db/__init__.py Zobrazit soubor

@@ -64,6 +64,7 @@ class ChatStyle(StrEnum):
class TaskStatus(StrEnum):
UNSTART = "0"
RUNNING = "1"
CANCEL = "2"
DONE = "3"

Načítá se…
Zrušit
Uložit