add total time
This commit is contained in:
parent
98f62d0aa9
commit
dbc6d0363d
13
main.py
13
main.py
@ -20,6 +20,7 @@ waka_key = os.getenv('INPUT_WAKATIME_API_KEY')
|
|||||||
api_base_url = os.getenv('INPUT_API_BASE_URL')
|
api_base_url = os.getenv('INPUT_API_BASE_URL')
|
||||||
ghtoken = os.getenv('INPUT_GH_TOKEN')
|
ghtoken = os.getenv('INPUT_GH_TOKEN')
|
||||||
show_title = os.getenv("INPUT_SHOW_TITLE")
|
show_title = os.getenv("INPUT_SHOW_TITLE")
|
||||||
|
show_total = os.getenv("INPUT_SHOW_TOTAL")
|
||||||
commit_message = os.getenv("INPUT_COMMIT_MESSAGE")
|
commit_message = os.getenv("INPUT_COMMIT_MESSAGE")
|
||||||
blocks = os.getenv("INPUT_BLOCKS")
|
blocks = os.getenv("INPUT_BLOCKS")
|
||||||
|
|
||||||
@ -55,6 +56,7 @@ def get_stats() -> str:
|
|||||||
}).json()
|
}).json()
|
||||||
try:
|
try:
|
||||||
lang_data = data['data']['languages']
|
lang_data = data['data']['languages']
|
||||||
|
total_data = data['data']['human_readable_total']
|
||||||
except KeyError:
|
except KeyError:
|
||||||
print("Please Add your WakaTime API Key to the Repository Secrets")
|
print("Please Add your WakaTime API Key to the Repository Secrets")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -76,12 +78,15 @@ def get_stats() -> str:
|
|||||||
f"{lang['name']}{' '*(pad + 3 - lth)}{lang['text']}{' '*(16 - ln_text)}{make_graph(lang['percent'], blocks)} {fmt_percent} % ")
|
f"{lang['name']}{' '*(pad + 3 - lth)}{lang['text']}{' '*(16 - ln_text)}{make_graph(lang['percent'], blocks)} {fmt_percent} % ")
|
||||||
print("Graph Generated")
|
print("Graph Generated")
|
||||||
data = '\n'.join(data_list)
|
data = '\n'.join(data_list)
|
||||||
|
|
||||||
|
return_text = '```text\n'
|
||||||
if show_title == 'true':
|
if show_title == 'true':
|
||||||
print("Stats with Weeks in Title Generated")
|
print("Stats with Weeks in Title Generated")
|
||||||
return '```text\n'+this_week()+'\n\n'+data+'\n```'
|
return_text += this_week()+'\n\n'
|
||||||
else:
|
if show_total == 'true':
|
||||||
print("Usual Stats Generated")
|
print("add Total time")
|
||||||
return '```text\n'+data+'\n```'
|
return_text += 'Total: ' + total_data+'\n\n'
|
||||||
|
return return_text + data+'\n```'
|
||||||
|
|
||||||
|
|
||||||
def decode_readme(data: str) -> str:
|
def decode_readme(data: str) -> str:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user