Exemplo n.º 1
0
 def get_resent_feature(self):
     from article.models import ArticleUnlike, Article
     read_article_logs = UserReadLog.objects(user_id=str(self.id)).order_by('-id')[:25]
     unlike_article_logs = ArticleUnlike.objects(author_id=str(self.id)).order_by('-id')[:5]
     read_article_ids = [log.article_seq_id for log in read_article_logs]
     unlike_article_ids = [log.article_id for log in unlike_article_logs]
     read_articles = Article.objects(seq_id__in=read_article_ids)
     unlike_articles = Article.objects(id__in=unlike_article_ids)
     feature = None
     for article in read_articles:
         feature = article.feature_matrix if feature is None else feature + article.feature_matrix
     for article in unlike_articles:
         feature = -1 * article.feature_matrix if feature is None else feature - article.feature_matrix
     return feature
Exemplo n.º 2
0
 def add_duration_to_read_log(self, article, duration):
     return UserReadLog.update_read_log(self, article, duration)
Exemplo n.º 3
0
 def add_read_log(self, article):
     return UserReadLog.add_to_log(self, article)
Exemplo n.º 4
0
 def get_last_view_article(self):
     return UserReadLog.get_user_last_seen(self)