Merge branch 'master' of https://e.coding.net/ctcdevteam/cma_search
This commit is contained in:
commit
c1a03d3fc1
|
@ -88,6 +88,7 @@ class ExamListSerializer(ModelSerializer):
|
||||||
course_ = CourseSerializer(source='course_name', read_only=True)
|
course_ = CourseSerializer(source='course_name', read_only=True)
|
||||||
user_count = serializers.SerializerMethodField()
|
user_count = serializers.SerializerMethodField()
|
||||||
submit_count = serializers.SerializerMethodField()
|
submit_count = serializers.SerializerMethodField()
|
||||||
|
limit = CharField(source='paper.limit', read_only=True)
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Exam
|
model = Exam
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
|
@ -20,6 +20,7 @@ from apps.exam.filters import ExamRecordFilter, ExamFilter
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from apps.system.mixins import CreateUpdateCustomMixin
|
from apps.system.mixins import CreateUpdateCustomMixin
|
||||||
from apps.edu.serializers import CertificateSerializer
|
from apps.edu.serializers import CertificateSerializer
|
||||||
|
from apps.edu.models import Certificate
|
||||||
from utils.queryset import get_child_queryset2
|
from utils.queryset import get_child_queryset2
|
||||||
from apps.system.permission import has_permission
|
from apps.system.permission import has_permission
|
||||||
from apps.exam.parse_word import interpret_text
|
from apps.exam.parse_word import interpret_text
|
||||||
|
@ -485,7 +486,8 @@ class ExamViewSet(CreateUpdateCustomMixin, ModelViewSet):
|
||||||
|
|
||||||
开始考试具体题目信息
|
开始考试具体题目信息
|
||||||
"""
|
"""
|
||||||
exam = self.get_object()
|
# exam = self.get_object()
|
||||||
|
exam = Exam.objects.get(id=kwargs['pk'])
|
||||||
# 查询本次考试对应哪些人
|
# 查询本次考试对应哪些人
|
||||||
participants = exam.participant_user.all()
|
participants = exam.participant_user.all()
|
||||||
participants_ids = [i.id for i in participants]
|
participants_ids = [i.id for i in participants]
|
||||||
|
@ -641,10 +643,15 @@ class ExamRecordViewSet(ListModelMixin, DestroyModelMixin, RetrieveModelMixin, G
|
||||||
courese_ids = [i.id for i in course]
|
courese_ids = [i.id for i in course]
|
||||||
current_date = now_data.strftime('%Y-%m-%d')
|
current_date = now_data.strftime('%Y-%m-%d')
|
||||||
cer_number = now_data.strftime('%Y%m%d')
|
cer_number = now_data.strftime('%Y%m%d')
|
||||||
|
# 查询证明编号创建时间为最后一个
|
||||||
|
cer = Certificate.objects.latest('证书编号')
|
||||||
|
if cer:
|
||||||
|
cer_number = int(cer.证书编号[4:]) + 1
|
||||||
|
cer_number = 'CTCZL' + str(cer_number)
|
||||||
data_dict = {
|
data_dict = {
|
||||||
'姓名': request.user.name,
|
'姓名': request.user.name,
|
||||||
'用户ID': request.user.id,
|
'用户ID': request.user.id,
|
||||||
'证书编号': 'CTCZL'+ cer_number,
|
'证书编号': cer_number,
|
||||||
'证书方案': '202312',
|
'证书方案': '202312',
|
||||||
'单位名称': request.user.dept.name,
|
'单位名称': request.user.dept.name,
|
||||||
'所属单位': '国检测试控股集团'+request.user.dept.name,
|
'所属单位': '国检测试控股集团'+request.user.dept.name,
|
||||||
|
|
|
@ -100,8 +100,6 @@ class ImpMixin:
|
||||||
if 'file' not in request.data:
|
if 'file' not in request.data:
|
||||||
raise ParseError('请提供文件')
|
raise ParseError('请提供文件')
|
||||||
path = request.data['file']
|
path = request.data['file']
|
||||||
print(path, "---------ssss")
|
|
||||||
|
|
||||||
if not str(path).endswith('.xlsx'):
|
if not str(path).endswith('.xlsx'):
|
||||||
raise ParseError('请提供xlsx格式文件')
|
raise ParseError('请提供xlsx格式文件')
|
||||||
fullpath = settings.BASE_DIR + str(path)
|
fullpath = settings.BASE_DIR + str(path)
|
||||||
|
@ -348,7 +346,7 @@ class UserExamViewset(ImpMixin, ModelViewSet):
|
||||||
if not exam_role:
|
if not exam_role:
|
||||||
return Response({'msg': '考试角色不存在'})
|
return Response({'msg': '考试角色不存在'})
|
||||||
for row in sheet.iter_rows(min_row=start, values_only=True): # 假设第一行是表头,从第二行开始读取数据
|
for row in sheet.iter_rows(min_row=start, values_only=True): # 假设第一行是表头,从第二行开始读取数据
|
||||||
if row[0] is not None:
|
if row[1] is not None:
|
||||||
dept = Organization.objects.get(name=row[3])
|
dept = Organization.objects.get(name=row[3])
|
||||||
user_depts = get_child_queryset2(request.user.dept).order_by('sort')
|
user_depts = get_child_queryset2(request.user.dept).order_by('sort')
|
||||||
serializer = OrganizationSerializer(user_depts, many=True)
|
serializer = OrganizationSerializer(user_depts, many=True)
|
||||||
|
|
Loading…
Reference in New Issue