From 8ad9b3d9e9840630f42341e11ece8015b574eaf8 Mon Sep 17 00:00:00 2001 From: Baoshuo Ren Date: Thu, 10 Mar 2022 22:24:28 +0800 Subject: [PATCH] feat(plugins/wakatime): add an option to include other languages (#928) --- source/plugins/wakatime/README.md | 11 +++++++++++ source/plugins/wakatime/index.mjs | 6 +++--- source/plugins/wakatime/metadata.yml | 7 ++++++- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/source/plugins/wakatime/README.md b/source/plugins/wakatime/README.md index 56b1f902..b52d9e0d 100644 --- a/source/plugins/wakatime/README.md +++ b/source/plugins/wakatime/README.md @@ -117,6 +117,17 @@
default: current
+ +

plugin_wakatime_others

+

Including Other Languages

+ + + + ✨ On master/main
+type: boolean +
+default: no
+ diff --git a/source/plugins/wakatime/index.mjs b/source/plugins/wakatime/index.mjs index 245c5d59..f49e0949 100644 --- a/source/plugins/wakatime/index.mjs +++ b/source/plugins/wakatime/index.mjs @@ -7,7 +7,7 @@ export default async function({login, q, imports, data, account}, {enabled = fal return null //Load inputs - let {sections, days, limit, url, user} = imports.metadata.plugins.wakatime.inputs({data, account, q}) + let {sections, days, limit, url, user, "languages.other":others} = imports.metadata.plugins.wakatime.inputs({data, account, q}) if (!limit) limit = void limit const range = { @@ -24,8 +24,8 @@ export default async function({login, q, imports, data, account}, {enabled = fal sections, days, time:{ - total:stats.total_seconds / (60 * 60), - daily:stats.daily_average / (60 * 60), + total:(others ? stats.total_seconds_including_other_language : stats.total_seconds) / (60 * 60), + daily:(others ? stats.daily_average_including_other_language : stats.daily_average) / (60 * 60), }, projects:stats.projects?.map(({name, percent, total_seconds:total}) => ({name, percent:percent / 100, total})).sort((a, b) => b.percent - a.percent).slice(0, limit), languages:stats.languages?.map(({name, percent, total_seconds:total}) => ({name, percent:percent / 100, total})).sort((a, b) => b.percent - a.percent).slice(0, limit), diff --git a/source/plugins/wakatime/metadata.yml b/source/plugins/wakatime/metadata.yml index 9d5de136..e88d7b89 100644 --- a/source/plugins/wakatime/metadata.yml +++ b/source/plugins/wakatime/metadata.yml @@ -73,4 +73,9 @@ inputs: description: WakaTime username type: string default: current - preset: no \ No newline at end of file + preset: no + + plugin_wakatime_languages_other: + description: Including Other Languages + type: boolean + default: no