fix: KeyError when user do not have todo

This commit is contained in:
raiots 2022-04-25 18:56:13 +08:00
parent fc4bbc748c
commit b87ea4c9bd
1 changed files with 5 additions and 1 deletions

View File

@ -127,7 +127,11 @@ class IndexView(View):
# 若total_credit为空不进行以下操作避免err
if total_credit:
current_user = total_credit[request.user.username]
# 暂时解决当该用户当月无任务时total_credit中不包含该用户的用户名导致Key Error
try:
current_user = total_credit[request.user.username]
except:
current_user = {}
# 累加该部门各个用户的工作量,计算部门工作量
department_cal = {}