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

랜덤 비디오 응답 시 중복 제거 #131

Merged
merged 10 commits into from
Nov 29, 2023
Merged

랜덤 비디오 응답 시 중복 제거 #131

merged 10 commits into from
Nov 29, 2023

Conversation

msjang4
Copy link
Collaborator

@msjang4 msjang4 commented Nov 29, 2023

resolved: #130

작업 내용

  • Manifest 응답 서버 URL로 수정
  • 랜덤 비디오 응답 시 중복 영상 제거
  • 이미지 파일 깨짐 버그 수정 (base64로 인코딩)
  • 업로드한 비디오 반환시 rating 계산
  • 카테고리별 TOP 10 비디오 응답에서 카테고리 필터링안되는 수정
  • 랜덤 비디오 응답 시 next URL대신 seed 반환하도록 수정

전달 사항

  • 중복 제거 로직
    1. 랜덤 비디오 응답으로 받은 비디오 URL에는 동일한 seed값이 쿼리스트링으로 들어가있습니다
    2. 비디오 URL 요청시 쿼리로 받은 seed 값으로 영상을 시청했다고 기록합니다.
    3. 랜덤 비디오 응답에서는 한번도 시청하지 않은 영상을 최우선순위로 하여 limit개 만큼 샘플링 시도 합니다
    4. limit개 만큼 뽑지 못했으면 시청한 영상들중 동일한 seed값으로 시청되지 않은 영상 중에서 부족한만큼 샘플링 합니다.

@msjang4 msjang4 added backend feat 새로운 기능 추가 fix 트러블 슈팅 및 디버깅 labels Nov 29, 2023
@msjang4 msjang4 added this to the Week 4 milestone Nov 29, 2023
@msjang4 msjang4 requested a review from 5tarry November 29, 2023 01:40
'actions.seed': 1,
},
},
{ $replaceRoot: { newRoot: '$actions' } },
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[{
  _id: 
  actions : [
    videoId: ,
    seed: ,
  ]
}]

형태를

[{
    videoId: ,
    seed: ,
}]

로 바꾸기 위한 연산이에요

Comment on lines +76 to +79
const otherSeedIdList = _.sampleSize(
_.reject(actions, { seed }).map((userAction) => userAction.videoId),
lackVideoCount,
);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sampleSize(list, size)는 list에서 size개를 랜덤으로 샘플링한 리스트를 반환해요

_id: { $in: otherSeedIdList },
},
{},
{ lean: true },
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lean을 true로 해주면 find의 결과가 Document인스턴스의 리스트가 아니라 javascript object의 리스트가 됩니다. 즉, toObject()를 쿼리단에서 수행하는거죠

@msjang4 msjang4 added test 테스트 코드 추가 및 수정 chore 그 외 변경 and removed test 테스트 코드 추가 및 수정 chore 그 외 변경 fix 트러블 슈팅 및 디버깅 labels Nov 29, 2023
@msjang4 msjang4 merged commit 91657c7 into develop Nov 29, 2023
@msjang4 msjang4 deleted the fix/random_video branch November 29, 2023 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend feat 새로운 기능 추가
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[Backend] 랜덤 비디오 응답 시 중복 제거
2 participants