Mercurial > hg > Feedworm
view backend/arangodb/Feed.py @ 258:4ca1fac32dde
Pull the constant of days to keep feed entries into the abstract class
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Tue, 12 Mar 2019 02:39:18 +0100 |
parents | f79be01821c4 |
children | 304917762618 |
line wrap: on
line source
# -*- coding: utf-8 -*- from datetime import datetime class Feed(object): def __init__(self, document): super(Feed, self).__init__() self.document = document def __getattr__(self, attribute): return self.document[attribute] @staticmethod def get_unread(database): query = """ FOR feed_entry_doc IN feed_entry FOR feed_doc IN feed FILTER feed_entry_doc.read == false AND feed_entry_doc.feed == feed_doc._key RETURN DISTINCT feed_doc""" results = database.AQLQuery(query) return [Feed(doc) for doc in results] @staticmethod def all_pending_update(database): query = """ FOR feed_doc IN feed FILTER DATE_ISO8601(DATE_NOW()) > feed_doc.next_update RETURN feed_doc """ results = database.AQLQuery(query) return [Feed(doc) for doc in results]