练习模块代码优化
This commit is contained in:
parent
1055dd1807
commit
15116fb047
|
@ -1,12 +0,0 @@
|
|||
.list-pods-container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 2rem;
|
||||
color: #333;
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
import './list_pods.css'
|
||||
import React, { useEffect, useState } from 'react';
|
||||
function List_pods(){
|
||||
const [seconds, setSeconds] = useState(60);
|
||||
|
||||
const handleStart = () => {
|
||||
const intervalId = setInterval(() => {
|
||||
if (seconds > 0) {
|
||||
setSeconds(seconds - 1);
|
||||
} else {
|
||||
clearInterval(intervalId);
|
||||
alert('考试时间到!');
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
return () => {
|
||||
clearInterval(intervalId);
|
||||
};
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="App">
|
||||
<h1>剩余时间:{seconds}</h1>
|
||||
<button onClick={handleStart}>开始倒计时</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
export default List_pods
|
|
@ -23,8 +23,8 @@ function Exam(){
|
|||
const [testdata,settestdata]=useState('')
|
||||
const test_func= async()=>{
|
||||
try{
|
||||
const test_src= await axios.post('/api/student/get_test',{student_ID})
|
||||
const test_data=test_src.data['data']
|
||||
const test_src= await axios.post('/api/student/TrainData',{student_ID})
|
||||
const test_data=test_src.data
|
||||
settestdata(test_data)
|
||||
}catch(error){
|
||||
alert(error)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@import url('https://fonts.font.im/css?family=Caveat');
|
||||
|
||||
|
||||
/* 右侧页面 */
|
||||
.body-right-subject{
|
||||
|
@ -81,7 +81,6 @@
|
|||
font-size: 45px;
|
||||
/* color: #ff6666; */
|
||||
color: rgb(252, 102, 102);
|
||||
font-family: 'Caveat', cursive;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@ function SubjectPage(){
|
|||
window.location.href='http://36.138.114.105:30294/'
|
||||
}
|
||||
const [testdata,settestdata]=useState('')
|
||||
const [FalseData,setFalseData]=useState('')
|
||||
const [NotFalse,setNotFalse]=useState('')
|
||||
const [time,settime]=useState(moment().format('YYYY-MM-DD HH:mm:ss'))
|
||||
const [result,setresult]=useState({})
|
||||
|
||||
|
@ -20,7 +22,9 @@ function SubjectPage(){
|
|||
const test=async()=>{
|
||||
try{
|
||||
const test_src= await axios.post('/api/student/get_test',{student_ID})
|
||||
settestdata(test_src.data['data'])
|
||||
settestdata(test_src.data['True'])
|
||||
setFalseData(test_src.data['FalseTest'][1])
|
||||
setNotFalse(test_src.data['FalseTest'][2])
|
||||
}catch(error){
|
||||
alert('test出错')
|
||||
}
|
||||
|
@ -29,87 +33,58 @@ function SubjectPage(){
|
|||
test()
|
||||
},[])
|
||||
|
||||
const [EndTestList,setEndTestList]=useState([])
|
||||
//获取他已经做过的试卷
|
||||
const end_test=async()=>{
|
||||
try{
|
||||
const end_test_src=await axios.post('/api/student/get_end_student',{student_ID})
|
||||
const obj=end_test_src.data['result']
|
||||
setEndTestList(obj)
|
||||
}catch(error){
|
||||
alert(error)
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(()=>{
|
||||
end_test()
|
||||
},[])
|
||||
|
||||
//过期试卷
|
||||
const [outtest,setouttest]=useState({})
|
||||
//分过期试卷⬇
|
||||
useEffect(()=>{
|
||||
let test_list= []
|
||||
for (const key in testdata) {
|
||||
if(testdata[key][4]<time || EndTestList.includes(Number(key))){
|
||||
setouttest({...outtest,[key]:testdata[key]})
|
||||
test_list.push(key)
|
||||
}else{
|
||||
}
|
||||
}
|
||||
//Object.fromEntries() 方法是 JavaScript 的 Object 对象的一个静态方法,用于将一个键值对数组转换为一个对象。它是 Object.entries() 方法的逆操作。
|
||||
const newOuttest = {...outtest,...Object.fromEntries(test_list.map(key => [key, testdata[key]]))};
|
||||
// 更新 outtest
|
||||
setouttest(newOuttest);
|
||||
// 删除 testdata 中对应的项
|
||||
test_list.forEach(key => delete testdata[key]);
|
||||
find_result_func()
|
||||
}, [testdata]);
|
||||
|
||||
const find_result_func=async()=>{
|
||||
try{
|
||||
const find_result=await axios.post('/api/student/fetch_result',{
|
||||
student_ID
|
||||
})
|
||||
setresult(find_result.data['result'])
|
||||
}catch{
|
||||
alert('这里出错')
|
||||
}
|
||||
const click=()=>{
|
||||
console.log(testdata);
|
||||
console.log(FalseData);
|
||||
console.log(NotFalse);
|
||||
}
|
||||
|
||||
return(
|
||||
<div className="body">
|
||||
<div className="body-right-subject">
|
||||
<h3>正在进行的考试与练习</h3>
|
||||
{ testdata &&<div className='test-subject'>
|
||||
{Object.keys(testdata).map((key)=>(
|
||||
{ FalseData &&<div className='test-subject'>
|
||||
{Object.keys(FalseData).map((key)=>(
|
||||
<div className='test-box' key={key}>
|
||||
<p>试卷ID:{testdata[key][6]}</p>
|
||||
<span>发布者:{testdata[key][5]}</span>
|
||||
<div>发布时间:{testdata[key][3]}</div>
|
||||
<div>截至时间:{testdata[key][4]}</div>
|
||||
<Link to={`/exam/${testdata[key][6]}`} className="exam-btn">
|
||||
<p>试卷ID:{key}</p>
|
||||
<span>发布者:{'小陈老师'}</span>
|
||||
<div>发布时间:{FalseData[key][5]}</div>
|
||||
<div>截至时间:{FalseData[key][6]}</div>
|
||||
<Link to={`/exam/${FalseData[key][8]}`} className="exam-btn">
|
||||
考试
|
||||
</Link>
|
||||
</div>
|
||||
))}
|
||||
</div>}
|
||||
<h3>已结束或完成的试卷与练习</h3>
|
||||
{ outtest&& result&&<div className='test-subject'>
|
||||
{Object.keys(outtest).map((key)=>{
|
||||
const score = result[key] !== null ? result[key] + "分" : "缺考";
|
||||
{ testdata&& result&&<div className='test-subject'>
|
||||
{Object.keys(testdata).map((key)=>{
|
||||
return(
|
||||
<div className='test-box' key={key}>
|
||||
<p>试卷ID:{outtest[key][6]}</p>
|
||||
<span>发布者:{outtest[key][5]}</span>
|
||||
<div>发布时间:{outtest[key][3]}</div>
|
||||
<div>截至时间:{outtest[key][4]}</div>
|
||||
<div id='score'>{score}</div>
|
||||
<p>试卷ID:{testdata[key][0][3]}</p>
|
||||
<span>发布者:{'小陈老师'}</span>
|
||||
<div>发布时间:{testdata[key][1][0][5]}</div>
|
||||
<div>截至时间:{testdata[key][1][0][6]}</div>
|
||||
<div id='score'>{testdata[key][0][5]}</div>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>}
|
||||
{ NotFalse&& result&&<div className='test-subject'>
|
||||
{Object.keys(NotFalse).map((key)=>{
|
||||
return(
|
||||
<div className='test-box' key={key}>
|
||||
<p>试卷ID:{NotFalse[key][0][8]}</p>
|
||||
<span>发布者:{'小陈老师'}</span>
|
||||
<div>发布时间:{NotFalse[key][0][5]}</div>
|
||||
<div>截至时间:{NotFalse[key][0][6]}</div>
|
||||
<div id='score'>{'超时'}</div>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
)};
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import top from '../img/top.jpg'
|
|||
import axios from 'axios';
|
||||
|
||||
function Operation1() {
|
||||
const student_ID=localStorage.getItem('islogin')
|
||||
const[isTrue,setisTrue]=useState(true)
|
||||
const click=()=>{
|
||||
console.log(60 * parseInt(TrainData['operateID'][4]));
|
||||
|
@ -37,7 +38,8 @@ function Operation1() {
|
|||
const TrainDataFunc=async()=>{
|
||||
try{
|
||||
const TrainDataSrc=await axios.post('/api/student/TrainData',{
|
||||
operateID
|
||||
operateID,
|
||||
student_ID
|
||||
})
|
||||
const returnData=TrainDataSrc.data
|
||||
setTrainData(returnData)
|
||||
|
@ -49,7 +51,7 @@ function Operation1() {
|
|||
TrainDataFunc()
|
||||
},[])
|
||||
|
||||
useEffect(()=>{
|
||||
function daojishi(){
|
||||
if(localStorage.getItem('time')){
|
||||
setCountdown(localStorage.getItem('time'))
|
||||
}else{
|
||||
|
@ -57,6 +59,11 @@ function Operation1() {
|
|||
setCountdown(60 * parseInt(TrainData['operateID'][4]))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(()=>{
|
||||
daojishi()
|
||||
console.log('a');
|
||||
},[TrainData])
|
||||
|
||||
//倒计时
|
||||
|
@ -65,7 +72,7 @@ function Operation1() {
|
|||
// 倒计时更新
|
||||
useEffect(() => {
|
||||
let interval = setInterval(() => {
|
||||
if (countdown > 0 ) {
|
||||
if (countdown !== 0 ) {
|
||||
setCountdown(countdown - 1);
|
||||
localStorage.setItem('time',countdown-1)
|
||||
} else {
|
||||
|
@ -76,6 +83,14 @@ function Operation1() {
|
|||
return () => clearInterval(interval);
|
||||
}, [countdown]);
|
||||
|
||||
useEffect(()=>{
|
||||
if(countdown<0){
|
||||
console.log('c');
|
||||
setCountdown(60 * parseInt(TrainData['operateID'][4]))
|
||||
localStorage.removeItem('time')
|
||||
}
|
||||
},[TrainData])
|
||||
|
||||
// 转换秒数为时分秒格式
|
||||
const formatTime = (seconds) => {
|
||||
const hours = Math.floor(seconds / 3600);
|
||||
|
@ -140,6 +155,7 @@ function Operation1() {
|
|||
localStorage.setItem('answeredChoice',answeredChoice)
|
||||
localStorage.setItem('answeredComple',answeredComple)
|
||||
localStorage.setItem('answeredJudge',answeredJudge)
|
||||
localStorage.setItem('TrainData',JSON.stringify(TrainData))
|
||||
|
||||
};
|
||||
|
||||
|
@ -210,7 +226,7 @@ function Operation1() {
|
|||
<div className='nav-operation1'>
|
||||
{/* 导航 */}
|
||||
{/* <h1>{OperationId}</h1> */}
|
||||
<p>剩余时间:{formatTime(countdown)}</p>
|
||||
<p>剩余时间:{countdown >=0 && formatTime(countdown)}</p>
|
||||
</div>
|
||||
<div className='body-operation1'>
|
||||
<div className='nav-left-operation1'>
|
||||
|
|
|
@ -8,32 +8,77 @@ import arrowleft from '../img/arrowleft.jpg'
|
|||
import arrowright from '../img/arrowright.jpg'
|
||||
import bottom from '../img/bottom.jpg'
|
||||
import top from '../img/top.jpg'
|
||||
import axios from 'axios';
|
||||
|
||||
function Operation2() {
|
||||
const student_ID=localStorage.getItem('islogin')
|
||||
const { operateID } = useParams();
|
||||
//获取剩余时间
|
||||
const [isTrue,setisTrue]=useState(false)
|
||||
|
||||
const TrainData=JSON.parse(localStorage.getItem('TrainData'))
|
||||
|
||||
//获取链接
|
||||
const [Src,setSrc]=useState()
|
||||
const Train1=async()=>{
|
||||
try{
|
||||
const Train1Src=await axios.post('/api/student/FindTrain1Src',{
|
||||
student_ID,
|
||||
operateID
|
||||
})
|
||||
setSrc(Train1Src.data['Src'])
|
||||
}catch{
|
||||
alert('Train1出错')
|
||||
}
|
||||
}
|
||||
|
||||
//终端
|
||||
const terminalObj = useRef(null);
|
||||
let sock = null;
|
||||
const [terminal, setTerminal] = useState(null);
|
||||
useEffect(() => {
|
||||
if (terminal == null){
|
||||
setTerminal(new Terminal({
|
||||
cols: 80,
|
||||
rows: 27,
|
||||
fontSize: 23
|
||||
}));
|
||||
|
||||
useEffect(()=>{
|
||||
if(TrainData['operateID'][3][0]==='达梦数据库连接'){
|
||||
console.log('第一个');
|
||||
Train1()
|
||||
setisTrue(true)
|
||||
|
||||
|
||||
if (terminal == null){
|
||||
setTerminal(new Terminal({
|
||||
cols: 80,
|
||||
rows: 27,
|
||||
fontSize: 23
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
console.log('第二个');
|
||||
Train1()
|
||||
setisTrue(false)
|
||||
}
|
||||
}, [])
|
||||
},[])
|
||||
const click=()=>{
|
||||
console.log(Src);
|
||||
}
|
||||
|
||||
|
||||
// useEffect(() => {
|
||||
// if (terminal == null){
|
||||
// setTerminal(new Terminal({
|
||||
// cols: 80,
|
||||
// rows: 27,
|
||||
// fontSize: 23
|
||||
// }));
|
||||
// }
|
||||
// }, [])
|
||||
|
||||
// useEffect(() => {
|
||||
|
||||
// if (terminal != null){
|
||||
// terminal.open(terminalObj.current );
|
||||
// sock = new WebSocket("ws://192.168.0.40:8765");
|
||||
// // sock = new WebSocket("ws://192.168.0.40:8765");
|
||||
// sock = new WebSocket(Src);
|
||||
// terminal.onData((data) => {
|
||||
// sock?.send(data);
|
||||
// });
|
||||
|
@ -59,10 +104,13 @@ function Operation2() {
|
|||
event.preventDefault();
|
||||
}
|
||||
|
||||
//删除函数
|
||||
const DEL=()=>{
|
||||
//
|
||||
}
|
||||
|
||||
//倒计时
|
||||
// const { OperationId } = useParams();
|
||||
const [test_data, setTestData] = useState('');
|
||||
const [countdown, setCountdown] = useState(0);
|
||||
|
||||
// 倒计时初始化
|
||||
|
@ -96,9 +144,10 @@ function Operation2() {
|
|||
const [isSubjectDropdownOpen, setIsSubjectDropdownOpen] = useState(false);
|
||||
|
||||
const tijiao = ()=>{
|
||||
clearInterval()
|
||||
setCountdown(0)
|
||||
localStorage.removeItem('time')
|
||||
window.location.href='http://baidu.com'
|
||||
alert('提交成功')
|
||||
window.location.href='http://localhost:3000/train'
|
||||
}
|
||||
|
||||
return (
|
||||
|
@ -131,8 +180,25 @@ function Operation2() {
|
|||
</ul>
|
||||
</div>
|
||||
<div className='body-right2'>
|
||||
第二页(实训题)的右边页面
|
||||
<div style={{width: "1430px",position:'absolute',right:'0'}} ref={terminalObj} onContextMenu={pasteContent}></div>
|
||||
|
||||
|
||||
<button onClick={click}>测试按钮</button>
|
||||
{/* 前端连接数据库⬇ */}
|
||||
{ !isTrue&&<div>
|
||||
<Link to={Src}>{TrainData['operateID'][3][0]}</Link>
|
||||
<br />
|
||||
点击以上链接前往实训
|
||||
</div>}
|
||||
{/* 前端连接数据库 ⬆*/}
|
||||
|
||||
{/* 达梦数据库连接 ⬇*/}
|
||||
{ isTrue&&
|
||||
<div>
|
||||
<p>{TrainData['operateID'][3][0]}</p>
|
||||
<div style={{width: "1430px",position:'absolute',right:'0'}} ref={terminalObj} onContextMenu={pasteContent}></div>
|
||||
</div>}
|
||||
{/* 达梦数据库连接⬆ */}
|
||||
|
||||
</div>
|
||||
<Link className='btn-back2' to={`/operation1/${operateID}`} style={{color:'#000',textDecoration:'none'}}>
|
||||
<p>上一页</p>
|
||||
|
|
|
@ -23,10 +23,9 @@ import ClassID from '../TeacherPages/classlistpages/classId';
|
|||
import ManageTest from '../TeacherPages/TestManage/ManageTest';
|
||||
import SendTest from '../TeacherPages/TestManage/SendTest';
|
||||
import Marking from '../TeacherPages/MarkingPages/Marking';
|
||||
import SendTrain from '../TeacherPages/TrainManage/SendTrain';
|
||||
import TrainManage from '../TeacherPages/TrainManage/Trainmanage';
|
||||
import SendTrain from '../TeacherPages/Trainmanage/SendTrain'
|
||||
import TrainManage from '../TeacherPages/Trainmanage/Trainmanage'
|
||||
import StudentLink from '../TeacherPages/MarkingPages/StudentLink';
|
||||
import List_pods from '../TeacherPages/list_pods/list_pods';
|
||||
|
||||
|
||||
// 定义一个组件来包裹除了特定页面(exam)外的所有页面使其有导航
|
||||
|
@ -77,7 +76,6 @@ function App() {
|
|||
<Route path='/teacher/SendTrain' element={<SendTrain/>}/> {/*实训管理-发布实训*/}
|
||||
<Route path='operation1/:operateID' element={<Operation1/>}/> {/* 实训页面1:理论 */}
|
||||
<Route path='operation2/:operateID' element={<Operation2/>}/> {/* 实训页面2:数据库 */}
|
||||
<Route path='teacher/list_pods' element={<List_pods/>}/>
|
||||
<Route path='/refresh' element={<Refresh/>}/>
|
||||
|
||||
{/* 独立的顶级路由,如登录页面,也不包含HeaderNav */}
|
||||
|
|
|
@ -99,7 +99,14 @@ def get_lesson(): # 获取课程
|
|||
def get_test(): # 获取试卷以及历史试卷
|
||||
data = request.json
|
||||
ID = data['student_ID']
|
||||
return jsonify({"data": fetch_test_func(ID)})
|
||||
result1=fetch_test_func(ID)
|
||||
result2=falseTest_func(ID)
|
||||
return jsonify({"True":result1,'FalseTest':result2})
|
||||
|
||||
@app.route('/api/student/get_testID',methods=['POST'])
|
||||
def get_testID(): # 获取试卷ID
|
||||
ID=request.json['student_ID']
|
||||
return jsonify({'data': 'a'})
|
||||
|
||||
|
||||
@app.route('/api/student/fetch_result', methods=['POST']) # 查找成绩
|
||||
|
@ -147,6 +154,13 @@ def HistoryTrain():
|
|||
result=HistoryTrainFunc(ID)
|
||||
return jsonify({'HistoryTrain': result})
|
||||
|
||||
@app.route('/api/student/FindTrain1Src',methods=['POST'])
|
||||
def FindTrain1Src():
|
||||
ID = request.json['student_ID']
|
||||
testID=request.json['operateID']
|
||||
result=FindTrain1SrcFunc(ID,testID)
|
||||
return jsonify({'Src':result})
|
||||
|
||||
|
||||
|
||||
# 以下为教师功能—————————————————————————————————————————————————————————————————————
|
||||
|
|
|
@ -3,6 +3,11 @@ import json
|
|||
from Crypto.Cipher import AES
|
||||
from Crypto.Random import get_random_bytes
|
||||
import base64
|
||||
from datetime import datetime
|
||||
|
||||
# 获取当前日期和时间
|
||||
current_datetime = datetime.now()
|
||||
Time=current_datetime.strftime("%Y-%m-%d %H:%M:%S")
|
||||
|
||||
db = dmPython.connect(user='SYSDBA', password='dameng!!', host="36.138.114.105", port="32522")
|
||||
|
||||
|
@ -123,63 +128,44 @@ def student_succeed_func(ID):
|
|||
# fetch_testID('20240101')
|
||||
def fetch_test_func(ID):#获取试卷
|
||||
cursor = db.cursor()
|
||||
cursor.execute(f'SELECT TEST_ID FROM STUDENT_TEST WHERE STUDENT_ID={ID}')
|
||||
testID = []
|
||||
TEST_ID = cursor.fetchall()
|
||||
for i in TEST_ID:
|
||||
testID.append(i[0])
|
||||
test_succeed = {} # 初始化一个空字典,用于保存结果
|
||||
TrueTestDic={}
|
||||
TruetestID=[]
|
||||
cursor.execute(f"SELECT * FROM STUDENT_TEST WHERE STUDENT_ID=? AND TF='true'",(ID))
|
||||
for i in cursor.fetchall():
|
||||
TruetestID.append(i[3])
|
||||
TrueTestDic[i[3]]=i
|
||||
|
||||
for i in testID:
|
||||
cursor.execute(f'SELECT * FROM TEST_BANK WHERE ID={i}')
|
||||
test = cursor.fetchall()[0]
|
||||
test = list(test)
|
||||
# print(test)
|
||||
# 开始时间及结束时间
|
||||
releasetime = test[5]
|
||||
endtime = test[6]
|
||||
# 持续时间
|
||||
hour = test[3]
|
||||
min = test[4]
|
||||
# 发布人
|
||||
cursor.execute(f'SELECT TEACHER_ID FROM TEACHER_MIDDLE_SUBJECT WHERE SUBJECT=(?)', (test[9]))
|
||||
teacher_id = cursor.fetchone()[0]
|
||||
cursor.execute(f'SELECT TEACHER_NAME FROM TEACHER WHERE TEACHER_ID=(?)', (teacher_id))
|
||||
teacher_name = cursor.fetchone()[0]
|
||||
#试卷ID
|
||||
test_id = test[8]
|
||||
|
||||
choice_list = test[0]
|
||||
completion_list = test[1]
|
||||
judge_list = test[2]
|
||||
choice_list = json.loads(choice_list)
|
||||
completion_list = json.loads(completion_list)
|
||||
judge_list = json.loads(judge_list)
|
||||
|
||||
# 初始化存储选项的列表
|
||||
choice = []
|
||||
completion = []
|
||||
judge = []
|
||||
|
||||
for j in list(choice_list):
|
||||
cursor.execute(f'SELECT * FROM CHOICE_QUESTION_BANK WHERE ID=(?)', (j))
|
||||
choice.append(cursor.fetchall())
|
||||
|
||||
for j in list(completion_list):
|
||||
cursor.execute(f'SELECT * FROM COMPLETION_QUESTION_BANK WHERE ID=(?)', (j))
|
||||
completion.append(cursor.fetchall())
|
||||
|
||||
for j in list(judge_list):
|
||||
cursor.execute(f'SELECT * FROM T_OR_F_QUESTION_BANK WHERE ID=(?)', (j))
|
||||
judge.append(cursor.fetchall())
|
||||
|
||||
# 存储结果到test_succeed字典中
|
||||
test_succeed[i] = [[choice, completion, judge], hour, min, releasetime, endtime,teacher_name,test_id]
|
||||
|
||||
# 在循环之外打印结果
|
||||
return test_succeed
|
||||
for index in TruetestID:
|
||||
cursor.execute(f"SELECT * FROM TEST_BANK WHERE ID=?",(index))
|
||||
TrueTestDic[index]=TrueTestDic[index],cursor.fetchall()
|
||||
# print(TrueTestDic)
|
||||
return TrueTestDic
|
||||
# fetch_test_func('20240101')
|
||||
|
||||
def falseTest_func(ID):
|
||||
cursor = db.cursor()
|
||||
FalseTestDic={}
|
||||
NOTFalseTestDic={}
|
||||
FalseTestID=[]
|
||||
|
||||
cursor.execute(f"SELECT * FROM STUDENT_TEST WHERE STUDENT_ID=? AND TF='false'",(ID))
|
||||
for i in cursor.fetchall():
|
||||
FalseTestID.append(i[3])
|
||||
|
||||
for index in FalseTestID:
|
||||
cursor.execute(f"SELECT * FROM TEST_BANK WHERE ID=?",(index))
|
||||
if cursor.fetchall()[0][6]>Time:
|
||||
cursor.execute(f"SELECT * FROM TEST_BANK WHERE ID=?", (index))
|
||||
FalseTestDic[index]=cursor.fetchall()[0]
|
||||
else:
|
||||
cursor.execute(f"SELECT * FROM TEST_BANK WHERE ID=?", (index))
|
||||
NOTFalseTestDic[index]=cursor.fetchall()
|
||||
|
||||
return {'1':FalseTestDic,'2':NOTFalseTestDic}
|
||||
|
||||
|
||||
# falseTest_func('20240101')
|
||||
|
||||
# 查找学生已经完成的记录
|
||||
def find_end_test(ID):
|
||||
cursor = db.cursor()
|
||||
|
@ -280,6 +266,17 @@ def HistoryTrainFunc(ID):
|
|||
|
||||
# HistoryTrainFunc('20240101')
|
||||
|
||||
def FindTrain1SrcFunc(ID,testID):
|
||||
cursor=db.cursor()
|
||||
cursor.execute("SELECT LINK FROM TRAINSCORE WHERE STUDENT_ID=? AND TEST_ID=?",(ID,testID))
|
||||
result=cursor.fetchall()[0][0]
|
||||
print(result)
|
||||
cursor.close()
|
||||
return result
|
||||
|
||||
# FindTrain1SrcFunc('20240101','3')
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue