Display last retrieved day from event in recent languages instead #345

This commit is contained in:
lowlighter
2021-06-02 00:26:29 +02:00
parent 3daad25eb2
commit 5120f64c97
4 changed files with 5 additions and 1 deletions

View File

@@ -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_limit: 8 # Display up to 8 languages
plugin_languages_sections: most-used, recently-used # Display most used and recently used languages stats 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_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 commits_authoring: lowlighter@users.noreply.github.com # Surnames or email addresses used to identify your commits
``` ```

View File

@@ -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`) console.debug(`metrics/compute/${login}/plugins > languages > ${commits.length} commits loaded`)
results.commits = commits.length 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 //Retrieve edited files and filter edited lines (those starting with +/-) from patches
console.debug(`metrics/compute/${login}/plugins > languages > loading patches`) console.debug(`metrics/compute/${login}/plugins > languages > loading patches`)

View File

@@ -101,6 +101,7 @@ inputs:
# Filter events by age (for recently used languages statistics) # Filter events by age (for recently used languages statistics)
# Set to 0 to disable age filtering # 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: plugin_languages_recent_days:
description: Maximum event age (for recently used section) description: Maximum event age (for recently used section)
type: number type: number

View File

@@ -20,7 +20,7 @@
<% } else { const width = 460 * (1 + large) %> <% } else { const width = 460 * (1 + large) %>
<% if (section === "recently-used") { %> <% if (section === "recently-used") { %>
<small> <small>
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) %>
</small> </small>
<% } %> <% } %>
<svg class="bar" xmlns="http://www.w3.org/2000/svg" width="<%= width %>" height="8"> <svg class="bar" xmlns="http://www.w3.org/2000/svg" width="<%= width %>" height="8">