fix devision by zero
This commit is contained in:
parent
0f81fe9c0f
commit
491f6aba08
2 changed files with 6 additions and 3 deletions
|
@ -176,7 +176,7 @@ def getMessagesByGroup(token, groupId):
|
||||||
msgDic['forSortDate'] = msgTime
|
msgDic['forSortDate'] = msgTime
|
||||||
arr.append(msgDic)
|
arr.append(msgDic)
|
||||||
print arr
|
print arr
|
||||||
arr = sorted(arr, key=itemgetter('forSortDate'), reverse=False)
|
arr = sorted(arr, key=itemgetter('forSortDate'), reverse=True)
|
||||||
for i in arr:
|
for i in arr:
|
||||||
del i['forSortDate']
|
del i['forSortDate']
|
||||||
print arr
|
print arr
|
||||||
|
@ -270,7 +270,7 @@ def getAllUserMessages(token):
|
||||||
msgDic['forSortDate'] = msgTime
|
msgDic['forSortDate'] = msgTime
|
||||||
arr.append(msgDic)
|
arr.append(msgDic)
|
||||||
|
|
||||||
arr = sorted(arr, key=itemgetter('forSortDate'), reverse=False)
|
arr = sorted(arr, key=itemgetter('forSortDate'), reverse=True)
|
||||||
for i in arr:
|
for i in arr:
|
||||||
del i['forSortDate']
|
del i['forSortDate']
|
||||||
print arr
|
print arr
|
||||||
|
|
|
@ -726,7 +726,10 @@ def getAllUserTasks(token):
|
||||||
|
|
||||||
basicTC = TaskComponent.all().filter("taskId = ", t.key().id()).filter("userId = ", -1).count()
|
basicTC = TaskComponent.all().filter("taskId = ", t.key().id()).filter("userId = ", -1).count()
|
||||||
allTC = TaskComponent.all().filter("taskId = ", t.key().id()).count()
|
allTC = TaskComponent.all().filter("taskId = ", t.key().id()).count()
|
||||||
done = (allTC/basicTC) - 1
|
if basicTC != 0:
|
||||||
|
done = (allTC/basicTC) - 1
|
||||||
|
else:
|
||||||
|
done = 0
|
||||||
taskDic['submitted']['done'] = done
|
taskDic['submitted']['done'] = done
|
||||||
|
|
||||||
taskArr.append(taskDic)
|
taskArr.append(taskDic)
|
||||||
|
|
Loading…
Reference in a new issue