diff --git a/scripts/scheduled/metrics.py b/scripts/scheduled/metrics.py index 8b2171243e..1e61330fed 100644 --- a/scripts/scheduled/metrics.py +++ b/scripts/scheduled/metrics.py @@ -21,10 +21,10 @@ contributors = len(contributors) # Number of Links -links = db.links.count() +links = db.links.count_documents({}) # Number of Source sheets -sheets = db.sheets.count() +sheets = db.sheets.count_documents({}) metrics = { "timestamp": datetime.datetime.now().replace(hour=0, minute=0, second=0, microsecond=0), @@ -37,6 +37,6 @@ } try: - db.metrics.save(metrics) + db.metrics.insert_one(metrics) except DuplicateKeyError: pass diff --git a/sefaria/model/text.py b/sefaria/model/text.py index 6e088c9589..1a0b5f2c32 100644 --- a/sefaria/model/text.py +++ b/sefaria/model/text.py @@ -1029,7 +1029,11 @@ class AbstractTextRecord(object): def word_count(self): """ Returns the number of words in this text """ - return self.ja(remove_html=True).word_count() + try: + wc = self.ja(remove_html=True).word_count() + except AttributeError: + wc = 0 + return wc def char_count(self): """ Returns the number of characters in this text """