提交版本
This commit is contained in:
@@ -2,27 +2,15 @@
|
||||
|
||||
|
||||
import time
|
||||
|
||||
|
||||
class BackBoardManager:
|
||||
def __init__(self):
|
||||
self.backboards = {} # user_id: Backboard
|
||||
|
||||
def add_backboard(self, user_id, folder):
|
||||
self.backboards[user_id] = Backboard(user_id, folder)
|
||||
|
||||
def get_backboard(self, user_id):
|
||||
if user_id not in self.backboards:
|
||||
return None
|
||||
return self.backboards[user_id]
|
||||
|
||||
|
||||
|
||||
import os
|
||||
|
||||
class Backboard:
|
||||
def __init__(self, user_id, folder):
|
||||
def __init__(self, user_id, username, course_id, lesson_id, root_path):
|
||||
self.user_id = user_id
|
||||
self.folder = folder
|
||||
self.username = username
|
||||
self.course_id = course_id
|
||||
self.lesson_id = lesson_id
|
||||
self.root_path = root_path
|
||||
self.create_time = time.time()
|
||||
self.enter_chapter_time = time.time()
|
||||
self.history = []
|
||||
@@ -48,12 +36,12 @@ class Backboard:
|
||||
f"- User's total study time is {self.get_deltatime_mmss(self.create_time, time.time())}{endl}"
|
||||
f"- User's current chapter study time is {self.get_deltatime_mmss(self.enter_chapter_time, time.time())}{endl}"
|
||||
f"- Activated file path: {self.active_file_path}{endl}"
|
||||
f"- Activated file content (current editing 10 lines): {endl}"
|
||||
f"```{endl}"
|
||||
f"{self.active_file_content[-10:]}{endl}"
|
||||
f"```{endl}"
|
||||
f"- Last five action:{five_history}{endl}"
|
||||
f"- File tree: {self.file_tree}{endl}")
|
||||
# f"- Activated file content (current editing 10 lines): {endl}"
|
||||
def add_history(self, realtime_action):
|
||||
if(realtime_action['type']=='config'):return
|
||||
if len(self.history)!=0:
|
||||
@@ -72,3 +60,21 @@ class Backboard:
|
||||
return f"{hours:02d}:{minutes:02d}:{seconds:02d}"
|
||||
|
||||
|
||||
def get_active_file_reletive_path(self):
|
||||
relative_path = os.path.relpath(self.active_file_path, self.root_path)
|
||||
return relative_path
|
||||
|
||||
|
||||
|
||||
class BackBoardManager:
|
||||
def __init__(self):
|
||||
self.backboards = {} # user_id: Backboard
|
||||
|
||||
def add_backboard(self, user_id, username, course_id, lesson_id, root_path):
|
||||
self.backboards[user_id] = Backboard(user_id,username, course_id, lesson_id, root_path)
|
||||
|
||||
def get_backboard(self, user_id) -> Backboard:
|
||||
return self.backboards[user_id]
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user