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

chore: commentarySectionRef return null if too many sections #2292

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stevekaplan123
Copy link
Contributor

Description

Commentaries like Malbim Ayelet HaShachar in the sidebar can cause hundreds of queries to get issued. This is because its structure is not similar to the base text, and so a link from a verse in the Torah can be connected to Malbim Ayelet HaShachar 1-603, yielding 603 calls.

Code Changes

The following changes were made to the files below

  1. commentarySectionRef now returns null if there are more than tooManySections/5 refs in the range. This number may be arbitrary but it seems reasonable to me.
  2. I also noticed some duplicated code where we convert strings to numbers and created a utility function parseInt.

@@ -1754,45 +1754,48 @@ Sefaria = extend(Sefaria, {
linkSummaryBookSortHebrew: function(category, a, b) {
return Sefaria.linkSummaryBookSort(category, a, b, true);
},
commentarySectionRef: function(commentator, baseRef) {
commentarySectionRef: function(commentator, baseRef, tooManySections = 5) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i hope this is not a nitpicking, but this number does not represent too many, but rather the upper bound of not too many. i'm not sure what is the best name here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants