Skip to content

Commit

Permalink
Fix to DORA call (#470)
Browse files Browse the repository at this point in the history
  • Loading branch information
samsmithnz committed Jun 15, 2023
1 parent ae68b8e commit a0cc310
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public DevOpsMetricServiceApi(string devOpsServiceURL)
try
{
// api/DORASummary/GetDORASummaryItems?owner=samsmithnz&repository=DevOpsMetrics
string url = $"/api/DORASummary/GetDORASummaryItem?owner={owner}&project=&repository={repo}";
string url = $"/api/DORASummary/GetDORASummaryItem?owner={owner}&project=&repo={repo}";
return await BaseApi.GetResponse<DORASummaryItem>(Client, url);
}
catch (Exception ex)
Expand Down
14 changes: 0 additions & 14 deletions src/RepoGovernance.Core/SummaryItemsDA.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ public static List<UserOwnerRepo> GetRepos(string user)
string? devOpsServiceURL,
string user,
string owner,
string project,
string repo)
{
int itemsUpdated = 0;
Expand Down Expand Up @@ -282,19 +281,6 @@ public static List<UserOwnerRepo> GetRepos(string user)
{
summaryItem.DORASummary = dORASummaryItem;
}
else
{
//Initialize an empty DORA summary item
dORASummaryItem = new(owner, project, repo)
{
DeploymentFrequency = 0,
LeadTimeForChanges = 0,
MeanTimeToRestore = 0,
ChangeFailureRate = -1, //change failure rate is a percentage, so -1 is a good default value
LastUpdatedMessage = "DORA statistics for this project doesn't exist"
};
summaryItem.DORASummary = dORASummaryItem;
}
}

//Get the Release info
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static async Task Run([QueueTrigger("summaryqueue", Connection = "AzureWe
Configuration["GitHubClientSecret"],
Configuration["SummaryQueueConnection"],
Configuration["DevOpsServiceURL"],
user, owner, project, repo);
user, owner, repo);
if (itemsUpdated > 0)
{
log.LogInformation($"C# Queue trigger function completed updating {itemsUpdated} items at: {DateTime.Now}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ public List<UserOwnerRepo> GetRepos(string owner)
/// <param name="repo">the repository being updated</param>
/// <returns></returns>
[HttpGet("UpdateSummaryItem")]
public async Task<int> UpdateSummaryItem(string user, string owner,string project, string repo)
public async Task<int> UpdateSummaryItem(string user, string owner, string repo)
{
return await SummaryItemsDA.UpdateSummaryItem(
Configuration["AppSettings:GitHubClientId"],
Configuration["AppSettings:GitHubClientSecret"],
Configuration["AppSettings:CosmosDBConnectionString"],//Configuration["AppSettings:StorageConnectionString"],
Configuration["AppSettings:DevOpsServiceURL"],
user, owner, project, repo);
user, owner, repo);
}

/// <summary>
Expand Down
3 changes: 1 addition & 2 deletions src/RepoGovernance.Tests/SummaryItemsControllerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ public async Task UpdateRepoGovernanceSummaryItemTest()
//Arrange
string user = "samsmithnz";
string owner = "samsmithnz";
string project = null;
string repo = "Sams2048";

//Act - runs a repo in about 4s
int itemsUpdated = await SummaryItemsDA.UpdateSummaryItem(GitHubId, GitHubSecret, AzureStorageConnectionString, DevOpsServiceURL, user, owner, project, repo);
int itemsUpdated = await SummaryItemsDA.UpdateSummaryItem(GitHubId, GitHubSecret, AzureStorageConnectionString, DevOpsServiceURL, user, owner, repo);

//Assert
Assert.AreEqual(1, itemsUpdated);
Expand Down

0 comments on commit a0cc310

Please sign in to comment.