diff --git a/source/plugins/languages/README.md b/source/plugins/languages/README.md index 832b01df..67de3bfa 100644 --- a/source/plugins/languages/README.md +++ b/source/plugins/languages/README.md @@ -56,5 +56,7 @@ For better results, it's advised to add either your surnames and eventually no-r plugin_languages_limit: 8 # Display up to 8 languages plugin_languages_sections: most-used, recently-used # Display most used and recently used languages stats plugin_languages_indepth: no # Get indepth stats (see documentation before enabling) + plugin_languages_recent_load: 500 # Load up to 500 events to compute recently used stats + plugin_languages_recent_days: 7 # Limit recently used stats to last week commits_authoring: lowlighter@users.noreply.github.com # Surnames or email addresses used to identify your commits ``` diff --git a/source/plugins/languages/analyzers.mjs b/source/plugins/languages/analyzers.mjs index 06dd578c..fc32bf01 100644 --- a/source/plugins/languages/analyzers.mjs +++ b/source/plugins/languages/analyzers.mjs @@ -69,6 +69,7 @@ export async function recent({login, data, imports, rest, account}, {skipped, da } console.debug(`metrics/compute/${login}/plugins > languages > ${commits.length} commits loaded`) results.commits = commits.length + results.latest = Math.round((new Date().getTime() - new Date(commits.slice(-1).shift()?.created_at).getTime()) / (1000 * 60 * 60 * 24)) //Retrieve edited files and filter edited lines (those starting with +/-) from patches console.debug(`metrics/compute/${login}/plugins > languages > loading patches`) diff --git a/source/plugins/languages/metadata.yml b/source/plugins/languages/metadata.yml index b306b247..69dff602 100644 --- a/source/plugins/languages/metadata.yml +++ b/source/plugins/languages/metadata.yml @@ -101,6 +101,7 @@ inputs: # Filter events by age (for recently used languages statistics) # Set to 0 to disable age filtering + # Note that metrics won't be able to load more events than GitHub is able to provide plugin_languages_recent_days: description: Maximum event age (for recently used section) type: number diff --git a/source/templates/classic/partials/languages.ejs b/source/templates/classic/partials/languages.ejs index 0a5a77cf..98c7a1d9 100644 --- a/source/templates/classic/partials/languages.ejs +++ b/source/templates/classic/partials/languages.ejs @@ -20,7 +20,7 @@ <% } else { const width = 460 * (1 + large) %> <% if (section === "recently-used") { %> - 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) %> + 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) %> <% } %>