feature: Fix timezone
Some checks are pending
PUBLISH_IMAGE / Publish 'waka-readme-stats' image (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
CODESTYLE / Run codestyle check (push) Waiting to run

This commit is contained in:
2024-11-01 23:38:02 -05:00
parent 410fb20f86
commit 6bcd5f4b5a

View File

@@ -31,12 +31,14 @@ async def get_waka_time_stats(repositories: Dict, commit_dates: Dict) -> str:
stats = str() stats = str()
data = await DM.get_remote_json("waka_latest") data = await DM.get_remote_json("waka_latest")
time_zone = data["data"]["timezone"] if "timezone" in data["data"] else "America/New_York"
if data is None: if data is None:
DBM.p("WakaTime data unavailable!") DBM.p("WakaTime data unavailable!")
return stats return stats
if EM.SHOW_COMMIT or EM.SHOW_DAYS_OF_WEEK: # if any on flag is turned on then we need to calculate the data and print accordingly if EM.SHOW_COMMIT or EM.SHOW_DAYS_OF_WEEK: # if any on flag is turned on then we need to calculate the data and print accordingly
DBM.i("Adding user commit day time info...") DBM.i("Adding user commit day time info...")
stats += f"{await make_commit_day_time_list(data['data']['timezone'], repositories, commit_dates)}\n\n" stats += f"{await make_commit_day_time_list(time_zone, repositories, commit_dates)}\n\n"
if EM.SHOW_TIMEZONE or EM.SHOW_LANGUAGE or EM.SHOW_EDITORS or EM.SHOW_PROJECTS or EM.SHOW_OS: if EM.SHOW_TIMEZONE or EM.SHOW_LANGUAGE or EM.SHOW_EDITORS or EM.SHOW_PROJECTS or EM.SHOW_OS:
no_activity = FM.t("No Activity Tracked This Week") no_activity = FM.t("No Activity Tracked This Week")
@@ -44,7 +46,6 @@ async def get_waka_time_stats(repositories: Dict, commit_dates: Dict) -> str:
if EM.SHOW_TIMEZONE: if EM.SHOW_TIMEZONE:
DBM.i("Adding user timezone info...") DBM.i("Adding user timezone info...")
time_zone = data["data"]["timezone"]
stats += f"🕑︎ {FM.t('Timezone')}: {time_zone}\n\n" stats += f"🕑︎ {FM.t('Timezone')}: {time_zone}\n\n"
if EM.SHOW_LANGUAGE: if EM.SHOW_LANGUAGE: