fix: 考试bundle错误提示区分未上架
This commit is contained in:
@@ -210,7 +210,10 @@ def build_exam_bundle(request, user):
|
|||||||
all_ids = list(qs.values_list('id', flat=True))
|
all_ids = list(qs.values_list('id', flat=True))
|
||||||
draw = min(int(cfg.draw_count or 10), len(all_ids))
|
draw = min(int(cfg.draw_count or 10), len(all_ids))
|
||||||
if draw < 1:
|
if draw < 1:
|
||||||
return None, '题库暂无可用题目,请联系管理员'
|
total = ClubDashouExamQuestion.query.filter(club_id=club_id).count()
|
||||||
|
if total > 0 and not all_ids:
|
||||||
|
return None, '题库有题目但未上架,请在后台打开题目的「上架」开关'
|
||||||
|
return None, '题库暂无已上架题目,请至少录入一道题并上架(每题至少两个选项且标记正确答案)'
|
||||||
|
|
||||||
selected_ids = random.sample(all_ids, draw)
|
selected_ids = random.sample(all_ids, draw)
|
||||||
questions = []
|
questions = []
|
||||||
|
|||||||
Reference in New Issue
Block a user