Skip to content

Commit

Permalink
Added even more logging to the RepoStats plugin
Browse files Browse the repository at this point in the history
Let's hope this brings some light to figure out the deployment bug.
  • Loading branch information
valadas committed Jul 28, 2022
1 parent 8a0ebde commit 160747d
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions plugins/DNNCommunity.DNNDocs.Plugins/RepoStatsBuildStep.cs
Expand Up @@ -38,12 +38,13 @@ public void Postbuild(ImmutableList<FileModel> models, IHostService host)

if (gitContributors.Any() && gitCommits.Any())
{
foreach (var model in models)
foreach (var model in models.Select((value, index) => new { value, index }))
{
if (model.Type == DocumentType.Article)
Console.WriteLine($"Processing model {model.index} of {models.Count()}");
if (model.value.Type == DocumentType.Article)
{
var content = (Dictionary<string, object>)model.Content;

var content = (Dictionary<string, object>)model.value.Content;
Console.WriteLine($"Processing Article : {model.value.OriginalFileAndType.FullPath}");
for (var i = 1; i < 6; i++)
{
try
Expand All @@ -66,27 +67,26 @@ public void Postbuild(ImmutableList<FileModel> models, IHostService host)
var commits = gitCommits
.GroupBy(x => x.Author.Login)
.OrderByDescending(x => x.Count())
.Select(x => x.FirstOrDefault())
.Select(x => x.FirstOrDefault())? // FirstOrDefault might return null and the next like would fail.
.Take(5);

int index = 1;
foreach (var commit in commits)
foreach (var commit in commits.Select((value, index) => new { value, index }))
{
try
{
content["gitRecentContributor" + index + "Login"] = commit.Author.Login;
content["gitRecentContributor" + index + "AvatarUrl"] = commit.Author.AvatarUrl;
content["gitRecentContributor" + index + "HtmlUrl"] = commit.Author.HtmlUrl;
content["gitRecentContributor" + commit.index + "Login"] = commit.value.Author.Login;
content["gitRecentContributor" + commit.index + "AvatarUrl"] = commit.value.Author.AvatarUrl;
content["gitRecentContributor" + commit.index + "HtmlUrl"] = commit.value.Author.HtmlUrl;
}
catch (Exception)
{
// Ignore failures with an empty string
content["gitRecentContributor" + index + "Login"] = String.Empty;
content["gitRecentContributor" + index + "AvatarUrl"] = String.Empty;
content["gitRecentContributor" + index + "HtmlUrl"] = String.Empty;
content["gitRecentContributor" + commit.index + "Login"] = String.Empty;
content["gitRecentContributor" + commit.index + "AvatarUrl"] = String.Empty;
content["gitRecentContributor" + commit.index + "HtmlUrl"] = String.Empty;
}
finally{
index++;
Console.WriteLine($"Processed commit {commit.index} of {commits.Count()}");
}
}
}
Expand Down

0 comments on commit 160747d

Please sign in to comment.