Example #1
0
        public static List <Newsfeed> RankNewsFeed(List <Newsfeed> lst)
        {
            foreach (var post in lst)
            {
                post.AffinityScore = 0;
                post.PostWeight    = 0;

                if (post.Type == Global.PHOTO || post.Type == Global.TAG_PHOTO)
                {
                    post.PostWeight += Global.WEIGHT_PHOTO;
                }
                else
                if (post.Type == Global.VIDEO || post.Type == Global.TAG_VIDEO)
                {
                    post.PostWeight += Global.WEIGHT_VIDEO;
                }
                else
                if (post.Type == Global.TAG_VIDEOLINK)
                {
                    post.PostWeight += Global.WEIGHT_VIDEOLINK;
                }
                else
                if (post.Type == Global.TEXT_POST)
                {
                    post.PostWeight += Global.WEIGHT_TEXT;
                }
                long likesCount = LikesDAL.countPost(post._id.ToString(), Global.WALL);

                long sharesCount   = ShareDAL.countPost(post._id.ToString(), Global.WALL);
                long commentsCount = CommentsDAL.countComment(post._id.ToString(), Global.WALL);

                post.PostWeight += (int)likesCount;

                post.PostWeight += (int)sharesCount;
                post.PostWeight += (int)commentsCount;

                post.PostRank = post.PostWeight + post.AffinityScore;
            }
            return(lst);
        }
Example #2
0
 public static long countPost(string Atid, int type)
 {
     return LikesDAL.countPost(Atid, type);
 }