mirror of https://gitlab.com/bashrc2/epicyon
Variable types
parent
693c93ac79
commit
82586554b3
|
|
@ -24,14 +24,14 @@ def insert_question(base_dir: str, translate: {},
|
||||||
return content
|
return content
|
||||||
if len(post_json_object['object']['oneOf']) == 0:
|
if len(post_json_object['object']['oneOf']) == 0:
|
||||||
return content
|
return content
|
||||||
message_id = remove_id_ending(post_json_object['id'])
|
message_id: str = remove_id_ending(post_json_object['id'])
|
||||||
if '#' in message_id:
|
if '#' in message_id:
|
||||||
message_id = message_id.split('#', 1)[0]
|
message_id = message_id.split('#', 1)[0]
|
||||||
page_number_str: str = ''
|
page_number_str: str = ''
|
||||||
if page_number:
|
if page_number:
|
||||||
page_number_str = '?page=' + str(page_number)
|
page_number_str = '?page=' + str(page_number)
|
||||||
|
|
||||||
votes_filename = \
|
votes_filename: str = \
|
||||||
acct_dir(base_dir, nickname, domain) + '/questions.txt'
|
acct_dir(base_dir, nickname, domain) + '/questions.txt'
|
||||||
|
|
||||||
show_question_results: bool = False
|
show_question_results: bool = False
|
||||||
|
|
@ -53,7 +53,9 @@ def insert_question(base_dir: str, translate: {},
|
||||||
continue
|
continue
|
||||||
if not choice.get('name'):
|
if not choice.get('name'):
|
||||||
continue
|
continue
|
||||||
quoted_name = urllib.parse.quote_plus(choice['name'])
|
if not isinstance(choice['name'], str):
|
||||||
|
continue
|
||||||
|
quoted_name: str = urllib.parse.quote_plus(choice['name'])
|
||||||
content += \
|
content += \
|
||||||
'<input type="radio" name="answer" value="' + \
|
'<input type="radio" name="answer" value="' + \
|
||||||
quoted_name + '" tabindex="10"> ' + \
|
quoted_name + '" tabindex="10"> ' + \
|
||||||
|
|
@ -85,6 +87,8 @@ def insert_question(base_dir: str, translate: {},
|
||||||
for question_option in post_json_object['object']['oneOf']:
|
for question_option in post_json_object['object']['oneOf']:
|
||||||
if not question_option.get('name'):
|
if not question_option.get('name'):
|
||||||
continue
|
continue
|
||||||
|
if not isinstance(question_option['name'], str):
|
||||||
|
continue
|
||||||
if not question_option.get('replies'):
|
if not question_option.get('replies'):
|
||||||
continue
|
continue
|
||||||
votes: int = 0
|
votes: int = 0
|
||||||
|
|
@ -92,7 +96,7 @@ def insert_question(base_dir: str, translate: {},
|
||||||
votes = int(question_option['replies']['totalItems'])
|
votes = int(question_option['replies']['totalItems'])
|
||||||
except BaseException:
|
except BaseException:
|
||||||
print('EX: insert_question unable to convert to int 2')
|
print('EX: insert_question unable to convert to int 2')
|
||||||
votes_percent = str(int(votes * 100 / max_votes))
|
votes_percent: str = str(int(votes * 100 / max_votes))
|
||||||
|
|
||||||
content += \
|
content += \
|
||||||
'<p>\n' + \
|
'<p>\n' + \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue