diff --git a/app/repositories/globalbrain.ts b/app/repositories/globalbrain.ts index 4bf1fef4..23ad736f 100644 --- a/app/repositories/globalbrain.ts +++ b/app/repositories/globalbrain.ts @@ -65,14 +65,6 @@ export async function processScoreEvents( }), ) - // Ideally, we would update this table incrementally, but for now we just - // delete all rows and reinsert them. - await sql`delete from CriticalThread`.execute(trx) - await sql` - insert into CriticalThread - select * from CriticalThreadView - `.execute(trx) - if (!gotExpectedScoreEvent) { console.error( `Expected score event not found: ${voteEvent.voteEventId}, ${voteEvent.postId}`, diff --git a/app/repositories/ranking.ts b/app/repositories/ranking.ts index 6352c2d6..63124499 100644 --- a/app/repositories/ranking.ts +++ b/app/repositories/ranking.ts @@ -62,7 +62,6 @@ export async function getCommentTreeState( 'FullScore.p as p', 'FullScore.oSize as voteCount', 'Post.deletedAt as deletedAt', - 'FullScore.criticalThreadId', ]) .where('Post.id', 'in', descendantIds.concat([targetPostId])) .where('p', 'is not', null) @@ -72,29 +71,14 @@ export async function getCommentTreeState( ? await getUserVotes(trx, userId, descendantIds.concat([targetPostId])) : undefined - const criticalCommentIdToTargetId: { [key: number]: number[] } = {} - results.forEach(res => { - const criticalThreadId = res.criticalThreadId - if (criticalThreadId !== null) { - const entry = criticalCommentIdToTargetId[criticalThreadId] - if (entry !== undefined) { - entry.push(res.postId) - } else { - criticalCommentIdToTargetId[criticalThreadId] = [res.postId] - } - } - }) - let commentTreeState: CommentTreeState = { targetPostId, - criticalCommentIdToTargetId, posts: {}, } await Promise.all( results.map(async result => { commentTreeState.posts[result.postId] = { - criticalCommentId: result.criticalThreadId, // We have to use the non-null assertion here because kysely doesn't // return values as non-null type even if we filter nulls with a where // condition. We can, however, be sure that the values are never null. diff --git a/app/repositories/vote.ts b/app/repositories/vote.ts index 6aaf1b00..075fbf94 100644 --- a/app/repositories/vote.ts +++ b/app/repositories/vote.ts @@ -104,7 +104,7 @@ export async function getUserVotes( .where(eb => eb('id', 'in', postIds)) .leftJoin('Vote as VoteOnCriticalReply', join => join - .onRef('VoteOnCriticalReply.postId', '=', 'criticalThreadId') + .onRef('VoteOnCriticalReply.postId', '=', 'criticalThreadId') // TODO: what to do here? .onRef('VoteOnCriticalReply.userId', '=', 'Vote.userId'), ) .select('Post.id as postId') diff --git a/app/routes/stats.$postId.tsx b/app/routes/stats.$postId.tsx index dc7aa990..22da77ac 100644 --- a/app/routes/stats.$postId.tsx +++ b/app/routes/stats.$postId.tsx @@ -68,26 +68,6 @@ export default function PostStats() { } ▼ **o**: ${(post.o * 100).toFixed(1)}% - **p:** ${(post.p * 100).toFixed(1)}% - **score:** ${post.score} -` - - const topCommentMarkdown = - post.criticalThreadId == null - ? '' - : ` -## Critical Comment - -- **top reply id:** ${ - post.criticalThreadId == null - ? 'null' - : `[${post.criticalThreadId}](/stats/${post.criticalThreadId})` - } -- **informed votes:** ${post.pCount} ▲ ${ - post.pSize - post.pCount - } ▼ **p**: ${(post.p * 100).toFixed(1)}% -- **uninformed votes:** ${post.qCount} ▲ ${ - post.qSize - post.qCount - } ▼ **q**: ${(post.q * 100).toFixed(1)}% -- **r**: ${post.r.toFixed(3)} ` // - q = Bayesian Average(upvotes/votes), upvoteProbabilityPrior) @@ -135,7 +115,7 @@ ${effects return (