Skip to content

Commit

Permalink
Merge pull request #749 from vigneshhari/master
Browse files Browse the repository at this point in the history
Fix Dmo issue
  • Loading branch information
vigneshhari authored Aug 20, 2018
2 parents ddd690e + a5ee7fa commit 62c0817
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions mainapp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,10 @@ def dmocsv(request):

return response

def ifnonezero(val):
if(val == None):return 0
return val

def dmoinfo(request):
if("district" not in request.GET.keys()):return HttpResponseRedirect("/")
dist = request.GET.get("district")
Expand All @@ -328,10 +332,10 @@ def dmoinfo(request):

for i in camps:

total_people += i.total_people
total_male += i.total_males
total_female += i.total_females
total_infant += i.total_infants
total_people += ifnonezero(i.total_people)
total_male += ifnonezero(i.total_males)
total_female += ifnonezero(i.total_females)
total_infant += ifnonezero(i.total_infants)
if(i.medical_req.strip() != ""):total_medical+=1

return render(request ,"dmoinfo.html",{"district" : dist , "reqserve" : reqserve , "reqtotal" : reqtotal , "volcount" : volcount , "conserve" : conserve , "contotal" : contotal ,
Expand Down

0 comments on commit 62c0817

Please sign in to comment.