forked from indymedia/epicyon
question handle zero items option
parent
621763b996
commit
f5b9d5affc
|
@ -1893,9 +1893,11 @@ def insertQuestion(baseDir: str,translate: {}, \
|
||||||
continue
|
continue
|
||||||
if not questionOption.get('replies'):
|
if not questionOption.get('replies'):
|
||||||
continue
|
continue
|
||||||
if not questionOption['replies'].get('totalItems'):
|
votes=0
|
||||||
continue
|
try:
|
||||||
votes=int(questionOption['replies']['totalItems'])
|
votes=int(questionOption['replies']['totalItems'])
|
||||||
|
except:
|
||||||
|
pass
|
||||||
if votes>maxVotes:
|
if votes>maxVotes:
|
||||||
maxVotes=int(votes+1)
|
maxVotes=int(votes+1)
|
||||||
|
|
||||||
|
@ -1906,9 +1908,11 @@ def insertQuestion(baseDir: str,translate: {}, \
|
||||||
continue
|
continue
|
||||||
if not questionOption.get('replies'):
|
if not questionOption.get('replies'):
|
||||||
continue
|
continue
|
||||||
if not questionOption['replies'].get('totalItems'):
|
votes=0
|
||||||
continue
|
try:
|
||||||
votes=int(questionOption['replies']['totalItems'])
|
votes=int(questionOption['replies']['totalItems'])
|
||||||
|
except:
|
||||||
|
pass
|
||||||
votesPercent=str(int(votes*100/maxVotes))
|
votesPercent=str(int(votes*100/maxVotes))
|
||||||
content+='<p><input type="text" title="'+str(votes)+'" name="skillName'+str(questionCtr)+'" value="'+questionOption['name']+' ('+str(votes)+')" style="width:40%">'
|
content+='<p><input type="text" title="'+str(votes)+'" name="skillName'+str(questionCtr)+'" value="'+questionOption['name']+' ('+str(votes)+')" style="width:40%">'
|
||||||
content+='<input type="range" min="1" max="100" class="slider" title="'+str(votes)+'" name="skillValue'+str(questionCtr)+'" value="'+votesPercent+'"></p>'
|
content+='<input type="range" min="1" max="100" class="slider" title="'+str(votes)+'" name="skillValue'+str(questionCtr)+'" value="'+votesPercent+'"></p>'
|
||||||
|
|
Loading…
Reference in New Issue