Skip to content

Commit

Permalink
refactor: stepName ์ œ๊ฑฐ
Browse files Browse the repository at this point in the history
  • Loading branch information
Arachneee committed Jul 30, 2024
1 parent 5ae22e2 commit d5a2180
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@

public record StepResponse(
String type,
String stepName,
List<String> members,
List<ActionResponse> actions
) {
public static StepResponse of(List<ActionAppResponse> actions, List<String> members, String stepName) {
public static StepResponse of(List<String> members, List<ActionAppResponse> actions) {
return new StepResponse(
actions.get(0).actionTypeName(),
stepName,
new ArrayList<>(members),
toActionsResponse(actions)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@ public static StepsResponse of(List<ActionAppResponse> actions) {
List<String> currentMembers = new ArrayList<>();
List<List<ActionAppResponse>> groups = createGroups(actions);

int billGroupCount = 0;
for (List<ActionAppResponse> group : groups) {
changeCurrentMembers(group, currentMembers);
if (group.get(0).actionType() == ActionType.BILL) {
billGroupCount++;
}
StepResponse stepResponse = StepResponse.of(group, currentMembers, billGroupCount + "์ฐจ");
StepResponse stepResponse = StepResponse.of(currentMembers, group);
steps.add(stepResponse);
}
return new StepsResponse(steps);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ void of() {

StepsResponse expected = new StepsResponse(
List.of(
new StepResponse("IN", "0์ฐจ", List.of("๋ง์ตธ", "๋ฐฑํ˜ธ"), List.of(
new StepResponse("IN", List.of("๋ง์ตธ", "๋ฐฑํ˜ธ"), List.of(
new ActionResponse(1L, "๋ง์ตธ", null, 1L),
new ActionResponse(2L, "๋ฐฑํ˜ธ", null, 2L)
)),
new StepResponse("BILL", "1์ฐจ", List.of("๋ง์ตธ", "๋ฐฑํ˜ธ"), List.of(
new StepResponse("BILL", List.of("๋ง์ตธ", "๋ฐฑํ˜ธ"), List.of(
new ActionResponse(3L, "๊ฐ์žํƒ•", 10_000L, 3L),
new ActionResponse(4L, "์ธ์ƒ๋„ค์ปท", 10_000L, 4L)
)),
new StepResponse("IN", "1์ฐจ", List.of("๋ง์ตธ", "๋ฐฑํ˜ธ", "์†Œํ•˜", "์›จ๋””"), List.of(
new StepResponse("IN", List.of("๋ง์ตธ", "๋ฐฑํ˜ธ", "์†Œํ•˜", "์›จ๋””"), List.of(
new ActionResponse(5L, "์†Œํ•˜", null, 5L),
new ActionResponse(6L, "์›จ๋””", null, 6L)
)),
new StepResponse("OUT", "1์ฐจ", List.of("์†Œํ•˜", "์›จ๋””"), List.of(
new StepResponse("OUT", List.of("์†Œํ•˜", "์›จ๋””"), List.of(
new ActionResponse(7L, "๋ง์ตธ", null, 7L),
new ActionResponse(8L, "๋ฐฑํ˜ธ", null, 8L)
)),
new StepResponse("BILL", "2์ฐจ", List.of("์†Œํ•˜", "์›จ๋””"), List.of(
new StepResponse("BILL", List.of("์†Œํ•˜", "์›จ๋””"), List.of(
new ActionResponse(9L, "๋…ธ๋ž˜๋ฐฉ", 20_000L, 9L)
))
)
Expand Down

0 comments on commit d5a2180

Please sign in to comment.