feat: 数据统计列表增加答题耗时、提交时间 (#19)

This commit is contained in:
leohou 2023-12-06 16:29:08 +08:00 committed by GitHub
parent 2d5a300ed9
commit a891ad3351
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -127,7 +127,7 @@ class SurveyService {
}
getListHeadByDataList(dataList) {
return dataList.map(surveyItem => {
const listHead = dataList.map(surveyItem => {
let othersCode;
if(surveyItem.type === 'radio-star') {
const rangeConfigKeys = Object.keys(surveyItem.rangeConfig)
@ -151,6 +151,17 @@ class SurveyService {
othersCode
}
})
listHead.push({
field: 'difTime',
title: '答题耗时(秒)',
type: 'text',
})
listHead.push({
field: 'createDate',
title: '提交时间',
type: 'text',
})
return listHead
}
async data(condition: { userData:UserType,surveyId: string, pageNum: number, pageSize: number, isShowSecret: boolean }) {
@ -203,7 +214,11 @@ class SurveyService {
data[itemKey] = getText(data[itemKey])
}
}
return data
return {
...data,
difTime: (surveySubmitResList.difTime / 1000).toFixed(2),
createDate: moment(surveySubmitResList.createDate).format("YYYY-MM-DD HH:mm:ss")
}
})
const total = await surveySubmit.countDocuments({ pageId: condition.surveyId });
return {