feat(plugins/wakatime): add an option to include other languages (#928)

This commit is contained in:
Baoshuo Ren
2022-03-10 22:24:28 +08:00
committed by GitHub
parent 52953d380a
commit 8ad9b3d9e9
3 changed files with 20 additions and 4 deletions

View File

@@ -117,6 +117,17 @@
<br>
<b>default:</b> current<br></td>
</tr>
<tr>
<td nowrap="nowrap"><h4><code>plugin_wakatime_others</code></h4></td>
<td rowspan="2"><p>Including Other Languages</p>
<img width="900" height="1" alt=""></td>
</tr>
<tr>
<td nowrap="nowrap">✨ On <code>master</code>/<code>main</code><br>
<b>type:</b> <code>boolean</code>
<br>
<b>default:</b> no<br></td>
</tr>
</table>
<!--/options-->

View File

@@ -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),

View File

@@ -74,3 +74,8 @@ inputs:
type: string
default: current
preset: no
plugin_wakatime_languages_other:
description: Including Other Languages
type: boolean
default: no