fix(#13): 날짜 변경 후 전날 대시보드 기록 노출 방지#21
Merged
Merged
Conversation
current_status 조회 시 updated_at을 오늘 날자 범위로 제한 당일 CAM 추론 기록이 없으면 현재 인원과 오늘 최대·평균 인원을 초기값으로 반환
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🍀 이슈 번호
📝 변경 사항
dashboard.current_status조회 시updated_at이 오늘 날짜 범위에 포함된 데이터만 반환하도록 수정당일 CAM 추론 기록이 없으면 다음 값을 초기값으로 반환하도록 처리
000.0null날짜 변경 후 CAM이 동작하기 전까지 전날 기록이 대시보드에 표시되지 않도록 수정
🎯 목적
dashboard.current_status는 하나의 행에 가장 최근 추론 결과를 저장하고 있습니다.기존에는 현재 상태를 조회할 때 데이터의 날짜를 확인하지 않아, 날짜가 변경된 이후 CAM이 아직 동작하지 않은 경우에도 전날의 현재 인원과 오늘 최대·평균 인원이 그대로 반환되는 문제가 있었습니다.
조회 시
updated_at을 오늘 날짜 범위로 제한하여, 당일 추론 기록이 없는 경우에는 대시보드 기본값을 반환하도록 수정했습니다.📂 적용 범위
backend/main.pyget_current_status_from_db()dashboard.current_status조회 SQL🖥️ 주요 코드 설명
updated_at이 오늘 0시 이상, 다음 날 0시 미만인 경우에만 현재 상태를 반환합니다.조건에 맞는 행이 없으면 기존의
row is None분기를 통해 다음 기본값을 반환합니다.{ "count": 0, "updated_at": null, "today_max_count": 0, "today_avg_count": 0.0 }📋 체크리스트
📌 참고 사항