Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/no-bidirectional-link-check
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Hjelm authored Dec 12, 2024
2 parents 2eca537 + 7db1d56 commit bb57444
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/telemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Currently we collect the following anonymous data:

Note: Exception data cannot be 100% guaranteed to not leak production data

All logging logic can be review in the 'src/WorkItemMigrator/Migration.Common.Log/Logger.cs' source file.
All logging logic can be reviewed in the 'src/WorkItemMigrator/Migration.Common.Log/Logger.cs' source file.

## Opt out of tracking

Expand Down
18 changes: 18 additions & 0 deletions src/WorkItemMigrator/JiraExport/RevisionUtils/FieldMapperUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,24 @@ public static object MapSprint(string iterationPathsString)
if (string.IsNullOrWhiteSpace(iterationPathsString))
return null;

// For certain configurations of Jira, the entire Sprint object is returned by the
// fields Rest API instead of the Sprint name
if (iterationPathsString.StartsWith("com.atlassian.greenhopper.service.sprint.Sprint@"))
{
Regex regex = new Regex(@",name=([^,]+),");
Match match = regex.Match(iterationPathsString);
if (match.Success)
{
iterationPathsString = match.Groups[1].Value;
}
else
{
Logger.Log(LogLevel.Error, "Missing 'name' property for Sprint object. "
+ $"Skipping mapping this sprint. The full object was: '{iterationPathsString}'."
);
}
}

var iterationPaths = iterationPathsString.Split(',').AsEnumerable();
iterationPaths = iterationPaths.Select(ip => ip.Trim());
var iterationPath = iterationPaths.Last();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,18 @@ public void When_calling_map_sprint_with_invalid_azdo_chars_Then_expected_output
Assert.AreEqual(expected, output);
}

[Test]
public void When_calling_map_sprint_with_full_sprint_object_as_str_Then_expected_output_is_returned()
{
string sprintPath = "com.atlassian.greenhopper.service.sprint.Sprint@7c6e1967[id=442906,rapidViewId"
+ "=187524,state=ACTIVE,name=LMS 2024_05,startDate=2024-10-14T00:00:00.000Z,endDate=2024-11-01T"
+ "23:00:00.000Z,completeDate=<null>,activatedDate=2024-10-13T18:14:54.334Z,sequence=449386,goa"
+ "l=,synced=false,autoStartStop=false,incompleteIssuesDestinationId=<null>]";
string expectedOutput = "LMS 2024_05";
object output = FieldMapperUtils.MapSprint(sprintPath);
Assert.AreEqual(expectedOutput, output);
}

[Test]
public void When_calling_map_value_with_valid_args_Then_expected_output_is_returned()
{
Expand Down

0 comments on commit bb57444

Please sign in to comment.