codedang icon indicating copy to clipboard operation
codedang copied to clipboard

fix(be): integrate problem exposeTime isVisible

Open cho-to opened this issue 1 year ago • 4 comments
trafficstars

Description

Closes #1644 Closes TAS-267 Closes TAS-268

problem 필드에 존재하는 exposeTime, isVisible 필드에서 isVisible 필드를 제거하고 exposeTime 필드만을 살립니다.

  • 기존에는 exposeTime, isVisible 필드가 모두 존재해서 이로 인해 발생하는 문제들이 조금 있었습니다.
    • 특정 문제가 대회에 속하게 되면서 exposeTime이 설정되었다고 해도 getProblems 에는 isVisible을 기준으로 받아오는 경우 등등

exposeTime, isVisible을 둘 다 살려놓기에는 로직을 짤 때 충돌하는 부분이 많을 것 같아서 exposeTime만을 살려놓는게 나을 것 같다고 생각했습니다. 그래서 isVisible 필드를 제거하고 exposeTime필드로 통일하였습니다!

이때, API 스펙상으로는 변동없이 isVisible을 사용할 수 있도록 하였습니다. (request, response도 exposeTime이 아닌 isVisible 형태로 반환됩니다.) 대신, upcoming/ongoing contest에 속한 Problem의 visibility 설정을 건드릴 시에는 에러를 반환하도록 하였습니다. 또한, upcoming/ongoing contest에 속한 problem의 경우, admin에서 getProblem 통해 접근할시에는 isVisible을 null로 설정하였습니다.

기획상의 변경(대회가 끝나면 문제는 비공개처리가 원칙)으로 exposeTime 필드 이름이 visibleLockTime (isVisible을 수정할 수 있도록 하는 시간) 으로 바뀌었습니다. 필드명, 기획 변경 이외에는 바뀐 점이 없습니다.

스크린샷 2024-07-30 오전 12 18 55

위는 시간 , 밑은 isVisible 필드(프론트에게 전달되어지는 값)의 값을 의미합니다.

Additional context

코드에서 논의할만한 부분은 conservation으로 남기겠습니다.

구현한 사항 정리

  • exposeTime 및 isVisible 통합
  • seed 데이터 수정 및 bruno 파일 추가
  • MIN_DATE, MAX_DATE 상수 추가 (@libs)
  • 프론트 전달시 visibleLockTime -> isVisible 변환 로직 추가
  • 문제 삭제 혹은 대회에서 제거시 visibleLockTime 처리 관련 코드 추가
  • Problem이 속한 제일 늦은 Contest가 끝나면 invisble상태로 전환

Before submitting the PR, please make sure you do the following

  • [x] Read the Contributing Guidelines
  • [x] Read the Contributing Guidelines and follow the Commit Convention
  • [x] Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • [x] Ideally, include relevant tests that fail without this PR but pass with it.

cho-to avatar May 06 '24 11:05 cho-to

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
codedang ✅ Ready (Inspect) Visit Preview Aug 18, 2024 0:39am

vercel[bot] avatar May 06 '24 11:05 vercel[bot]

@admin/contest.service.ts의 removeProblemsFromContest에서, contest에 import되었던 문제가 contest에서 삭제되는 경우 exposeTime을 어떻게 조정해야하는지 논의 필요

Jaehyeon1020 avatar Jun 03 '24 01:06 Jaehyeon1020

@cho-to 머지해두 되나요 ?

jimin9038 avatar Aug 18 '24 06:08 jimin9038