Skip to content

Commit 5120f64

Browse files
committed
Display last retrieved day from event in recent languages instead lowlighter#345
1 parent 3daad25 commit 5120f64

File tree

4 files changed

+5
-1
lines changed

4 files changed

+5
-1
lines changed

source/plugins/languages/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,7 @@ For better results, it's advised to add either your surnames and eventually no-r
5656
plugin_languages_limit: 8 # Display up to 8 languages
5757
plugin_languages_sections: most-used, recently-used # Display most used and recently used languages stats
5858
plugin_languages_indepth: no # Get indepth stats (see documentation before enabling)
59+
plugin_languages_recent_load: 500 # Load up to 500 events to compute recently used stats
60+
plugin_languages_recent_days: 7 # Limit recently used stats to last week
5961
commits_authoring: lowlighter@users.noreply.github.com # Surnames or email addresses used to identify your commits
6062
```

source/plugins/languages/analyzers.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export async function recent({login, data, imports, rest, account}, {skipped, da
6969
}
7070
console.debug(`metrics/compute/${login}/plugins > languages > ${commits.length} commits loaded`)
7171
results.commits = commits.length
72+
results.latest = Math.round((new Date().getTime() - new Date(commits.slice(-1).shift()?.created_at).getTime()) / (1000 * 60 * 60 * 24))
7273

7374
//Retrieve edited files and filter edited lines (those starting with +/-) from patches
7475
console.debug(`metrics/compute/${login}/plugins > languages > loading patches`)

source/plugins/languages/metadata.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ inputs:
101101

102102
# Filter events by age (for recently used languages statistics)
103103
# Set to 0 to disable age filtering
104+
# Note that metrics won't be able to load more events than GitHub is able to provide
104105
plugin_languages_recent_days:
105106
description: Maximum event age (for recently used section)
106107
type: number

source/templates/classic/partials/languages.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<% } else { const width = 460 * (1 + large) %>
2121
<% if (section === "recently-used") { %>
2222
<small>
23-
estimation from <%= plugins.languages["stats.recent"]?.files %> edited file<%= s(plugins.languages["stats.recent"]?.files) %> from <%= plugins.languages["stats.recent"]?.commits %> commit<%= s(plugins.languages["stats.recent"]?.commits) %> over last <%= plugins.languages["stats.recent"]?.days %> day<%= s(plugins.languages["stats.recent"]?.days) %>
23+
estimation from <%= plugins.languages["stats.recent"]?.files %> edited file<%= s(plugins.languages["stats.recent"]?.files) %> from <%= plugins.languages["stats.recent"]?.commits %> commit<%= s(plugins.languages["stats.recent"]?.commits) %> over last <%= plugins.languages["stats.recent"]?.latest ?? plugins.languages["stats.recent"]?.days %> day<%= s(plugins.languages["stats.recent"]?.latest ?? plugins.languages["stats.recent"]?.days) %>
2424
</small>
2525
<% } %>
2626
<svg class="bar" xmlns="http://www.w3.org/2000/svg" width="<%= width %>" height="8">

0 commit comments

Comments
 (0)