Skip to content

Commit

Permalink
Do not filter closed bet
Browse files Browse the repository at this point in the history
  • Loading branch information
harsh-mn-yral committed Jan 5, 2024
1 parent 9a5018c commit 60422e0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions packages/web-client/src/lib/helpers/feed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,11 @@ export async function getHotOrNotPosts(
BigInt(from + numberOfPosts),
)
if ('Ok' in res) {
const notBetPosts = await filterBets(res.Ok)
const notStuckPosts = await filterStuckCanisterPosts(notBetPosts)
// const notBetPosts = await filterBets(res.Ok)
const notStuckPosts = await filterStuckCanisterPosts(res.Ok)
const notReportedPosts = await filterReportedPosts(notStuckPosts)
// const notWatchedPosts = await filterPosts(notReportedPosts, 'watch-hon')
const populatedRes = await populatePosts(notReportedPosts, true)
const populatedRes = await populatePosts(notReportedPosts, false)
if (populatedRes.error) {
throw new Error(
`Error while populating, ${JSON.stringify(populatedRes)}`,
Expand Down Expand Up @@ -294,7 +294,7 @@ async function fetchPostDetailById(
Principal.from(post.publisher_canister_id),
).get_individual_post_details_by_id(post.post_id)
if (filterBetPosts && (hasUserBetOnPost(r) || isBettingClosed(r))) {
Log('warn', 'Already bet on post', {
Log('warn', "Already bet on post or bet's been closed", {
post,
from: 'feed.populatePosts.fetch',
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ export const load: PageServerLoad = async ({ params }) => {
const id = params.id.split('@')
const postId = BigInt(Number(id[1]))
const principal = Principal.from(id[0])

console.time('fetch:hotornot')
const r =
await individualUser(principal).get_individual_post_details_by_id(postId)
console.timeEnd('fetch:hotornot')

if (r.video_uid) {
return {
post: {
Expand All @@ -34,6 +32,7 @@ export const load: PageServerLoad = async ({ params }) => {
return
}
} catch (e) {
console.log('error', e)
return
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,17 @@ async function fetchNextVideos(force = false) {
videos = joinArrayUniquely(videos, res.posts)
if (res.noMorePosts) {
loading = false
noMoreVideos = res.noMorePosts
// const watchedVideos = await getWatchedVideosFromCache('watch-hon')
// videos = joinArrayUniquely(videos, watchedVideos)
} else if (!res.noMorePosts && res.posts.length < fetchCount - 10) {
fetchNextVideos(true)
return
}
await tick()
loading = false
Log('info', 'Fetched videos for feed', {
noMoreVideos,
Expand All @@ -95,7 +98,6 @@ async function fetchNextVideos(force = false) {
noMoreVideos,
source: 'hotOrNot.fetchNextVideos',
})
} finally {
loading = false
}
}
Expand Down

0 comments on commit 60422e0

Please sign in to comment.