|
|
@ -36,17 +36,11 @@ func (s *sClient) ClientGetHomeworkList(ctx context.Context, jwcode int) (homewo |
|
|
|
if err != nil { |
|
|
|
return |
|
|
|
} |
|
|
|
//计算提交次数
|
|
|
|
for i, item := range homeworkList { |
|
|
|
var count int |
|
|
|
count, err = dao.ActivityInteractiveRecord.Ctx(ctx).Where("group_id=?", item.Id).Where("jwcode", jwcode).Count() //只有精网号和作业id查出来的结果是所需要的结果的题目数倍数
|
|
|
|
if err != nil { |
|
|
|
return |
|
|
|
} |
|
|
|
num, err1 := dao.ActivityInteractiveForm.Ctx(ctx).Where("group_id", item.Id).Count() |
|
|
|
if err1 != nil { |
|
|
|
return |
|
|
|
} |
|
|
|
homeworkList[i].Submit = count / num |
|
|
|
result, _ := dao.ActivityInteractiveRecord.Ctx(ctx).Where("group_id", item.Id).Where("jwcode", jwcode). |
|
|
|
Group("form_id").Limit(1).Value("COUNT(*)") |
|
|
|
homeworkList[i].Submit = result.Int() |
|
|
|
} |
|
|
|
|
|
|
|
// 将查询结果JSON化并存入Redis
|
|
|
|