Check if projects/languages/OSes/editors are present in Wakatime response (#393)

This commit is contained in:
cherryblossom000
2021-06-17 21:56:01 +10:00
committed by GitHub
parent a77f699111
commit 408389fcc9
3 changed files with 13 additions and 5 deletions

View File

@@ -27,10 +27,10 @@ export default async function({login, q, imports, data, account}, {enabled = fal
total:stats.total_seconds / (60 * 60),
daily: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),
os:stats.operating_systems.map(({name, percent, total_seconds:total}) => ({name, percent:percent / 100, total})).sort((a, b) => b.percent - a.percent).slice(0, limit),
editors:stats.editors.map(({name, percent, total_seconds:total}) => ({name, percent:percent / 100, total})).sort((a, b) => b.percent - a.percent).slice(0, limit),
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),
os:stats.operating_systems?.map(({name, percent, total_seconds:total}) => ({name, percent:percent / 100, total})).sort((a, b) => b.percent - a.percent).slice(0, limit),
editors:stats.editors?.map(({name, percent, total_seconds:total}) => ({name, percent:percent / 100, total})).sort((a, b) => b.percent - a.percent).slice(0, limit),
}
//Result

View File

@@ -13,3 +13,11 @@
plugin_wakatime: yes
plugin_wakatime_limit: 4
plugin_wakatime_sections: time, projects, projects-graphs, languages, languages-graphs, editors, editors-graphs, os, os-graphs
- name: WakaTime plugin (projects hidden)
uses: lowlighter/metrics@latest
with:
token: NOT_NEEDED
plugin_wakatime_token: MOCKED_TOKEN_NO_PROJECTS
plugin_wakatime: yes
plugin_wakatime_sections: time, projects, languages