Browse Source

理清了, 坑也更多了

nandHyf 1 year ago
parent
commit
ca9be513c7
4 changed files with 86 additions and 17 deletions
  1. 9 4
      Stateful.py
  2. 17 7
      dev_config.toml
  3. 12 5
      t.py
  4. 48 1
      try.txt

+ 9 - 4
Stateful.py

@@ -124,6 +124,9 @@ def BuildObj():
 
 
 def GenModel():
+    # model IE?
+    # over write?
+    # exec
     pass
 
 
@@ -148,9 +151,11 @@ class Command():
         return res
 
 
-    def add(self, values, addObj="board", addType="new"):
+    def add(self, addObj="board", addType="new"):
         # get values
-        values = []
+        v1 = MatchTomlTable(self.table)
+        v2 = v1[1:-1]
+
         # 
         sqls = "INSERT INTO {table} VALUES({values})".format(table=self.table, values=values)
         res = Exec_one(self.dp, sqls)
@@ -178,7 +183,7 @@ class Command():
 
     def move(self, moveObj):
         if moveObj == "KB":
-            pass
+            print("err <Code>: syntax error")
         
         elif moveObj == "CL":
             pass
@@ -192,7 +197,7 @@ class Command():
             sqls = "SELECT name FROM sqlite_master WHERE type='table' AND name is NOT 'sqlite_sequence';"
 
         elif backType == "previous":
-            sqls = ""
+            sqls = "SELECT name FROM {table} WHERE name='{}'"
 
         Exec_one(dbPath, sqls)
 

+ 17 - 7
dev_config.toml

@@ -29,18 +29,28 @@ c4 = "stuckedTime"
 c5 = "solvedTime"
 c6 = "status"
 
+[Unclassified]
+c1_pk = "id INTEGER PRIMARY KEY ASC"
+c2 = "boardId"
+c3 = "eventId"
+c4 = "status"
+
 
 # ----- App Configuration -----
+SafeMode = false
+LLM_callable = false
+
 DBType = "sqlite3"
 DBPath = "dev.db"
 
-lang = "en"
-listStyle = "tree"
-displayTimeZone = "utc+8"
-
-LLM_call = false
+Lang = "en"
+ListStyle = "tree"
+DisplayTimeZone = "utc+8"
 
 
-# ----- note -----
-# set integer prime key: <columnName> INTEGER PRIMARY KEY ASC
+# ----- Some Notes -----
+# Set integer prime key: <columnName> INTEGER PRIMARY KEY ASC
 # status: alive/deleted
+#                                           ↓ Don't foget to write the method(s) for it
+# ListStyle: tree/md_table/LLM_md_table/<customName>
+# SafeMode/StrickMode: 1. Have to be full length commands; 2. err when not exist

+ 12 - 5
t.py

@@ -11,15 +11,22 @@ def MatchTomlTable(tomlName, tableName, returnType="list"):
         return d
 
 
-def add():
-    values = []
+def add(args=[]):
+    table = "Class"
+    
+    v1 = MatchTomlTable(tomlName, 'Class')[1:]
+    
+
+    
 
-    sqls = "INSERT INTO {table} VALUES({values})".format(table=self.table, values=values)
-    res = Stateful.Exec_one(dp, sqls)
+    sqls = "INSERT INTO {table} VALUES({values})".format(table=table, values=sqls_v)
+    # res = Stateful.Exec_one(dp, sqls)
+    print(sqls)
 
 
 if __name__ == "__main__":
     tomlName = "dev_config.toml"
     dp = "dev.db"
-    res = MatchTomlTable(tomlName, "Board")
+    # res = MatchTomlTable(tomlName, "Board")
+    res = add()
     print(res)

+ 48 - 1
try.txt

@@ -15,4 +15,51 @@ add event EV1 to KB4 / CL2
 CREATE TABLE Board(id INTEGER PRIMARY KEY AUTOINCREMENT, name, status)
 CREATE TABLE Class(id INTEGER PRIMARY KEY AUTOINCREMENT, name, usingBoard, status)
 CREATE TABLE Event(id INTEGER PRIMARY KEY AUTOINCREMENT, name, dscrp, creator, createdTime, classCreated, classCurrent, status)
-CREATE TABLE Stucked(id INTEGER PRIMARY KEY AUTOINCREMENT, boardId, eventId, stuckedTime, solvedTime, status)
+CREATE TABLE Stucked(id INTEGER PRIMARY KEY AUTOINCREMENT, boardId, eventId, stuckedTime, solvedTime, status)
+
+
+[type == board]
+/, /KB, /KB/CL, KB/CL/EV: add board <KB2> -> ok
+
+
+[type == class]
+/: add class <CL> -> err (功能上可行但逻辑上不允许)
+/: add class <CL> to <KB> -> ok
+
+/KB: add class <CL> -> ok
+/KB, /KB/CL, /KB/CL/EV: add class <CL> to <KB2>
+    KB2 ie -> ok
+    KB2 ie false, add KB2, add CL -> ok
+        sec: KB2 not ie, create/cancel?[y/n]
+
+
+[type == event]
+/: add event <EV> -> err
+/: add event <EV> to <KB> -> ok
+    sec: no class, class in KB, choose, input()
+
+/: add event <EV> to <KB>/<CL> -> ok
+
+/KB: add event <EV> -> ok
+/KB: add event <EV> to <KB2> -> ok
+    KB2 ie, sec: no class, class in KB, choose, input() -> ok
+    KB2 ne, add KB2, sec: no class, class in KB, choose, input() -> ok
+
+# maybe a safe/strick mode = true in config.toml
+/KB: add event <EV> to <CL> -> ok
+/KB: add event <EV> to <KB2>/<CL> -> ok
+/KB: add event <EV> to <KB>/<CL> -> ok
+/KB: add event <EV> to <KB>/<CL>/,  <KB>/<CL>/<EV> -> err
+
+
+/KB/CL: add event <EV> -> ok
+/KB/CL: add event <EV> to <CL2>
+    CL2 ie in KB, -> ok
+    CL2 ne in KB, -> err
+
+/KB/CL/EV: add event <EV> -> err
+/KB/CL/EV: add event <EV> to <KB>
+/KB/CL/EV: add event <EV> to <KB2>
+/KB/CL/EV: add event <EV> to <CL>
+/KB/CL/EV: add event <EV> to <CL2>
+/KB/CL/EV: add event <EV2> to <KB>/<CL>