Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/sc 31547/metrics webpage #2226

Merged
merged 3 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions scripts/scheduled/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -37,6 +37,6 @@
}

try:
db.metrics.save(metrics)
db.metrics.insert_one(metrics)
except DuplicateKeyError:
pass
6 changes: 5 additions & 1 deletion sefaria/model/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 """
Expand Down
Loading