考试查询以及定时任务关闭考试
This commit is contained in:
parent
5a63e0b4d4
commit
2237c47800
|
@ -793,9 +793,9 @@ class TrainPlan(models.Model):
|
|||
purpose = models.TextField('培训目的')
|
||||
year = models.IntegerField('年份', default=2021)
|
||||
month = models.IntegerField('月份', default=1)
|
||||
manager = models.ForeignKey(User, verbose_name="负责人")
|
||||
manager = models.ForeignKey(User, verbose_name="负责人", on_delete=models.SET_NULL, null=True, blank=True)
|
||||
period = models.IntegerField('预计学时', default=0)
|
||||
group = models.ForeignKey(Group,)
|
||||
group = models.ForeignKey(Group, verbose_name='组', on_delete=models.SET_NULL, null=True, blank=True)
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.year)+'年'+str(self.month)+'月计划'
|
||||
|
|
|
@ -326,6 +326,11 @@ def sendGridtask2(**kwargs):
|
|||
def expireRiskacttask():
|
||||
RiskActTask.objects.filter(taskexpire__lte = datetime.datetime.now(), usable=1).update(usable=0)
|
||||
|
||||
@shared_task
|
||||
def closeExamtest():
|
||||
# 自动关闭到期的考试
|
||||
ExamTest.objects.filter(state=1, endtime__lt = datetime.datetime.now()).update(state=0)
|
||||
|
||||
@shared_task
|
||||
def checktask():
|
||||
nowtime = datetime.datetime.now()
|
||||
|
|
|
@ -1,5 +1,23 @@
|
|||
<table id="kstable" style="width:auto;height:100%;"></table>
|
||||
<div id="kstablebar" style="padding:4px;height:auto">
|
||||
<div>
|
||||
<form id='searchksff'>
|
||||
<label>考试状态</label>
|
||||
<select name='state' style='width:150px' class="easyui-combobox">
|
||||
<option value="">请选择</option>
|
||||
<option value="open">进行中</option>
|
||||
<option value="close">已关闭</option>
|
||||
</select>
|
||||
<label>开始时间</label>
|
||||
<a class="easyui-datebox" name="starttime1"></a>
|
||||
<label>-</label>
|
||||
<a class="easyui-datebox" name="starttime2"></a>
|
||||
<a class="easyui-textbox" name="search" data-options="prompt:'考试名或试卷名'"></a>
|
||||
|
||||
<a onclick="kssearch()" class="easyui-linkbutton">查询</a>
|
||||
<a onclick="ksreset()" class="easyui-linkbutton">重置</a>
|
||||
</form>
|
||||
</div>
|
||||
<div>
|
||||
{% load myfilter %}
|
||||
{% if request|has_permission:'b_examtest_add1' %}
|
||||
|
@ -27,6 +45,19 @@
|
|||
function addks(obj){
|
||||
opendg('发布考试','html/examtest/add')
|
||||
}
|
||||
function kssearch() {
|
||||
var querydata = $('#searchksff').serializeJSON();
|
||||
querydata['a'] = 'listall'
|
||||
$('#kstable').datagrid('load', querydata);
|
||||
}
|
||||
function ksreset() {
|
||||
$('#searchksff').form('clear')
|
||||
$('#kstable').datagrid('options').queryParams = {
|
||||
a:'listall'
|
||||
}
|
||||
$('#kstable').datagrid('load');
|
||||
|
||||
}
|
||||
function addks2(obj){
|
||||
opendg('发布考试','html/examtest/add2')
|
||||
}
|
||||
|
|
|
@ -6115,6 +6115,15 @@ def apiexamtest(req):
|
|||
',').exclude(nousecomps__contains=','+companyid+',')
|
||||
state = req.GET.get('state',None)
|
||||
owner = req.GET.get('owner',None)
|
||||
search = req.GET.get('search', None)
|
||||
starttime1 = req.GET.get('starttime1', None)
|
||||
starttime2 = req.GET.get('starttime2', None)
|
||||
if search:
|
||||
a = a.filter(Q(name__contains=search)|Q(exampaper__name=search))
|
||||
if starttime1:
|
||||
a = a.filter(starttime__gte=starttime1)
|
||||
if starttime2:
|
||||
a = a.filter(starttime__lte=starttime2)
|
||||
if state == 'open':
|
||||
a = a.filter(state=1)
|
||||
if state == 'close':
|
||||
|
|
Loading…
Reference in New Issue