Merge remote-tracking branch 'origin/master'
# Conflicts: # app-dm/src/router/index.jsx # python/app.py # python/k8s_func.py
This commit is contained in:
commit
df8ece4dd8
|
@ -3,6 +3,8 @@ import { Link } from 'react-router-dom';
|
||||||
// import axios from 'axios';
|
// import axios from 'axios';
|
||||||
import './Marking.css';
|
import './Marking.css';
|
||||||
import Test from '../../pages/Home/img/test.jpg'
|
import Test from '../../pages/Home/img/test.jpg'
|
||||||
|
import React, { useEffect, useState } from 'react';
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
// 批改
|
// 批改
|
||||||
function Marking(){
|
function Marking(){
|
||||||
|
@ -12,33 +14,80 @@ function Marking(){
|
||||||
window.location.href='http://36.138.114.105:30294/'
|
window.location.href='http://36.138.114.105:30294/'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const [istrue,setistrue]=useState(false)
|
||||||
|
|
||||||
|
//获取班级
|
||||||
|
const [ClassID,setClassID]=useState()
|
||||||
|
const [selectClass,SetClassData]=useState()
|
||||||
|
const SeleactClass= async()=>{
|
||||||
|
try {
|
||||||
|
const select_class_src = await axios.post('/api/teacher/select_class', {
|
||||||
|
teacher_ID
|
||||||
|
});
|
||||||
|
SetClassData(select_class_src.data['Class']);
|
||||||
|
setClassID(Object.keys(select_class_src.data['Class'])[0])
|
||||||
|
setistrue(true)
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
useEffect(()=>{
|
||||||
|
SeleactClass()
|
||||||
|
},[])
|
||||||
|
|
||||||
|
//获取默认的未批改的实训
|
||||||
|
const [MarkData,setMarkData]=useState()
|
||||||
|
const MarkTrainFunc=async()=>{
|
||||||
|
try{
|
||||||
|
const MarkTrainSrc=await axios.post('/api/teacher/marktrain',{
|
||||||
|
ClassID,
|
||||||
|
teacher_ID
|
||||||
|
})
|
||||||
|
setMarkData(MarkTrainSrc.data['MarkClass'])
|
||||||
|
}catch{
|
||||||
|
alert('MarkTrain出错')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
useEffect(()=>{
|
||||||
|
if(istrue){
|
||||||
|
MarkTrainFunc()
|
||||||
|
}
|
||||||
|
},[ClassID])
|
||||||
|
|
||||||
|
|
||||||
|
const ClassChange=(event)=>{
|
||||||
|
setClassID(event.target.value)
|
||||||
|
}
|
||||||
|
const click=()=>{
|
||||||
|
console.log(ClassID);
|
||||||
|
console.log(MarkData);
|
||||||
|
}
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<div className='body-right-mark'>
|
<div className='body-right-mark'>
|
||||||
<select className='mark-list'>
|
{selectClass&&<select className='mark-list' onChange={ClassChange}>
|
||||||
<option value="2024级一班">2024级一班</option>
|
{Object.keys(selectClass).map((key)=>(
|
||||||
<option value="2024级二班">2024级二班</option>
|
<option value={key} key={key} >{key}</option>
|
||||||
<option value="2024级三班">2024级三班</option>
|
))}
|
||||||
</select>
|
</select>}
|
||||||
<div className='test-mark'>
|
{MarkData&&<div className='test-mark'>
|
||||||
{/* 内容 */}
|
{/* 内容 */}
|
||||||
<ul>
|
<ul>
|
||||||
{[{class:'课程1:达梦数据库的安装',time:"关闭时间:2024-4-16 11.46",ImgSrc:Test},
|
{Object.keys(MarkData).map((key)=>(
|
||||||
{class:'课程2:web前端开发与数据库的结合',time:"关闭时间:2024-4-16 11.46",ImgSrc:Test},
|
<Link style={{color:'#000',textDecoration:'none'}} to={`studentlink/Mark/${key}`}>
|
||||||
{class:'课程2:web前端开发与数据库的结合',time:"关闭时间:2024-4-16 11.46",ImgSrc:Test},
|
<li key={key}>
|
||||||
].map((item) =>
|
<img src={Test} alt="" width='35px' height='35px'/>
|
||||||
<Link style={{color:'#000',textDecoration:'none'}} to={'studentlink'}>
|
|
||||||
<li key={item.class}>
|
|
||||||
<img src={item.ImgSrc} alt="" width='35px' height='35px'/>
|
|
||||||
<p>
|
<p>
|
||||||
<p className='p-mark'>{item.class}</p>
|
<p className='p-mark'><span>实训ID:{MarkData[key][0][10]}</span>{eval(MarkData[key][0][11])}</p>
|
||||||
<span>{item.time}</span>
|
<span>{MarkData[key][0][6]}</span><span></span>
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
</Link>
|
</Link>
|
||||||
)}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
|
<button onClick={click}>asda</button>
|
||||||
</div>
|
</div>}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,33 @@
|
||||||
import './StudentLink.css'
|
import './StudentLink.css'
|
||||||
|
import { useParams } from 'react-router-dom';
|
||||||
|
import React, { useEffect, useState } from 'react';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
|
||||||
function StudentLink(){
|
function StudentLink(){
|
||||||
|
const testID=useParams()['key']
|
||||||
|
|
||||||
|
|
||||||
|
const submit=()=>{
|
||||||
|
console.log(TestLink);
|
||||||
|
}
|
||||||
|
|
||||||
|
const [TestLink,setTestLink]=useState()
|
||||||
|
const NotMarkTestFunc=async ()=>{
|
||||||
|
try{
|
||||||
|
const NotMarkTestSrc=await axios.post('/api/teacher/NotMarkTest',{
|
||||||
|
testID
|
||||||
|
})
|
||||||
|
setTestLink(NotMarkTestSrc.data['result'])
|
||||||
|
}catch{
|
||||||
|
alert('出错')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
useEffect(()=>{
|
||||||
|
NotMarkTestFunc()
|
||||||
|
},[])
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<div className='body-right-studentlink'>
|
<div className='body-right-studentlink'>
|
||||||
<table>
|
<table>
|
||||||
|
@ -13,14 +38,17 @@ function StudentLink(){
|
||||||
<th>分数</th>
|
<th>分数</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
{TestLink&&<tbody>
|
||||||
<tr>
|
{Object.keys(TestLink).map((key)=>(
|
||||||
<td>数据1</td>
|
<tr key={key}>
|
||||||
<td>数据2</td>
|
<td>{key}</td>
|
||||||
<td>数据3</td>
|
<td><Link to={TestLink[key][6]}>{TestLink[key][6]}</Link></td>
|
||||||
|
<td><input type="text" name="" id="" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
))}
|
||||||
|
</tbody>}
|
||||||
</table>
|
</table>
|
||||||
|
<button onClick={submit}>提交</button>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,7 +130,7 @@ function SendTest(){
|
||||||
</div>
|
</div>
|
||||||
<div className='SendTest_body_right'>
|
<div className='SendTest_body_right'>
|
||||||
<p>题目选择</p>
|
<p>题目选择</p>
|
||||||
{<table>
|
{question&&<table>
|
||||||
<span className='title'>选择题</span>
|
<span className='title'>选择题</span>
|
||||||
{Object.keys(question['choice']).map((key)=>(
|
{Object.keys(question['choice']).map((key)=>(
|
||||||
<tr key={key}>
|
<tr key={key}>
|
||||||
|
@ -207,11 +207,6 @@ function SendTest(){
|
||||||
</table>}
|
</table>}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<button onClick={SendTrainBtn} id='SendTrainBtn'>发布按钮</button>
|
<button onClick={SendTrainBtn} id='SendTrainBtn'>发布按钮</button>
|
||||||
</div>
|
</div>
|
||||||
{/* 右边的内容 */}
|
{/* 右边的内容 */}
|
||||||
|
|
|
@ -202,9 +202,8 @@
|
||||||
|
|
||||||
.calendar-box span{
|
.calendar-box span{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
/* top: 20px; */
|
top: 400px;
|
||||||
top: 380px;
|
right: 185px;
|
||||||
right: 160px;
|
|
||||||
}
|
}
|
||||||
.calendar1{
|
.calendar1{
|
||||||
width: 100px;
|
width: 100px;
|
||||||
|
|
|
@ -3,7 +3,8 @@ import { Link } from 'react-router-dom';
|
||||||
import './SendTrain.css'
|
import './SendTrain.css'
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import DatePicker from 'react-datepicker';
|
import DatePicker from 'react-datepicker';
|
||||||
import 'react-datepicker/dist/react-datepicker.css';
|
import "react-datepicker/dist/react-datepicker.css";
|
||||||
|
|
||||||
|
|
||||||
function SendTrain(){
|
function SendTrain(){
|
||||||
const teacher_ID=localStorage.getItem('islogin')
|
const teacher_ID=localStorage.getItem('islogin')
|
||||||
|
@ -77,7 +78,9 @@ function SendTrain(){
|
||||||
StopTime,
|
StopTime,
|
||||||
selectedItems,
|
selectedItems,
|
||||||
Train,
|
Train,
|
||||||
teacher_ID
|
teacher_ID,
|
||||||
|
startDate,
|
||||||
|
endDate
|
||||||
})
|
})
|
||||||
alert('发布成功')
|
alert('发布成功')
|
||||||
window.location.href='/teacher/trainmanage'
|
window.location.href='/teacher/trainmanage'
|
||||||
|
@ -89,7 +92,7 @@ function SendTrain(){
|
||||||
|
|
||||||
|
|
||||||
const SendTrainBtn=()=>{
|
const SendTrainBtn=()=>{
|
||||||
if(selectedItems.length>0 && (HourValue || MinValue)&&StopTime){
|
if(selectedItems.length>0 && (HourValue || MinValue)){
|
||||||
if(Train.length>0){
|
if(Train.length>0){
|
||||||
SendTrainTest()
|
SendTrainTest()
|
||||||
}else{
|
}else{
|
||||||
|
@ -133,34 +136,19 @@ function SendTrain(){
|
||||||
}
|
}
|
||||||
//获取截止时间
|
//获取截止时间
|
||||||
const [StopTime,SetStopTime]=useState('')
|
const [StopTime,SetStopTime]=useState('')
|
||||||
const getstoptime=(event)=>{
|
|
||||||
SetStopTime(event.target.value)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 日历
|
// 日历
|
||||||
// 用于存储开始日期和结束日期的状态
|
|
||||||
const [startDate, setStartDate] = useState(new Date());
|
const [startDate, setStartDate] = useState(new Date());
|
||||||
const [endDate, setEndDate] = useState(new Date());
|
const [endDate, setEndDate] = useState(new Date());
|
||||||
// 格式化日期显示
|
// 处理开始时间选择
|
||||||
const formatDate = (date) => {
|
|
||||||
return date.toLocaleDateString();
|
|
||||||
};
|
|
||||||
// 选择日期时更新状态
|
|
||||||
const handleStartDateChange = (date) => {
|
const handleStartDateChange = (date) => {
|
||||||
setStartDate(date);
|
setStartDate(date);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 处理结束时间选择
|
||||||
const handleEndDateChange = (date) => {
|
const handleEndDateChange = (date) => {
|
||||||
setEndDate(date);
|
setEndDate(date);
|
||||||
};
|
};
|
||||||
// 计算并显示总天数
|
|
||||||
const calculateTotalDays = () => {
|
|
||||||
const differenceInTime = endDate - startDate;
|
|
||||||
const differenceInDays = Math.floor(differenceInTime / (1000 * 60 * 60 * 24));
|
|
||||||
return differenceInDays;
|
|
||||||
};
|
|
||||||
useEffect(() => {
|
|
||||||
console.log(calculateTotalDays());
|
|
||||||
}, [startDate, endDate]);
|
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<div className='SendTrain_body'>
|
<div className='SendTrain_body'>
|
||||||
|
@ -334,10 +322,10 @@ function SendTrain(){
|
||||||
<option value={num} key={num}>{num}</option>
|
<option value={num} key={num}>{num}</option>
|
||||||
))}
|
))}
|
||||||
</select>小时
|
</select>小时
|
||||||
{/* <button onClick={()=>{
|
<button onClick={()=>{
|
||||||
console.log(selectedItems);
|
console.log(startDate);
|
||||||
console.log(Train);
|
console.log(endDate);
|
||||||
}}>asd</button> */}
|
}}>asd</button>
|
||||||
<select name="" id="" value={MinValue} onChange={getminvalue}>
|
<select name="" id="" value={MinValue} onChange={getminvalue}>
|
||||||
{min_list.map((num)=>(
|
{min_list.map((num)=>(
|
||||||
<option value={num} key={num}>{num}</option>
|
<option value={num} key={num}>{num}</option>
|
||||||
|
@ -346,27 +334,32 @@ function SendTrain(){
|
||||||
{/* 日历 */}
|
{/* 日历 */}
|
||||||
<p>请填写考试开始、截止日期</p>
|
<p>请填写考试开始、截止日期</p>
|
||||||
<div className='calendar-box'>
|
<div className='calendar-box'>
|
||||||
|
{/* 开始时间输入框 */}
|
||||||
|
<div className='start-date-input'>
|
||||||
|
{/* 日历组件 */}
|
||||||
|
<div className='calendar-picker'>
|
||||||
<DatePicker
|
<DatePicker
|
||||||
selected={startDate}
|
selected={startDate}
|
||||||
onChange={handleStartDateChange}
|
onChange={handleStartDateChange}
|
||||||
dateFormat="yyyy/MM/dd"
|
dateFormat="yyyy-MM-dd HH:mm"
|
||||||
placeholderText="选择开始日期"
|
showTimeSelect
|
||||||
popperPlacement="left-start"
|
timeIntervals={10} // 时间选择间隔,单位为分钟
|
||||||
className='calendar1'
|
timeCaption="time"
|
||||||
|
minDate={new Date()} // 不能选择过去的日期
|
||||||
/>
|
/>
|
||||||
<span>-</span>
|
|
||||||
<DatePicker
|
<DatePicker
|
||||||
selected={endDate}
|
selected={endDate}
|
||||||
onChange={handleEndDateChange}
|
onChange={handleEndDateChange}
|
||||||
dateFormat="yyyy/MM/dd"
|
dateFormat="yyyy-MM-dd HH:mm"
|
||||||
placeholderText="选择结束日期"
|
showTimeSelect
|
||||||
minDate={startDate} // 设置最小日期为开始日期
|
timeIntervals={10}
|
||||||
withFullScreenPortal={false} // 避免全屏模式
|
timeCaption="time"
|
||||||
popperPlacement="left-start"
|
minDate={startDate || new Date()} // 结束日期不能早于开始日期
|
||||||
className='calendar2'
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<p className='data-num'>总天数:{calculateTotalDays()}天</p>
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -43,10 +43,6 @@ const WarningModal = ({ isOpen, onClose }) => {
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
const list4=[
|
|
||||||
{'train':'实训3:待定',id:'3'},
|
|
||||||
{'train':'实训4:待定',id:'4'}
|
|
||||||
]
|
|
||||||
// 首页 学习分析
|
// 首页 学习分析
|
||||||
function SubjectPage(){
|
function SubjectPage(){
|
||||||
|
|
||||||
|
@ -94,6 +90,7 @@ function SubjectPage(){
|
||||||
{Object.keys(title).map((key)=>(
|
{Object.keys(title).map((key)=>(
|
||||||
<div className='test-box-training' key={key}>
|
<div className='test-box-training' key={key}>
|
||||||
<p>实训:{eval(title[key][0][11])}</p>
|
<p>实训:{eval(title[key][0][11])}</p>
|
||||||
|
<span>实训ID:{(title[key][0][10])}</span>
|
||||||
<span>发布者:陈老师</span>
|
<span>发布者:陈老师</span>
|
||||||
<div>发布时间:{title[key][0][5]}</div>
|
<div>发布时间:{title[key][0][5]}</div>
|
||||||
<div>截至时间:{title[key][0][6]}</div>
|
<div>截至时间:{title[key][0][6]}</div>
|
||||||
|
|
|
@ -27,6 +27,10 @@ import SendTrain from '../TeacherPages/Trainmanage/SendTrain'
|
||||||
import TrainManage from '../TeacherPages/Trainmanage/Trainmanage'
|
import TrainManage from '../TeacherPages/Trainmanage/Trainmanage'
|
||||||
import StudentLink from '../TeacherPages/MarkingPages/StudentLink';
|
import StudentLink from '../TeacherPages/MarkingPages/StudentLink';
|
||||||
import Test from '../TeacherPages/TestManage/Test.tsx'
|
import Test from '../TeacherPages/TestManage/Test.tsx'
|
||||||
|
|
||||||
|
|
||||||
|
import SendTrain from '../TeacherPages/Trainmanage/SendTrain';
|
||||||
|
import TrainManage from '../TeacherPages/Trainmanage/Trainmanage';
|
||||||
// 定义一个组件来包裹除了特定页面(exam)外的所有页面使其有导航
|
// 定义一个组件来包裹除了特定页面(exam)外的所有页面使其有导航
|
||||||
const MainLayout = ({ headerNav:HeaderNav }) => {
|
const MainLayout = ({ headerNav:HeaderNav }) => {
|
||||||
return (
|
return (
|
||||||
|
@ -61,7 +65,7 @@ function App() {
|
||||||
<Route path='mark' element={<Marking/>}/> {/* 批改 */}
|
<Route path='mark' element={<Marking/>}/> {/* 批改 */}
|
||||||
<Route path='managetest' element={<ManageTest />}/> {/* 考试管理 */}
|
<Route path='managetest' element={<ManageTest />}/> {/* 考试管理 */}
|
||||||
<Route path="classID/:key" element={<ClassID />} /> {/* 班级管理1 */}
|
<Route path="classID/:key" element={<ClassID />} /> {/* 班级管理1 */}
|
||||||
<Route path='mark/studentlink' element={<StudentLink/>}/> {/* 批改1 */}
|
<Route path='mark/studentlink/Mark/:key' element={<StudentLink/>}/> {/* 批改1 */}
|
||||||
{/* 其他需要HeaderNavTeacher的页面 */}
|
{/* 其他需要HeaderNavTeacher的页面 */}
|
||||||
</Route>
|
</Route>
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ module.exports = function(app) {
|
||||||
app.use(
|
app.use(
|
||||||
'/api', // 如果请求路径匹配'/api',则进行代理
|
'/api', // 如果请求路径匹配'/api',则进行代理
|
||||||
createProxyMiddleware({
|
createProxyMiddleware({
|
||||||
target: 'http://36.138.114.105:32087', // 目标后端服务地址
|
target: 'http://127.0.0.1:5000', // 目标后端服务地址
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
@ -197,6 +197,12 @@ def select_class(): # 查找每个老师管理的班级 以及在考试管理
|
||||||
# print(testID)
|
# print(testID)
|
||||||
return jsonify({'Class': class_dic,'default': find_default_class_func(default_class, teacher_id)})
|
return jsonify({'Class': class_dic,'default': find_default_class_func(default_class, teacher_id)})
|
||||||
|
|
||||||
|
@app.route('/api/teacher/marktrain',methods=['POST'])
|
||||||
|
def mark(): # 批阅试卷
|
||||||
|
ClassID=request.json['ClassID']
|
||||||
|
teacher_ID=request.json['teacher_ID']
|
||||||
|
return jsonify({'MarkClass': MarkTrainFunc(ClassID,teacher_ID)})
|
||||||
|
|
||||||
@app.route('/api/teacher/change_class', methods=['POST'])
|
@app.route('/api/teacher/change_class', methods=['POST'])
|
||||||
def change_class(): # 查找每个老师管理的班级 以及在考试管理查找默认班级
|
def change_class(): # 查找每个老师管理的班级 以及在考试管理查找默认班级
|
||||||
teacher_id = request.json['teacher_ID']
|
teacher_id = request.json['teacher_ID']
|
||||||
|
@ -343,5 +349,6 @@ def handle_disconnect():
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
socketio.run(app, host='0.0.0.0', port=5000, debug=True)
|
socketio.run(app, host='0.0.0.0', port=5000 ,allow_unsafe_werkzeug=True, debug=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -252,12 +252,22 @@ def FetchTrainTitleFunc(ID):
|
||||||
titles.append(i[2])
|
titles.append(i[2])
|
||||||
|
|
||||||
for i in titles:
|
for i in titles:
|
||||||
cursor.execute('SELECT * FROM TRAINTEST WHERE ID=? ',(i))
|
cursor.execute('SELECT * FROM TRAINTEST WHERE ID=? AND STOPTIME>? ',(i,Time))
|
||||||
title.append(cursor.fetchall())
|
result=cursor.fetchall()
|
||||||
|
title.append(result)
|
||||||
|
if result:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
cursor.execute("UPDATE TRAINSCORE SET TF='true' , RESULT='0' , TRAINRESULT='0' WHERE TEST_ID=? AND STUDENT_ID=?",(i,ID))
|
||||||
|
|
||||||
|
|
||||||
|
title = [item for item in title if item]
|
||||||
|
print(title)
|
||||||
|
db.commit()
|
||||||
cursor.close()
|
cursor.close()
|
||||||
return title
|
return title
|
||||||
|
|
||||||
|
# FetchTrainTitleFunc("20240101")
|
||||||
|
|
||||||
|
|
||||||
def FetchTrainTestFunc(operateID):
|
def FetchTrainTestFunc(operateID):
|
||||||
|
|
|
@ -7,6 +7,8 @@ import datetime
|
||||||
|
|
||||||
db = dmPython.connect(user='SYSDBA', password='dameng!!', host="36.138.114.105", port="32522")
|
db = dmPython.connect(user='SYSDBA', password='dameng!!', host="36.138.114.105", port="32522")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#获取题目
|
#获取题目
|
||||||
def choice_question_func(ID):
|
def choice_question_func(ID):
|
||||||
question_cursor = db.cursor()
|
question_cursor = db.cursor()
|
||||||
|
@ -218,24 +220,26 @@ def train_question():
|
||||||
# print(Train)
|
# print(Train)
|
||||||
return Train
|
return Train
|
||||||
|
|
||||||
|
|
||||||
|
testID=None
|
||||||
|
TrainName=""
|
||||||
# train_question()
|
# train_question()
|
||||||
def SendTrainTestFunc(TrainChoice,TrainCompletion,TrainJudge,Hour,Min,StopTime,Class,Train,teacher_id):
|
def SendTrainTestFunc(TrainChoice,TrainCompletion,TrainJudge,Hour,Min,Class,Train,teacher_id,startTime,endTime):
|
||||||
TrainChoice = json.dumps(TrainChoice)
|
TrainChoice = json.dumps(TrainChoice)
|
||||||
TrainCompletion = json.dumps(TrainCompletion)
|
TrainCompletion = json.dumps(TrainCompletion)
|
||||||
TrainJudge = json.dumps(TrainJudge)
|
TrainJudge = json.dumps(TrainJudge)
|
||||||
Class=json.dumps(Class)
|
Class=json.dumps(Class)
|
||||||
Train=json.dumps(Train)
|
Train=json.dumps(Train)
|
||||||
# 获取当前时间
|
global TrainName
|
||||||
now_time = datetime.datetime.now().replace(microsecond=0)
|
TrainName=Train
|
||||||
end_time = now_time + datetime.timedelta(days=int(StopTime))
|
|
||||||
end_time = end_time.replace(microsecond=0)
|
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
cursor.execute(f'INSERT INTO TRAINTEST (CHOICE,COMPLE,JUDGE,HOUR,MIN,RELEASETIME,STOPTIME,CLASS,SUBJECT,TEACHER_ID,Train) VALUES'
|
cursor.execute(f'INSERT INTO TRAINTEST (CHOICE,COMPLE,JUDGE,HOUR,MIN,RELEASETIME,STOPTIME,CLASS,SUBJECT,TEACHER_ID,Train) VALUES'
|
||||||
f'(?,?,?,?,?,?,?,?,?,?,?)',(TrainChoice,TrainCompletion,TrainJudge,Hour,Min,now_time,end_time,Class,'Train',teacher_id,Train))
|
f'(?,?,?,?,?,?,?,?,?,?,?)',(TrainChoice,TrainCompletion,TrainJudge,Hour,Min,startTime,endTime,Class,'Train',teacher_id,Train))
|
||||||
|
|
||||||
db.commit()
|
db.commit()
|
||||||
print('添加成功')
|
print('添加成功')
|
||||||
cursor.execute(f'SELECT ID FROM TRAINTEST WHERE RELEASETIME=?', (now_time,))
|
cursor.execute(f'SELECT ID FROM TRAINTEST WHERE RELEASETIME=?', (startTime,))
|
||||||
test_id = cursor.fetchall()[0][0]
|
test_id = cursor.fetchall()[0][0]
|
||||||
# 查找学生
|
# 查找学生
|
||||||
student_list = []
|
student_list = []
|
||||||
|
@ -258,13 +262,27 @@ def SendTrainTestFunc(TrainChoice,TrainCompletion,TrainJudge,Hour,Min,StopTime,C
|
||||||
(i, i[0:6], test_id, end,one))
|
(i, i[0:6], test_id, end,one))
|
||||||
|
|
||||||
# 发布实训的时候根据实训不同给予不同链接
|
# 发布实训的时候根据实训不同给予不同链接
|
||||||
|
cursor.execute(f"SELECT ID FROM TRAINTEST WHERE RELEASETIME=? ", (now_time))
|
||||||
|
test_id = cursor.fetchall()[0][0]
|
||||||
|
global testID
|
||||||
|
testID=test_id
|
||||||
print('分配成功')
|
print('分配成功')
|
||||||
db.commit()
|
db.commit()
|
||||||
cursor.close()
|
cursor.close()
|
||||||
return '发布成功'
|
return '发布成功'
|
||||||
|
|
||||||
|
|
||||||
|
def TeacherMark(CLASS,ID):
|
||||||
|
global testID
|
||||||
|
global TrainName
|
||||||
|
cursor = db.cursor()
|
||||||
|
strClass=str(CLASS)
|
||||||
|
if TrainName.find(r'["\u524d\u7aef\u4e0e\u6570\u636e\u5e93\u7ed3\u5408"]') != -1:
|
||||||
|
for i in eval(strClass):
|
||||||
|
cursor.execute(f'INSERT INTO TEACHERMARK VALUES(?,?,?,?) ', (ID,testID,'false', i))
|
||||||
|
db.commit()
|
||||||
|
cursor.close()
|
||||||
|
|
||||||
# def Find_dic(dic):
|
# def Find_dic(dic):
|
||||||
# # 获取字典的键,并按照从大到小的顺序排序
|
# # 获取字典的键,并按照从大到小的顺序排序
|
||||||
# keys_sorted = sorted(dic.keys(), reverse=True)
|
# keys_sorted = sorted(dic.keys(), reverse=True)
|
||||||
|
@ -291,3 +309,30 @@ def Find_details_Func(ID):
|
||||||
return dic
|
return dic
|
||||||
|
|
||||||
# print(Find_details('20240101'))
|
# print(Find_details('20240101'))
|
||||||
|
|
||||||
|
|
||||||
|
#获取未批改的卷子
|
||||||
|
def MarkTrainFunc(ClassID,teacher_ID):
|
||||||
|
dic={}
|
||||||
|
cursor = db.cursor()
|
||||||
|
cursor.execute(f"SELECT * FROM TEACHERMARK WHERE CLASS=? AND TEACHERID=? AND TF='false'", (ClassID,teacher_ID))
|
||||||
|
for i in cursor.fetchall():
|
||||||
|
cursor.execute(f"SELECT * FROM TRAINTEST WHERE ID=? ", (i[1],))
|
||||||
|
dic[i[1]]=cursor.fetchall()
|
||||||
|
# print(dic)
|
||||||
|
return dic
|
||||||
|
|
||||||
|
# MarkTrainFunc('202401','111111')
|
||||||
|
|
||||||
|
def NotMarkTest(testID):
|
||||||
|
cursor = db.cursor()
|
||||||
|
dic={}
|
||||||
|
cursor.execute(f'SELECT * FROM TRAINSCORE WHERE TEST_ID=?',(testID))
|
||||||
|
for i in cursor.fetchall():
|
||||||
|
cursor.execute(f'SELECT NAME FROM STUDENT WHERE ID=?',(i[0]))
|
||||||
|
dic[cursor.fetchall()[0][0]]=i
|
||||||
|
|
||||||
|
return dic
|
||||||
|
|
||||||
|
NotMarkTest('9')
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
TrainName='["\u524d\u7aef\u4e0e\u6570\u636e\u5e93\u7ed3\u5408"]'
|
||||||
|
print(TrainName)
|
||||||
|
print(type(TrainName))
|
||||||
|
if TrainName == '["\u524d\u7aef\u4e0e\u6570\u636e\u5e93\u7ed3\u5408"]':
|
||||||
|
print('yes')
|
Loading…
Reference in New Issue