I noticed that when selecting the book and using the chapter drop-down, it displays one less chapter than it should. Genesis has 50 chapters; it displays 49. To correct this, I had to add 1 chapter number to each in the bible_csv file. So, the first line of king_james.txt needed to be changed from Genesis,50 to Genesis,51.

CommentFileSizeAuthor
#3 patch to correct number of chapters541 bytesflickerfly

Comments

flickerfly’s picture

Title: CSV file not being read correctly? » Chapters missing the last chapter of each book

Looks like this is happening in the bible_field.js file where it decides how many to display. I imagine someone with some limited javascript understanding could pull this fix off rather quickly. I can't figure out how its getting its information so I'm having trouble being sure I can come up with a reasonable fix.

200 Chapters are given in the html and then the js weeds it out to the correct number. Here's a quick link if someone want to take a look:
http://drupalcode.org/viewvc/drupal/contributions/modules/bible_field/bi...

flickerfly’s picture

Digging more, it looks like the chapters are put into the HTML as a hidden input for the form. Here's an example.

<input type="hidden" name="Genesis" value="50

So it is getting passed into the javascript properly. I'm going to guess that a javascript array starts at 0 and so it counts up to one less than we expect.

Could we change bible_field.js line 52 from:

 var chapters = $element.parents('table').find('input[name="' + $element.val() + '"]:first').val();

to

 var chapters = $element.parents('table').find('input[name="' + $element.val() + '"]:first').val() + 1;
flickerfly’s picture

StatusFileSize
new541 bytes

That didn't work, but adding a line immediately after to increment it by one did. Here's a simple patch that includes this change.

chrisshattuck’s picture

Thanks for the patch, flickerfly. I did something similar to make the fix, just changing the < chapters to <= chapters. I also just noticed that there was a second place where that code is run for the Views filters, which is fixed in head and will be added in BETA3 ;).

chrisshattuck’s picture

Status: Active » Fixed

Marking as fixed.

flickerfly’s picture

Ah, excellent! I'll give it all a go as soon as I can. :-) I like your solution better.

flickerfly’s picture

worked

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.