Skip to content

Commit

Permalink
🐛 Fix tempCode 순서 문제 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
miiiinju1 committed Dec 8, 2023
1 parent d3c8268 commit 360fe73
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,15 @@ public List<TestCodeDto> getTempCode(Tests test)

Map<String, TempCodeDto> tempCodes = hashOps.entries(tempCodeKey);

return tempCodes.keySet().stream().map(problemNumber-> TestCodeDto.builder()
.cppCode(tempCodes.get(problemNumber).getCppCode())
.pythonCode(tempCodes.get(problemNumber).getPythonCode())
.javaCode(tempCodes.get(problemNumber).getJavaCode())
.problemNumber(Integer.parseInt(problemNumber))
.build()).collect(Collectors.toList());
return tempCodes.entrySet().stream()
.sorted(Map.Entry.comparingByKey())
.map(entry -> TestCodeDto.builder()
.cppCode(entry.getValue().getCppCode())
.pythonCode(entry.getValue().getPythonCode())
.javaCode(entry.getValue().getJavaCode())
.problemNumber(Integer.parseInt(entry.getKey()))
.build())
.collect(Collectors.toList());
}

public PracticeProblemCodeDto getPracticeProblemTempCode(Long practiceProblemId) {
Expand Down

0 comments on commit 360fe73

Please sign in to comment.