Skip to content

Commit

Permalink
Revert "Resolved sprint product names not being set correctly"
Browse files Browse the repository at this point in the history
This reverts commit 562f9be.
  • Loading branch information
rladdusaw committed May 13, 2020
1 parent 562f9be commit 114b760
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
Expand Up @@ -91,7 +91,7 @@ private List<Sprint> fetchActiveSprints(Product product) {
remoteProductInfo.get().forEach(rp -> {
RemoteProductManagerBean remoteProductManagerBean = (RemoteProductManagerBean) managementBeanRegistry.getService(rp.getRemoteProductManager().getName());
try {
activeSprints.addAll(remoteProductManagerBean.getActiveSprintsByProductIdAndName(rp.getScopeId(), product.getName()));
activeSprints.addAll(remoteProductManagerBean.getActiveSprintsByProductId(rp.getScopeId()));
} catch (Exception e) {
e.printStackTrace();
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/edu/tamu/app/service/manager/GitHubService.java
Expand Up @@ -93,16 +93,17 @@ public RemoteProduct getRemoteProductByScopeId(final String scopeId) throws Exce
}

@Override
public List<Sprint> getActiveSprintsByProductIdAndName(final String productScopeId, final String productName) throws Exception {
public List<Sprint> getActiveSprintsByProductId(final String productScopeId) throws Exception {
logger.info("Fetching active sprints for product with scope id " + productScopeId);
List<Sprint> activeSprints = new ArrayList<Sprint>();
GHRepository repo = github.getRepositoryById(productScopeId);
List<GHProject> projects = repo.listProjects(ProjectStateFilter.OPEN).asList();
for (GHProject project : projects) {
String sprintId = String.valueOf(project.getId());
String name = project.getName();
String projectName = repo.getName();
List<Card> cards = getCards(project);
activeSprints.add(new Sprint(sprintId, name, productName, cards));
activeSprints.add(new Sprint(sprintId, name, projectName, cards));
}
return activeSprints;
}
Expand Down
Expand Up @@ -13,7 +13,7 @@ public interface RemoteProductManagerBean extends ManagementBean {

public RemoteProduct getRemoteProductByScopeId(final String scopeId) throws Exception;

public List<Sprint> getActiveSprintsByProductIdAndName(final String productScopeId, final String productName) throws Exception;
public List<Sprint> getActiveSprintsByProductId(final String productScopeId) throws Exception;

public List<Sprint> getAdditionalActiveSprints() throws Exception;

Expand Down
Expand Up @@ -126,7 +126,7 @@ public int getPrimaryWorkItemCount(final String type, final String scopeId) thro
}

@Override
public List<Sprint> getActiveSprintsByProductIdAndName(final String productScopeId, final String productName) throws ConnectionException, APIException, OidException, IOException {
public List<Sprint> getActiveSprintsByProductId(final String productScopeId) throws ConnectionException, APIException, OidException, IOException {
logger.info("Fetching active sprints for product with scope id " + productScopeId);
List<Sprint> activeSprints = new ArrayList<Sprint>();
IAssetType timeboxType = services.getMeta().getAssetType("Timebox");
Expand Down Expand Up @@ -156,6 +156,17 @@ public List<Sprint> getActiveSprintsByProductIdAndName(final String productScope
String id = parseId(sprint.getOid());
String name = sprint.getAttribute(nameAttributeDefinition).getValue().toString();

Object[] scheduledScopes = sprint.getAttribute(scheduleScheduledScopesAttributeDefinition).getValues();
Object[] scheduledScopeNames = sprint.getAttribute(scheduleScheduledScopesNameAttributeDefinition).getValues();

String productName = null;
for (int i = 0; i < scheduledScopes.length; i++) {
if (scheduledScopes[i].toString().equals("Scope:" + productScopeId)) {
productName = scheduledScopeNames[i].toString();
break;
}
}

List<Card> cards = getActiveSprintsCards(id);
activeSprints.add(new Sprint(id, name, productName, cards));
}
Expand Down

0 comments on commit 114b760

Please sign in to comment.