오늘 원래 리뉴얼 인프라 구상하고 drf 적용해봤어야 했는데 디버깅만 하다가 끝나버렸다.
프론트엔드 개발자의 입장에서 클라이언트 단의 오류를 파악하는 가장 확실한 방법은 해당 브라우저의 개발자 도구 콘솔을 통해 오류 내용을 파악하는 것.
- 오류가 발생한 클라이언트 장비에 원격 접속해 직접 웹 브라우저를 확인
- 서비스를 이용중인 고객에게 직접 ‘웹 브라우저의 개발자 도구를 열고 > 콘솔에 찍힌 오류 내용을 캡쳐해주세요.’ 라는 요구를 한다.
자바스크립트의 자유로운 문법 특성상 런타임 오류가 발생하기 쉽다.
브라우저 콘솔에 찍히는 로그를 확인해야함 오류발생을 확인할 수 있다.
모바일, 웹뷰 테스트 시 콘솔을 확인하기 어렵다.
로그를 한 눈에 빠르게 파악할 수 있기 때문에 빠른 대응을 할 수 있다.
PostgreSQL
The PostgreSQL backend stores datetimes as timestamp with time zone. In practice, this means it converts datetimes from the connection’s time zone to UTC on storage, and from UTC to the connection’s time zone on retrieval.
As a consequence, if you’re using PostgreSQL, you can switch between USE_TZ = False and USE_TZ = True freely. The database connection’s time zone will be set to TIME_ZONE or UTC respectively, so that Django obtains correct datetimes in all cases. You don’t need to perform any data conversions.
hour=11
이 아니라 hour=23
이고... now
를 기준으로 잡는게 아니라 matchtime
을 기준으로 잡아야된다ㅠㅜ 이거 하는 김에 날짜 객체 모듈 import하는 것도 바꿔서 timedelta도 datetime에서 바로 데려오도록 바꿨다. 이유는... 통일성을 위해.def voiceletter_status_converter(process_status, matchtime):
now = datetime.now()
due = matchtime.replace(hour=23, minute=59, second=59) if matchtime.hour <= 8 else matchtime.replace(hour=23, minute=59, second=59) + datetime.timedelta(days=1)
if process_status < 2:
return '제출대기'
elif process_status < 3 and now - due > datetime.timedelta(0):
return '답신필요(기한초과)'
elif process_status < 3:
return '답신필요'
elif process_status <=5 and now - due > datetime.timedelta(0):
return '답신완료(기한초과)'
elif process_status <= 5:
return '답신완료'
else:
return False