Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] 라인 차트 조회시 데이터 정렬 #84

Closed
yonghwankim-dev opened this issue Dec 13, 2023 · 0 comments · Fixed by #86
Closed

[bug] 라인 차트 조회시 데이터 정렬 #84

yonghwankim-dev opened this issue Dec 13, 2023 · 0 comments · Fixed by #86
Assignees
Labels
bug Something isn't working

Comments

@yonghwankim-dev
Copy link
Member

yonghwankim-dev commented Dec 13, 2023

상황

라인 차트 API 조회(/api/dashboard/lineChart)시 데이터들 정렬이 적용되지 않았습니다. 차트 조회시 데이터들이 time을 기준으로 오름차순(오래된 날짜가 제일 앞에 위치)으로 정렬되어야 합니다.

image

원인

  • 조회시 정렬을 적용하지 않았습니다.
return timeValueMap.keySet()
		.stream()
		.map(key -> DashboardLineChartResponse.of(key, timeValueMap.get(key)))
		.collect(Collectors.toList());

해결방법

응답전에 time을 기준으로 정렬하여 응답합니다.

return timeValueMap.keySet()
		.stream()
		.sorted()
		.map(key -> DashboardLineChartResponse.of(key, timeValueMap.get(key)))
		.collect(Collectors.toList());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants