Skip to content

Commit

Permalink
ADM-992 [backend][frontend]: adds ‘story points’ dimension for 'class…
Browse files Browse the repository at this point in the history
…ification' in report page (#1572)

* ADM-992 [backend]: add story point row for metrics csv file

* ADM-992 [frontend]: add story points column to classification table in the board detail page

* ADM-992 [frontend]: responsive

* ADM-992 [frontend]: fix sonar issues

* ADM-992 [frontend]: add switch model button in the classification chart

* ADM-992 [backend]: fix comments

* ADM-992 [frontend]: refactor

* ADM-992 [frontend]: fix e2e test
  • Loading branch information
zhou-yinyuan authored Aug 13, 2024
1 parent 1a59b1c commit 21afdfb
Show file tree
Hide file tree
Showing 43 changed files with 1,091 additions and 551 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ public class ClassificationInfo {

private String name;

private Double value;
private Double cardCountValue;

private Double storyPointsValue;

private int cardCount;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,10 +443,15 @@ private String formatStepName(CycleTimeForSelectedStepItem cycleTimeForSelectedS
private List<String[]> getRowsFormClassification(Classification classificationList) {
List<String[]> rows = new ArrayList<>();
String fieldName = String.valueOf((classificationList.getFieldName()));
final String CLASSIFICATION = "Classifications";
List<ClassificationInfo> pairList = classificationList.getClassificationInfos();
pairList.forEach(nameValuePair -> rows
.add(new String[] { "Classifications", fieldName + " / " + nameValuePair.getName() + "(%)",
DecimalUtil.formatDecimalTwo(nameValuePair.getValue() * 100) }));
pairList.forEach(nameValuePair -> {
String classificationName = nameValuePair.getName();
rows.add(new String[] { CLASSIFICATION, fieldName + " / " + classificationName + "(Value/Cards count%)",
DecimalUtil.formatDecimalTwo(nameValuePair.getCardCountValue() * 100) });
rows.add(new String[] { CLASSIFICATION, fieldName + " / " + classificationName + "(Value/Story point%)",
DecimalUtil.formatDecimalTwo(nameValuePair.getStoryPointsValue() * 100) });
});
return rows;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ public List<Classification> calculate(List<TargetField> targetFields, CardCollec
valueMap.remove(NONE_KEY);
}

valueMap.forEach((displayName, count) -> classificationInfo
.add(new ClassificationInfo(displayName, (double) count.getCardCount() / cards.getCardsNumber(),
count.getCardCount(), count.getStoryPoints())));
valueMap.forEach((displayName, count) -> classificationInfo.add(new ClassificationInfo(displayName,
(double) count.getCardCount() / cards.getCardsNumber(),
count.getStoryPoints() / cards.getStoryPointSum(), count.getCardCount(), count.getStoryPoints())));

classificationFields.add(new Classification(nameMap.get(fieldName), cards.getCardsNumber(),
cards.getStoryPointSum(), classificationInfo));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,10 @@ void shouldConvertMetricDataToCsv() {
{ "Cycle time", "Average testing time(days/card)", "0.02" },
{ "Cycle time", "Average time(days/storyPoint)", "0.01" },
{ "Cycle time", "Average time(days/card)", "0.02" },
{ "Classifications", "Issue Type / Bug(%)", "33.33" },
{ "Classifications", "Issue Type / Story(%)", "66.67" },
{ "Classifications", "Issue Type / Bug(Value/Cards count%)", "33.33" },
{ "Classifications", "Issue Type / Bug(Value/Story point%)", "50.00" },
{ "Classifications", "Issue Type / Story(Value/Cards count%)", "66.67" },
{ "Classifications", "Issue Type / Story(Value/Story point%)", "50.00" },
{ "Deployment frequency", "Heartbeat / Deploy prod / Deployment frequency(Deployments/Day)",
"0.78" },
{ "Deployment frequency", "Heartbeat / Deploy prod / Deployment frequency(Deployment times)",
Expand Down Expand Up @@ -622,13 +624,20 @@ void shouldHasContentWhenGetDataFromCsvGivenDataTypeIsMetric() {
try (MockedStatic<CardStepsEnum> cardStepsEnumMockedStatic = mockStatic(CardStepsEnum.class)) {
ReportResponse reportResponse = ReportResponse.builder()
.velocity(Velocity.builder().velocityForCards(2).velocityForSP(7).build())
.classificationList(
List.of(Classification.builder()
.fieldName("Issue Type")
.classificationInfos(List.of(
ClassificationInfo.builder().name("Bug").value(0.3333333333333333).build(),
ClassificationInfo.builder().name("Story").value(0.6666666666666666).build()))
.build()))
.classificationList(List.of(Classification.builder()
.fieldName("Issue Type")
.classificationInfos(List.of(
ClassificationInfo.builder()
.name("Bug")
.cardCountValue(0.3333333333333333)
.storyPointsValue(0.6)
.build(),
ClassificationInfo.builder()
.name("Story")
.cardCountValue(0.6666666666666666)
.storyPointsValue(0.4)
.build()))
.build()))
.cycleTime(CycleTime.builder()
.totalTimeForCards(29.26)
.averageCycleTimePerCard(9.75)
Expand Down Expand Up @@ -789,8 +798,10 @@ void shouldHasContentWhenGetDataFromCsvGivenDataTypeIsMetric() {
{ "Cycle time", "Average waiting for deployment time(days/card)", "6.06" },
{ "Cycle time", "Average time(days/storyPoint)", "0.01" },
{ "Cycle time", "Average time(days/card)", "0.02" },
{ "Classifications", "Issue Type / Bug(%)", "33.33" },
{ "Classifications", "Issue Type / Story(%)", "66.67" },
{ "Classifications", "Issue Type / Bug(Value/Cards count%)", "33.33" },
{ "Classifications", "Issue Type / Bug(Value/Story point%)", "60.00" },
{ "Classifications", "Issue Type / Story(Value/Cards count%)", "66.67" },
{ "Classifications", "Issue Type / Story(Value/Story point%)", "40.00" },
{ "Deployment frequency", "Heartbeat / Deploy prod / Deployment frequency(Deployments/Day)",
"0.78" },
{ "Deployment frequency", "Heartbeat / Deploy prod / Deployment frequency(Deployment times)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,17 @@ public static ReportResponse MOCK_METRIC_CSV_DATA() {
.velocity(Velocity.builder().velocityForCards(2).velocityForSP(7).build())
.classificationList(List.of(Classification.builder()
.fieldName("Issue Type")
.classificationInfos(List.of(ClassificationInfo.builder().name("Bug").value(0.3333333333333333).build(),
ClassificationInfo.builder().name("Story").value(0.6666666666666666).build()))
.classificationInfos(List.of(
ClassificationInfo.builder()
.name("Bug")
.cardCountValue(0.3333333333333333)
.storyPointsValue(0.5)
.build(),
ClassificationInfo.builder()
.name("Story")
.cardCountValue(0.6666666666666666)
.storyPointsValue(0.5)
.build()))
.build()))
.cycleTime(CycleTime.builder()
.totalTimeForCards(29.26)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,22 @@ void shouldReturnClassificationWithMapArrayFields() {
assertEquals(3, classificationList.size());

assertEquals("sprint1", classificationList.get(0).getName());
assertEquals(0.5, classificationList.get(0).getValue());
assertEquals(0.5, classificationList.get(0).getCardCountValue());
assertEquals(2, classificationList.get(0).getCardCount());
assertEquals(6, classificationList.get(0).getStoryPoints(), 0.0001);
assertEquals(2, classificationList.get(0).getStoryPointsValue(), 0.0001);

assertEquals("sprint2", classificationList.get(1).getName());
assertEquals(0.5, classificationList.get(1).getValue());
assertEquals(0.5, classificationList.get(1).getCardCountValue());
assertEquals(2, classificationList.get(1).getCardCount());
assertEquals(6, classificationList.get(1).getStoryPoints(), 0.0001);
assertEquals(2, classificationList.get(1).getStoryPointsValue(), 0.0001);

assertEquals("None", classificationList.get(2).getName());
assertEquals(0.5, classificationList.get(2).getValue());
assertEquals(0.5, classificationList.get(2).getCardCountValue());
assertEquals(2, classificationList.get(2).getCardCount());
assertEquals(0, classificationList.get(2).getStoryPoints(), 0.0001);
assertEquals(0, classificationList.get(2).getStoryPointsValue(), 0.0001);
}

@Test
Expand Down Expand Up @@ -118,12 +121,12 @@ void shouldReturnClassificationWithJsonArrayMapArrayFieldsWithPickName() {
assertEquals(2, classificationList.size());

assertEquals("None", classificationList.get(0).getName());
assertEquals(0.5, classificationList.get(0).getValue());
assertEquals(0.5, classificationList.get(0).getCardCountValue());
assertEquals(1, classificationList.get(0).getCardCount());
assertEquals(3, classificationList.get(0).getStoryPoints(), 0.0001);

assertEquals("Tool Sprint 6", classificationList.get(1).getName());
assertEquals(0.5, classificationList.get(1).getValue());
assertEquals(0.5, classificationList.get(1).getCardCountValue());
assertEquals(1, classificationList.get(1).getCardCount());
assertEquals(0, classificationList.get(1).getStoryPoints(), 0.0001);
}
Expand Down Expand Up @@ -158,10 +161,10 @@ void shouldReturnClassificationWithJsonArrayMapArrayFieldsWithPickDisplayName()
assertEquals(1, classifications.size());
assertEquals("Partner", classifications.get(0).getFieldName());
assertEquals("Shawn", classificationList.get(0).getName());
assertEquals(0.5, classificationList.get(0).getValue());
assertEquals(0.5, classificationList.get(0).getCardCountValue());
assertEquals(1, classificationList.get(0).getCardCount());
assertEquals("None", classificationList.get(1).getName());
assertEquals(0.5, classificationList.get(1).getValue());
assertEquals(0.5, classificationList.get(1).getCardCountValue());
assertEquals(1, classificationList.get(1).getCardCount());
}

Expand Down Expand Up @@ -195,10 +198,10 @@ void shouldReturnClassificationWithJsonArrayMapArrayFieldsWithPickValueName() {
assertEquals(1, classifications.size());
assertEquals("Rank", classifications.get(0).getFieldName());
assertEquals("bug", classificationList.get(0).getName());
assertEquals(0.5, classificationList.get(0).getValue());
assertEquals(0.5, classificationList.get(0).getCardCountValue());
assertEquals(1, classificationList.get(0).getCardCount());
assertEquals("None", classificationList.get(1).getName());
assertEquals(0.5, classificationList.get(1).getValue());
assertEquals(0.5, classificationList.get(1).getCardCountValue());
assertEquals(1, classificationList.get(1).getCardCount());
}

Expand Down Expand Up @@ -231,7 +234,7 @@ void shouldReturnClassificationWithJsonArrayMapArrayFieldsWithNoneKey() {
assertEquals(1, classifications.size());
assertEquals("Issue Color", classifications.get(0).getFieldName());
assertEquals("None", classificationList.get(0).getName());
assertEquals(1, classificationList.get(0).getValue());
assertEquals(1, classificationList.get(0).getCardCountValue());
assertEquals(2, classificationList.get(0).getCardCount());
}

Expand Down Expand Up @@ -261,7 +264,7 @@ void shouldReturnClassificationWithJsonNull() {
assertEquals(1, classifications.size());
assertEquals("Start date", classifications.get(0).getFieldName());
assertEquals("None", classificationList.get(0).getName());
assertEquals(1, classificationList.get(0).getValue());
assertEquals(1, classificationList.get(0).getCardCountValue());
assertEquals(2, classificationList.get(0).getCardCount());
}

Expand Down Expand Up @@ -290,7 +293,7 @@ void shouldReturnClassificationWithJsonPrimitive() {
assertEquals(1, classifications.size());
assertEquals("development", classifications.get(0).getFieldName());
assertEquals("test", classificationList.get(0).getName());
assertEquals(0.5, classificationList.get(0).getValue());
assertEquals(0.5, classificationList.get(0).getCardCountValue());
assertEquals(1, classificationList.get(0).getCardCount());
}

Expand All @@ -311,14 +314,14 @@ void shouldReturnClassificationWithPickRightDisplayName() {
assertEquals(2, classifications.size());
assertEquals("Assignee", classifications.get(1).getFieldName());
assertEquals("Shawn", classificationListForAssignee.get(0).getName());
assertEquals(0.25, classificationListForAssignee.get(0).getValue());
assertEquals(0.25, classificationListForAssignee.get(0).getCardCountValue());
assertEquals(1, classificationListForAssignee.get(0).getCardCount());
assertEquals("Tom", classificationListForAssignee.get(1).getName());
assertEquals(0.25, classificationListForAssignee.get(1).getValue());
assertEquals(0.25, classificationListForAssignee.get(1).getCardCountValue());
assertEquals(1, classificationListForAssignee.get(1).getCardCount());
assertEquals("Reporter", classifications.get(0).getFieldName());
assertEquals("Jack", classificationListForReporter.get(0).getName());
assertEquals(0.5, classificationListForReporter.get(0).getValue());
assertEquals(0.5, classificationListForReporter.get(0).getCardCountValue());
assertEquals(2, classificationListForReporter.get(0).getCardCount());
}

Expand All @@ -340,15 +343,15 @@ void shouldReturnClassificationWithPickRightName() {
assertEquals(3, classifications.size());
assertEquals("IssueType", classifications.get(0).getFieldName());
assertEquals("Task", classificationListForIssueType.get(0).getName());
assertEquals(0.5, classificationListForIssueType.get(0).getValue());
assertEquals(0.5, classificationListForIssueType.get(0).getCardCountValue());
assertEquals(2, classificationListForIssueType.get(0).getCardCount());
assertEquals("Card Parent", classifications.get(1).getFieldName());
assertEquals("test", classificationListForCardParent.get(0).getName());
assertEquals(0.25, classificationListForCardParent.get(0).getValue());
assertEquals(0.25, classificationListForCardParent.get(0).getCardCountValue());
assertEquals(1, classificationListForCardParent.get(0).getCardCount());
assertEquals("Project", classifications.get(2).getFieldName());
assertEquals("heartBeat", classificationListForProject.get(0).getName());
assertEquals(0.5, classificationListForProject.get(0).getValue());
assertEquals(0.5, classificationListForProject.get(0).getCardCountValue());
assertEquals(2, classificationListForProject.get(0).getCardCount());

}
Expand Down Expand Up @@ -381,10 +384,10 @@ void shouldReturnClassificationWithString() {
assertEquals("Labels", classifications.get(0).getFieldName());
assertEquals(4, classifications.get(0).getTotalCardCount());
assertEquals("backend", classifications.get(0).getClassificationInfos().get(0).getName());
assertEquals(0.5, classificationListForLabels.get(0).getValue());
assertEquals(0.5, classificationListForLabels.get(0).getCardCountValue());
assertEquals(2, classificationListForLabels.get(0).getCardCount());
assertEquals("frontend", classificationListForLabels.get(2).getName());
assertEquals(0.5, classificationListForLabels.get(2).getValue());
assertEquals(0.5, classificationListForLabels.get(2).getCardCountValue());
assertEquals(2, classificationListForLabels.get(2).getCardCount());

}
Expand Down Expand Up @@ -440,10 +443,10 @@ void shouldReturnClassificationWithMapArrayFieldSameContent() {
assertEquals("Fix Versions", classifications.get(0).getFieldName());
assertEquals(4, classifications.get(0).getTotalCardCount());
assertEquals("sprint1", classificationListForFixVersions.get(0).getName());
assertEquals(0.5, classificationListForFixVersions.get(0).getValue());
assertEquals(0.5, classificationListForFixVersions.get(0).getCardCountValue());
assertEquals(2, classificationListForFixVersions.get(0).getCardCount());
assertEquals("sprint2", classificationListForFixVersions.get(1).getName());
assertEquals(0.5, classificationListForFixVersions.get(1).getValue());
assertEquals(0.5, classificationListForFixVersions.get(1).getCardCountValue());
assertEquals(2, classificationListForFixVersions.get(1).getCardCount());
}

Expand All @@ -461,7 +464,7 @@ void shouldReturnClassificationWithMapArrayFieldEmptyContent() {
assertEquals("Fix Versions", classifications.get(0).getFieldName());
assertEquals(2, classifications.get(0).getTotalCardCount());
assertEquals("None", classificationListForFixVersions.get(0).getName());
assertEquals(1, classificationListForFixVersions.get(0).getValue());
assertEquals(1, classificationListForFixVersions.get(0).getCardCountValue());
assertEquals(2, classificationListForFixVersions.get(0).getCardCount());
}

Expand Down Expand Up @@ -495,7 +498,7 @@ void shouldReturnClassificationWithoutNoneKeyWhenCardCountsAndStoryPointAreZero(
assertEquals(1, classificationList.size());

assertEquals("test", classificationList.get(0).getName());
assertEquals(1, classificationList.get(0).getValue());
assertEquals(1, classificationList.get(0).getCardCountValue());
assertEquals(1, classificationList.get(0).getCardCount());
assertEquals(3, classificationList.get(0).getStoryPoints(), 0.0001);
}
Expand Down Expand Up @@ -530,12 +533,12 @@ void shouldReturnClassificationWithNoneKeyWhenStoryPointIsNotZero() {
assertEquals(2, classificationList.size());

assertEquals("test", classificationList.get(0).getName());
assertEquals(1, classificationList.get(0).getValue());
assertEquals(1, classificationList.get(0).getCardCountValue());
assertEquals(1, classificationList.get(0).getCardCount());
assertEquals(3, classificationList.get(0).getStoryPoints(), 0.0001);

assertEquals("None", classificationList.get(1).getName());
assertEquals(0, classificationList.get(1).getValue());
assertEquals(0, classificationList.get(1).getCardCountValue());
assertEquals(0, classificationList.get(1).getCardCount());
assertEquals(3, classificationList.get(1).getStoryPoints(), 0.0001);
}
Expand Down
Loading

0 comments on commit 21afdfb

Please sign in to comment.