I'm trying to find an algorithm that allows me to rank vetted comments higher than unverified ones, say someone posts a comment saying the sea is red, until an admin verifies that information and marks it as vetted that comment should have a lower ranking than a vetted comment, but in my opinion there should be some sort of threshold that says after x many likes this unvetted comment should rank higher than a vetted one
Edit: more info
Im developing a nodejs app to enforce political accountability on government officials, the core of the app allows users comment (either to acknowledge or critisize) the public official, but I don't want to allow users to slander and such, thus if you claim a public official has done something that claim has to be vetted, vetted comments should have a higher score than normal ones, but normal comments should be able to outweigh a vetted comment eventually
Edit: more info
var CommentSchema = new mongoose.Schema({
text: String,
vetted: {type:Boolean, default:false},
published: {type:Boolean, default:true},
pubDate: {type:Date, default:}
user: {type: mongoose.Schema.Types.ObjectId, ref: 'User'},
official: {type: mongoose.Schema.Types.ObjectId, ref: 'Official'},
in_reply: {type: mongoose.Schema.Types.ObjectId, ref: 'Comment'},
meta: {
upVotes: {type:Number, default:0},
downVotes: {type:Number, default:0}
}
});
CommentSchema.virtual('voteCount').get(function(){
return this.meta.upVotes - this.meta.downVotes;
});
Following the answer provided by @Daniel I implemented the following solution
CommentSchema.virtual('voteCount').get(function(){
return (this.vetted ? this.meta.upVotes:0)+(this.meta.upVotes - this.meta.downVotes);
});
Therefore making likes on vetted comments count double
Create a post value and sort by it:
postValue = likes + (isVetted ? 10 : 0)
This makes "vetting" worth 10 likes. In other words, if 10 people like something not vetted, it will be ranked equivalently to something vetted with 0 likes.
If you want to sort by date instead, then just sort all vetted comments and all comments with greater than 10 likes by date, and sort all other comments by date below those.