diff --git a/app/components/page/authors_component.rb b/app/components/page/authors_component.rb index 704802bc..f519cf03 100644 --- a/app/components/page/authors_component.rb +++ b/app/components/page/authors_component.rb @@ -12,21 +12,21 @@ def git end def commits - @paths.flat_map { |path| git.gblob(path).log.to_a }.sort_by(&:author_date) - end - - def page_authors - commits.map(&:author).map { |a| [a.name, a.email] }.tally.keys - rescue => e - puts e - [] + @commits ||= @paths.flat_map { |path| git.gblob(path).log.to_a }.sort_by(&:author_date) end def last_commit - commits.last + @last_commit ||= commits.last end def last_commit_date last_commit.try(:author_date) end + + def page_authors + commits.map(&:author).map { |a| [a.name, a.email] }.tally.keys + rescue => e + puts e + [] + end end